Skip to content

Commit 9c25ee0

Browse files
committed
place test objects in the working dir for inspection
1 parent 88f033a commit 9c25ee0

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

bindings/java/src/test/java/com/example/ManifoldBindingsTest.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ManifoldBindingsTest {
4747
private static final double CUBE_SIZE = 10.0;
4848
private static final double SPHERE_R = 6.0;
4949
private static final int SPHERE_SEGS = 100;
50+
private Path tmpDir = new File(".").toPath();
5051

5152
// -------------------------------------------------------------------------
5253
// Lifecycle
@@ -131,27 +132,28 @@ private java.lang.foreign.MemorySegment assertStlRoundTrip(java.lang.foreign.Mem
131132

132133
return reimported;
133134
}
134-
135+
135136
@Test
136-
public void testMeshGL64() throws Throwable{
137+
public void testMeshGL64() throws Throwable {
137138
java.lang.foreign.MemorySegment cube = makeCube();
138-
MemorySegment loaded=null;
139+
MemorySegment loaded = null;
139140
try {
140141
assertMeshValid(cube, "Cube");
141142
// A cube has 8 vertices and 12 triangles (6 faces × 2)
142143
assertEquals(8, mb.numVert(cube), "Cube should have 8 vertices");
143144
assertEquals(12, mb.numTri(cube), "Cube should have 12 triangles");
144-
145+
145146
MeshData64 meshgl = mb.exportMeshGL64(cube);
146147
double[] verts = meshgl.vertices(); // flat [x0,y0,z0, x1,y1,z1, ...]
147148
long[] tris = meshgl.triangles(); // flat [i0,i1,i2, i3,i4,i5, ...]
148149
int triCount = meshgl.triCount();
149150
loaded = mb.importMeshGL64(verts, tris, triCount, triCount);
150-
151+
151152
MeshData64 meshglLoaded = mb.exportMeshGL64(loaded);
152-
double[] vertsl = meshglLoaded.vertices(); // flat [x0,y0,z0, x1,y1,z1, ...]
153-
long[] trisl = meshglLoaded.triangles(); // flat [i0,i1,i2, i3,i4,i5, ...]
153+
// double[] vertsl = meshglLoaded.vertices(); // flat [x0,y0,z0, x1,y1,z1, ...]
154+
// long[] trisl = meshglLoaded.triangles(); // flat [i0,i1,i2, i3,i4,i5, ...]
154155
int triCountl = meshglLoaded.triCount();
156+
assertEquals(triCountl, triCount, "Matching trinagle count");
155157
} finally {
156158
mb.safeDelete(cube);
157159
mb.safeDelete(loaded);
@@ -241,7 +243,7 @@ void testSpherePrimitive() throws Throwable {
241243
@Test
242244
@Order(10)
243245
@DisplayName("Union(cube, sphere): valid mesh, STL + 3MF round-trip")
244-
void testUnionRoundTrip(@TempDir Path tmpDir) throws Throwable {
246+
void testUnionRoundTrip() throws Throwable {
245247
java.lang.foreign.MemorySegment cube = makeCube();
246248
java.lang.foreign.MemorySegment sphere = makeSphere();
247249
java.lang.foreign.MemorySegment result = null;
@@ -281,7 +283,7 @@ void testUnionRoundTrip(@TempDir Path tmpDir) throws Throwable {
281283
@Test
282284
@Order(20)
283285
@DisplayName("Difference(cube, sphere): valid mesh, STL + 3MF round-trip")
284-
void testDifferenceRoundTrip(@TempDir Path tmpDir) throws Throwable {
286+
void testDifferenceRoundTrip() throws Throwable {
285287
java.lang.foreign.MemorySegment cube = makeCube();
286288
java.lang.foreign.MemorySegment sphere = makeSphere();
287289
java.lang.foreign.MemorySegment result = null;
@@ -319,7 +321,7 @@ void testDifferenceRoundTrip(@TempDir Path tmpDir) throws Throwable {
319321
@Test
320322
@Order(30)
321323
@DisplayName("Intersection(cube, sphere): valid mesh, STL + 3MF round-trip")
322-
void testIntersectionRoundTrip(@TempDir Path tmpDir) throws Throwable {
324+
void testIntersectionRoundTrip() throws Throwable {
323325
java.lang.foreign.MemorySegment cube = makeCube();
324326
java.lang.foreign.MemorySegment sphere = makeSphere();
325327
java.lang.foreign.MemorySegment result = null;
@@ -360,7 +362,7 @@ void testIntersectionRoundTrip(@TempDir Path tmpDir) throws Throwable {
360362
@Test
361363
@Order(40)
362364
@DisplayName("Hull(cube): valid mesh, STL + 3MF round-trip")
363-
void testHullCubeRoundTrip(@TempDir Path tmpDir) throws Throwable {
365+
void testHullCubeRoundTrip() throws Throwable {
364366
java.lang.foreign.MemorySegment cube = makeCube();
365367
java.lang.foreign.MemorySegment result = null;
366368
java.lang.foreign.MemorySegment stlRe = null;
@@ -390,7 +392,7 @@ void testHullCubeRoundTrip(@TempDir Path tmpDir) throws Throwable {
390392
@Test
391393
@Order(41)
392394
@DisplayName("Hull(sphere): valid mesh, STL + 3MF round-trip")
393-
void testHullSphereRoundTrip(@TempDir Path tmpDir) throws Throwable {
395+
void testHullSphereRoundTrip() throws Throwable {
394396
java.lang.foreign.MemorySegment sphere = makeSphere();
395397
java.lang.foreign.MemorySegment result = null;
396398
java.lang.foreign.MemorySegment stlRe = null;
@@ -421,7 +423,7 @@ void testHullSphereRoundTrip(@TempDir Path tmpDir) throws Throwable {
421423
@Test
422424
@Order(42)
423425
@DisplayName("BatchHull([cube, sphere]): valid mesh, STL + 3MF round-trip")
424-
void testBatchHullRoundTrip(@TempDir Path tmpDir) throws Throwable {
426+
void testBatchHullRoundTrip() throws Throwable {
425427
java.lang.foreign.MemorySegment cube = makeCube();
426428
java.lang.foreign.MemorySegment sphere = makeSphere();
427429
java.lang.foreign.MemorySegment result = null;
@@ -460,7 +462,7 @@ void testBatchHullRoundTrip(@TempDir Path tmpDir) throws Throwable {
460462
@Test
461463
@Order(50)
462464
@DisplayName("3MF multi-mesh: export cube+sphere, re-import both objects")
463-
void testMultiMesh3mfRoundTrip(@TempDir Path tmpDir) throws Throwable {
465+
void testMultiMesh3mfRoundTrip() throws Throwable {
464466
java.lang.foreign.MemorySegment cube = makeCube();
465467
java.lang.foreign.MemorySegment sphere = makeSphere();
466468
ArrayList<java.lang.foreign.MemorySegment> imported = null;
@@ -508,7 +510,7 @@ void testMultiMesh3mfRoundTrip(@TempDir Path tmpDir) throws Throwable {
508510
@Test
509511
@Order(60)
510512
@DisplayName("STL file size: matches 80 + 4 + triCount * 50 formula")
511-
void testStlFileSizeFormula(@TempDir Path tmpDir) throws Throwable {
513+
void testStlFileSizeFormula() throws Throwable {
512514
java.lang.foreign.MemorySegment cube = makeCube();
513515
try {
514516
File stlFile = tmpDir.resolve("cube_size.stl").toFile();
@@ -525,7 +527,7 @@ void testStlFileSizeFormula(@TempDir Path tmpDir) throws Throwable {
525527
@Test
526528
@Order(61)
527529
@DisplayName("3MF file: is a valid ZIP archive containing 3D/3dmodel.model")
528-
void testThreeMfIsValidZip(@TempDir Path tmpDir) throws Throwable {
530+
void testThreeMfIsValidZip() throws Throwable {
529531
java.lang.foreign.MemorySegment sphere = makeSphere();
530532
try {
531533
File threeMfFile = tmpDir.resolve("sphere.3mf").toFile();
@@ -840,7 +842,7 @@ void testSliceSphereNearPole() throws Throwable {
840842
@Test
841843
@Order(90)
842844
@DisplayName("Load 5 STLs (cube, sphere, union, diff, intersect) → save as multi-part 3MF → verify")
843-
void testMultiStlToMultiPart3mf(@TempDir Path tmpDir) throws Throwable {
845+
void testMultiStlToMultiPart3mf() throws Throwable {
844846

845847
// ── 1. Build all five source manifolds ────────────────────────────
846848
java.lang.foreign.MemorySegment cube = makeCube();

0 commit comments

Comments
 (0)