diff options
author | Marius Kintel <marius@kintel.net> | 2012-06-04 09:22:09 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-06-04 09:22:09 (GMT) |
commit | 38cb06c3f0c62cbbe911a1543128bde610c45031 (patch) | |
tree | f9e278f298e44a288b6fb0e97b1b0f8e938ef38d /testdata/scad/templates | |
parent | 2836f0c37273aa41ba8280ee459ced418dbb74ea (diff) |
Added test cases for issue #123
Diffstat (limited to 'testdata/scad/templates')
4 files changed, 126 insertions, 0 deletions
diff --git a/testdata/scad/templates/import_dxf-tests-template.scad b/testdata/scad/templates/import_dxf-tests-template.scad new file mode 100644 index 0000000..f10dd06 --- /dev/null +++ b/testdata/scad/templates/import_dxf-tests-template.scad @@ -0,0 +1,10 @@ +import(); +translate([-210,0,0]) import(file="../../dxf/polygons.dxf"); +translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[0,110]); +translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[110,110], scale=0.5); +import(file="../../dxf/multiple-layers.dxf"); +translate([-200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); +translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0"); +translate([200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="noname"); +translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="Layer with a pretty long name including \\ \"special\" /'\\\\ characters"); +translate([200,0,0]) import(file="@CMAKE_SOURCE_DIR@/../testdata/dxf/polygons.dxf"); diff --git a/testdata/scad/templates/import_stl-tests-template.scad b/testdata/scad/templates/import_stl-tests-template.scad new file mode 100644 index 0000000..685b868 --- /dev/null +++ b/testdata/scad/templates/import_stl-tests-template.scad @@ -0,0 +1,4 @@ +import_stl("import.stl"); +translate([2,0,0]) import("import.stl"); +translate([4,0,0]) import("import_bin.stl"); +translate([0,2,0]) import("@CMAKE_SOURCE_DIR@/../testdata/scad/features/import.stl"); diff --git a/testdata/scad/templates/include-tests-template.scad b/testdata/scad/templates/include-tests-template.scad new file mode 100644 index 0000000..43bda57 --- /dev/null +++ b/testdata/scad/templates/include-tests-template.scad @@ -0,0 +1,55 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +include <sub1/sub2/sub3/sub4/include-test2.scad> + +//Test that a non existent path/file doesn't screw things up +include <non/existent/path/non-file> + +//Test with empty path +include <include-test5.scad> + +//Test without preceding space +include<include-test5.scad> + +//Test with other strange character that is allowed +include>>>>><include-test5.scad> + +//Test that filenames with spaces work +include <include test6.scad> + +//Test with empty file +include<test/> + +//Test with empty path and file +include </> + +//Test with absolute path +include <@CMAKE_SOURCE_DIR@/../testdata/scad/misc/sub2/test7.scad> + +// Test simple MCAD include +include <MCAD/constants.scad> + +// Test MCAD include which includes another file +include <MCAD/math.scad> + +// Test MCAD include which uses another file +include <MCAD/servos.scad> + +module test1() +{ + test2(); + translate([2,0,0]) test3(); + translate([2,-2,0]) test4(); + translate([-2,0,0]) test5(); + translate([-2,-2,0]) test6(); + translate([0,2,0]) test7(); + + //Just to give a top level object + translate([0,-2,0]) sphere(test2_variable, $fn=16); + + // MCAD + translate([0,-4,0]) cube([TAU/4,0.5,0.5], center=true); + translate([-2,-4,0]) cube([deg(0.5)/20,0.5,0.5], center=true); + translate([2,-4,-0.5]) scale(0.05) alignds420([0,0,0], [0,0,0]); +} + +test1(); diff --git a/testdata/scad/templates/use-tests-template.scad b/testdata/scad/templates/use-tests-template.scad new file mode 100644 index 0000000..24591f8 --- /dev/null +++ b/testdata/scad/templates/use-tests-template.scad @@ -0,0 +1,57 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +use <sub1/sub2/sub3/sub4/use-test2.scad> + +//Test that a non existent path/file doesn't screw things up +use <non/existent/path/non-file> + +//Test with empty path +use <use-test5.scad> + +//Test without preceding space +use<use-test5.scad> + +//Test with other strange character that is allowed +use>>>>><use-test5.scad> + +//Test that filenames with spaces work +use <use test6.scad> + +//Test with empty file +use<test/> + +//Test with empty path and file +use </> + +//Test with absolute path +include <@CMAKE_SOURCE_DIR@/../testdata/scad/misc/sub2/test7.scad> + +// Test simple MCAD library +include <MCAD/teardrop.scad> + +// Test MCAD library which includes another file +include <MCAD/math.scad> + +// Test MCAD library which uses another file +include <MCAD/servos.scad> + +module test1() +{ + test2(); + // test3() and test4() are not directly included and thus not imported into + // this scope + translate([4,0,0]) test3(); + translate([4,-2,0]) test4(); + translate([-2,0,0]) test5(); + translate([-2,-2,0]) test6(); + translate([0,2,0]) test7(); + + // test2_variable won't be visible + translate([0,-2,0]) sphere(test2_variable, $fn=16); + + // MCAD + translate([0,-4,0]) teardrop(0.3, 1.5, 90); + translate([-2,-4,0]) cube([deg(0.5)/20,0.5,0.5], center=true); + translate([2,-4,-0.5]) scale(0.05) alignds420([0,0,0], [0,0,0]); +} + +test1(); |