summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testdata/scad/misc/normal-nan.scad16
-rw-r--r--tests/CMakeLists.txt12
-rw-r--r--tests/regression/cgalstlsanitytest/normal-nan-expected.txt0
3 files changed, 28 insertions, 0 deletions
diff --git a/testdata/scad/misc/normal-nan.scad b/testdata/scad/misc/normal-nan.scad
new file mode 100644
index 0000000..1c3f6ce
--- /dev/null
+++ b/testdata/scad/misc/normal-nan.scad
@@ -0,0 +1,16 @@
+/*
+ When exporting this to STL, null polygons appear, causing
+ problems normalizing normal vectors (nan output in STL files)
+*/
+
+$fs=0.2;
+
+difference() {
+ cube(8);
+
+ translate([0,20,4]) rotate([90,0,0]) union() {
+ translate([0,-3,14.5]) cube([5.4,6,2.4],center=true);
+ translate([0,0,13.3]) rotate([0,0,30]) cylinder(r=3.115,h=2.4,$fn=6);
+ }
+}
+
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a8ab9b9..b374188 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -361,6 +361,13 @@ set_target_properties(cgaltest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CX
target_link_libraries(cgaltest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
#
+# cgalstlsanitytest
+#
+add_executable(cgalstlsanitytest cgalstlsanitytest.cc)
+set_target_properties(cgalstlsanitytest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}")
+target_link_libraries(cgalstlsanitytest tests-cgal ${CGAL_LIBRARY} ${CGAL_3RD_PARTY_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${Boost_LIBRARIES})
+
+#
# cgalpngtest
#
add_executable(cgalpngtest cgalpngtest.cc bboxhelp.cc ../src/CGALRenderer.cc ../src/renderer.cc ../src/rendersettings.cc)
@@ -535,6 +542,8 @@ list(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES})
list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/bbox-transform-bug.scad)
list(APPEND THROWNTOGETHERTEST_FILES ${OPENCSGTEST_FILES})
+list(APPEND CGALSTLSANITYTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/normal-nan.scad)
+
# Disable tests which are known to cause floating point comparison issues
# Once we're capable of comparing these across platforms, we can put these back in
disable_tests(dumptest_transform-tests
@@ -598,6 +607,9 @@ add_cmdline_test(csgtermtest txt ${MINIMAL_FILES})
add_cmdline_test(cgalpngtest png ${CGALPNGTEST_FILES})
add_cmdline_test(opencsgtest png ${OPENCSGTEST_FILES})
add_cmdline_test(throwntogethertest png ${THROWNTOGETHERTEST_FILES})
+# FIXME: We don't actually need to compare the output of cgalstlsanitytest
+# with anything. It's self-contained and returns != 0 on error
+add_cmdline_test(cgalstlsanitytest txt ${CGALSTLSANITYTEST_FILES})
message("Available test configurations: ${TEST_CONFIGS}")
#foreach(CONF ${TEST_CONFIGS})
diff --git a/tests/regression/cgalstlsanitytest/normal-nan-expected.txt b/tests/regression/cgalstlsanitytest/normal-nan-expected.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/regression/cgalstlsanitytest/normal-nan-expected.txt
contact: Jan Huwald // Impressum