diff options
author | Marius Kintel <marius@kintel.net> | 2013-04-27 04:55:15 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-04-27 04:55:15 (GMT) |
commit | 6b3daa748543f13cc7cf8eff1c9efeebd6dc3a14 (patch) | |
tree | 8869b03872b42ce1ffb1755958d05925f9f0bcb4 /tests | |
parent | f0ee85e17d474ab9119f82ee6f802d4634743b12 (diff) | |
parent | 5f10c9f9c0a9805567ea8f9b560c6e0b50126119 (diff) |
Merge pull request #326 from openscad/issue217
Issue217
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/dumptest.cc | 10 | ||||
-rw-r--r-- | tests/regression/cgalpngtest/localfiles-test-expected.png | bin | 0 -> 8454 bytes | |||
-rw-r--r-- | tests/regression/cgalpngtest/modulevariables-expected.png | bin | 0 -> 9534 bytes | |||
-rw-r--r-- | tests/regression/dumptest/localfiles-test-expected.txt | 17 | ||||
-rw-r--r-- | tests/regression/dumptest/modulevariables-expected.txt | 4 | ||||
-rw-r--r-- | tests/regression/opencsgtest/localfiles-test-expected.png | bin | 0 -> 8844 bytes | |||
-rw-r--r-- | tests/regression/opencsgtest/modulevariables-expected.png | bin | 0 -> 9854 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/localfiles-test-expected.png | bin | 0 -> 8844 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/modulevariables-expected.png | bin | 0 -> 9854 bytes |
10 files changed, 31 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d178f0f..34432d3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -754,12 +754,15 @@ list(APPEND ECHO_FILES ${FUNCTION_FILES} list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} ${FEATURES_FILES} ${EXAMPLE_FILES}) list(APPEND DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/escape-test.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad) list(APPEND CGALPNGTEST_FILES ${FEATURES_FILES} ${SCAD_DXF_FILES} ${EXAMPLE_FILES}) list(APPEND CGALPNGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/include-tests.scad ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/use-tests.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/transform-nan-inf-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/localfiles-test.scad) + list(APPEND OPENCSGTEST_FILES ${CGALPNGTEST_FILES}) list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/bbox-transform-bug.scad) list(APPEND OPENCSGTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/intersection-prune-test.scad) diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 4ddefe2..32c9842 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -115,7 +115,6 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(original_path); std::ofstream outfile; outfile.open(outfilename); outfile << dumpstdstr << "\n"; @@ -124,21 +123,22 @@ int main(int argc, char **argv) delete root_node; delete root_module; + fs::current_path(original_path); root_module = parsefile(outfilename); if (!root_module) { fprintf(stderr, "Error: Unable to read back dumped file\n"); exit(1); } - if (fs::path(filename).has_parent_path()) { - fs::current_path(fs::path(filename).parent_path()); - } - AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); tree.setRoot(root_node); + if (fs::path(outfilename).has_parent_path()) { + fs::current_path(fs::path(outfilename).parent_path()); + } + string readbackstr = dumptree(tree, *root_node); if (dumpstdstr != readbackstr) { fprintf(stderr, "Error: Readback is different from original dump:\n"); diff --git a/tests/regression/cgalpngtest/localfiles-test-expected.png b/tests/regression/cgalpngtest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..3ad3d96 --- /dev/null +++ b/tests/regression/cgalpngtest/localfiles-test-expected.png diff --git a/tests/regression/cgalpngtest/modulevariables-expected.png b/tests/regression/cgalpngtest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..0dc18e8 --- /dev/null +++ b/tests/regression/cgalpngtest/modulevariables-expected.png diff --git a/tests/regression/dumptest/localfiles-test-expected.txt b/tests/regression/dumptest/localfiles-test-expected.txt new file mode 100644 index 0000000..acdf7e7 --- /dev/null +++ b/tests/regression/dumptest/localfiles-test-expected.txt @@ -0,0 +1,17 @@ + group() { + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2) { + import(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) { + rotate_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2); + } + multmatrix([[1, 0, 0, 250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 50, 0], [0, 0, 0, 1]]) { + surface(file = "localfiles_dir/localfile.dat", center = false); + } + } + } + diff --git a/tests/regression/dumptest/modulevariables-expected.txt b/tests/regression/dumptest/modulevariables-expected.txt new file mode 100644 index 0000000..fed4bbc --- /dev/null +++ b/tests/regression/dumptest/modulevariables-expected.txt @@ -0,0 +1,4 @@ + group() { + cylinder($fn = 0, $fa = 12, $fs = 2, h = 10, r1 = 23, r2 = 10, center = false); + } + diff --git a/tests/regression/opencsgtest/localfiles-test-expected.png b/tests/regression/opencsgtest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..7bc7909 --- /dev/null +++ b/tests/regression/opencsgtest/localfiles-test-expected.png diff --git a/tests/regression/opencsgtest/modulevariables-expected.png b/tests/regression/opencsgtest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..bf23265 --- /dev/null +++ b/tests/regression/opencsgtest/modulevariables-expected.png diff --git a/tests/regression/throwntogethertest/localfiles-test-expected.png b/tests/regression/throwntogethertest/localfiles-test-expected.png Binary files differnew file mode 100644 index 0000000..7bc7909 --- /dev/null +++ b/tests/regression/throwntogethertest/localfiles-test-expected.png diff --git a/tests/regression/throwntogethertest/modulevariables-expected.png b/tests/regression/throwntogethertest/modulevariables-expected.png Binary files differnew file mode 100644 index 0000000..bf23265 --- /dev/null +++ b/tests/regression/throwntogethertest/modulevariables-expected.png |