diff --git a/testdata/scad/features/child-tests.scad b/testdata/scad/features/child-tests.scad new file mode 100644 index 00000000..e4e35722 --- /dev/null +++ b/testdata/scad/features/child-tests.scad @@ -0,0 +1,34 @@ +$fn=16; + +module parent() { + for (i=[0:2]) { + translate([2.5*i,0,0]) child(i); + } +} + +// Normal +parent() { + sphere(); + cylinder(h=2, center=true); + cube(2, center=true); +} + +// No children +parent(); + +// Too few children +translate([0,3,0]) parent() { sphere(); } + +// No parameter to child +module parent2() { + child(); +} + +translate([2.5,3,0]) parent2() { cylinder(h=2, center=true); sphere(); } + +// Negative parameter to child +module parent3() { + child(-1); +} + +translate([5,3,0]) parent3() { cube(); sphere(); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f7fd320c..1934b86f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -234,7 +234,8 @@ LIST(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/render-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/projection-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/features/assign-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/features/include-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/features/child-tests.scad) #LIST(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad) add_cmdline_test(cgalpngtest png ${CGALPNGTEST_FILES}) diff --git a/tests/regression/cgalpngtest/child-tests-expected.png b/tests/regression/cgalpngtest/child-tests-expected.png new file mode 100644 index 00000000..ed6207c2 Binary files /dev/null and b/tests/regression/cgalpngtest/child-tests-expected.png differ diff --git a/tests/regression/opencsgtest/child-tests-expected.png b/tests/regression/opencsgtest/child-tests-expected.png new file mode 100644 index 00000000..e8ea39b1 Binary files /dev/null and b/tests/regression/opencsgtest/child-tests-expected.png differ