diff options
author | Marius Kintel <marius@kintel.net> | 2013-04-05 05:30:09 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-04-05 05:30:09 (GMT) |
commit | 1b8b7aa5faa167af2687970f195e19439dab5a30 (patch) | |
tree | 5a01a4f97c91bbfeb8a975975da5c31232d7b921 /tests | |
parent | c7f83aa3e35baf8a517c40a367ec247a7061b225 (diff) |
I think this should fix issue #217
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/dumptest/localfiles-test-expected.txt | 17 | ||||
-rw-r--r-- | tests/regression/opencsgtest/localfiles-test-expected.png | bin | 0 -> 8844 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/localfiles-test-expected.png | bin | 0 -> 8844 bytes |
6 files changed, 27 insertions, 7 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5eecaae..a0d8f6b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -769,12 +769,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 b75a2e2..3627608 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -118,7 +118,6 @@ int main(int argc, char **argv) exit(1); } - fs::current_path(original_path); std::ofstream outfile; outfile.open(outfilename); outfile << dumpstdstr << "\n"; @@ -127,21 +126,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/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/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/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 |