diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 05:17:17 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 05:17:17 (GMT) |
commit | 6af6c311a12a0211545e29666c92f1806ca0c7e8 (patch) | |
tree | 5af3769a2bbd2cdc44508152cc1d2c72b2331e77 /tests | |
parent | b53dde04e2a13c066cfa0c552fe5bd0cdd1b8dbd (diff) |
cmdline throwntogether, integrate w chrysn tests, update resize tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/CTestCustom.template | 4 | ||||
-rw-r--r-- | tests/csgtestcore.cc | 54 | ||||
-rw-r--r-- | tests/regression/cgalpngtest/resize-2d-tests-expected.png | bin | 2436 -> 2351 bytes | |||
-rw-r--r-- | tests/regression/cgalpngtest/resize-tests-expected.png | bin | 4422 -> 4765 bytes | |||
-rw-r--r-- | tests/regression/dumptest/resize-tests-expected.csg | 46 | ||||
-rw-r--r-- | tests/regression/opencsgtest/resize-2d-tests-expected.png | bin | 3317 -> 3193 bytes | |||
-rw-r--r-- | tests/regression/opencsgtest/resize-tests-expected.png | bin | 5106 -> 5627 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/resize-2d-tests-expected.png | bin | 3277 -> 3154 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/resize-tests-expected.png | bin | 5116 -> 5627 bytes |
10 files changed, 53 insertions, 61 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f0b31e9..5d4614a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -544,9 +544,9 @@ target_link_libraries(cgalcachetest tests-cgal ${TESTS-CGAL-LIBRARIES} ${GLEW_LI # throwntogethertest # -add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/renderer.cc ../src/rendersettings.cc) -set_target_properties(throwntogethertest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}") -target_link_libraries(throwntogethertest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY}) +#add_executable(throwntogethertest throwntogethertest.cc csgtestcore.cc ../src/OpenCSGRenderer.cc ../src/ThrownTogetherRenderer.cc ../src/renderer.cc ../src/rendersettings.cc) +#set_target_properties(throwntogethertest PROPERTIES COMPILE_FLAGS "-DENABLE_OPENCSG -DENABLE_CGAL ${CGAL_CXX_FLAGS_INIT}") +#target_link_libraries(throwntogethertest tests-offscreen tests-cgal ${OPENCSG_LIBRARY} ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY}) # # GUI binary tests @@ -836,6 +836,7 @@ string(REPLACE __cmake_current_source_dir__ ${CMAKE_CURRENT_SOURCE_DIR} TMP ${TM string(REPLACE __python__ ${PYTHON_EXECUTABLE} TMP ${TMP}) string(REPLACE __header__ "Generated by cmake from ${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.template" TMP ${TMP}) string(REPLACE __cmake_system_name__ ${CMAKE_SYSTEM_NAME} TMP ${TMP}) +string(REPLACE __gui_binpath__ ${GUI_BINPATH} TMP ${TMP}) if (MINGW_CROSS_ENV_DIR) string(REPLACE __wine__ wine TMP ${TMP}) @@ -864,7 +865,8 @@ add_cmdline_test(csgtermtest EXE ${GUI_BINPATH} ARGS -o SUFFIX term FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/allmodules.scad) add_cmdline_test(cgalpngtest EXE ${GUI_BINPATH} ARGS --render -o SUFFIX png FILES ${CGALPNGTEST_FILES}) add_cmdline_test(opencsgtest EXE ${GUI_BINPATH} ARGS -o SUFFIX png FILES ${OPENCSGTEST_FILES}) -add_cmdline_test(throwntogethertest SUFFIX png FILES ${THROWNTOGETHERTEST_FILES}) +add_cmdline_test(throwntogethertest EXE ${GUI_BINPATH} ARGS --preview=throwntogether -o SUFFIX png FILES ${THROWNTOGETHERTEST_FILES}) +#add_cmdline_test(throwntogethertest SUFFIX png FILES ${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 EXE ${CMAKE_SOURCE_DIR}/cgalstlsanitytest SUFFIX txt ARGS ${GUI_BINPATH} FILES ${CGALSTLSANITYTEST_FILES}) diff --git a/tests/CTestCustom.template b/tests/CTestCustom.template index fd6ba8b..b8d04ce 100644 --- a/tests/CTestCustom.template +++ b/tests/CTestCustom.template @@ -58,8 +58,8 @@ endif() # Part 1. Pretty Printing -message("running 'opencsgtest --info' to generate sysinfo.txt") -execute_process(COMMAND __wine__ __cmake_current_binary_dir__/opencsgtest --info OUTPUT_FILE sysinfo.txt) +message("running '__gui_binpath__ --info' to generate sysinfo.txt") +execute_process(COMMAND __wine__ __gui_binpath__ --info OUTPUT_FILE sysinfo.txt) set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "__cmake_current_binary_dir__/test_pretty_print") if ( ${debug_openscad_template} ) diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 7b9dbab..780dc2a 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -44,45 +44,11 @@ std::string commandline_commands; //#define DEBUG -string info_dump(OffscreenView *glview) -{ - assert(glview); - -#ifdef __GNUG__ -#define compiler_info "GCC " << __VERSION__ -#elif defined(_MSC_VER) -#define compiler_info "MSVC " << _MSC_FULL_VER -#else -#define compiler_info "unknown compiler" -#endif - -#ifndef OPENCSG_VERSION_STRING -#define OPENCSG_VERSION_STRING "unknown, <1.3.2" -#endif - - std::stringstream out; -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) - out << "\nOpenSCAD Version: " << TOSTRING(OPENSCAD_VERSION) - << "\nCompiled by: " << compiler_info - << "\nCompile date: " << __DATE__ - << "\nBoost version: " << BOOST_LIB_VERSION - << "\nEigen version: " << EIGEN_WORLD_VERSION << "." - << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION - << "\nCGAL version: " << TOSTRING(CGAL_VERSION) - << "\nOpenCSG version: " << OPENCSG_VERSION_STRING - << "\n" << glview->getRendererInfo() - << "\n"; - - return out.str(); -} - po::variables_map parse_options(int argc, char *argv[]) { po::options_description desc("Allowed options"); desc.add_options() ("help,h", "help message")//; - ("info,i", "information on GLEW, OpenGL, OpenSCAD, and OS")//; // po::options_description hidden("Hidden options"); // hidden.add_options() @@ -104,7 +70,6 @@ po::variables_map parse_options(int argc, char *argv[]) int csgtestcore(int argc, char *argv[], test_type_e test_type) { - bool sysinfo_dump = false; const char *filename, *outfilename = NULL; po::variables_map vm; try { @@ -112,13 +77,12 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } catch ( po::error e ) { cerr << "error parsing options\n"; } - if (vm.count("info")) sysinfo_dump = true; if (vm.count("input-file")) filename = vm["input-file"].as< vector<string> >().begin()->c_str(); if (vm.count("output-file")) outfilename = vm["output-file"].as< vector<string> >().begin()->c_str(); - if ((!filename || !outfilename) && !sysinfo_dump) { + if ((!filename || !outfilename)) { cerr << "Usage: " << argv[0] << " <file.scad> <output.png>\n"; exit(1); } @@ -138,21 +102,16 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) FileModule *root_module; ModuleInstantiation root_inst("group"); - if (sysinfo_dump) - root_module = parse("sphere();","",false); - else - root_module = parsefile(filename); + root_module = parsefile(filename); if (!root_module) { exit(1); } - if (!sysinfo_dump) { - fs::path fpath = boosty::absolute(fs::path(filename)); - fs::path fparent = fpath.parent_path(); - fs::current_path(fparent); - top_ctx.setDocumentPath(fparent.string()); - } + fs::path fpath = boosty::absolute(fs::path(filename)); + fs::path fparent = fpath.parent_path(); + fs::current_path(fparent); + top_ctx.setDocumentPath(fparent.string()); AbstractNode::resetIndexCounter(); AbstractNode *absolute_root_node = root_module->instantiate(&top_ctx, &root_inst); @@ -174,7 +133,6 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) exit(1); } - if (sysinfo_dump) cout << info_dump(csgInfo.glview); Camera camera(Camera::VECTOR); camera.center << 0,0,0; double radius = 1.0; diff --git a/tests/regression/cgalpngtest/resize-2d-tests-expected.png b/tests/regression/cgalpngtest/resize-2d-tests-expected.png Binary files differindex 44e9598..01cc5b1 100644 --- a/tests/regression/cgalpngtest/resize-2d-tests-expected.png +++ b/tests/regression/cgalpngtest/resize-2d-tests-expected.png diff --git a/tests/regression/cgalpngtest/resize-tests-expected.png b/tests/regression/cgalpngtest/resize-tests-expected.png Binary files differindex 8f994bf..996a7a6 100644 --- a/tests/regression/cgalpngtest/resize-tests-expected.png +++ b/tests/regression/cgalpngtest/resize-tests-expected.png diff --git a/tests/regression/dumptest/resize-tests-expected.csg b/tests/regression/dumptest/resize-tests-expected.csg index 1e7888a..29e7f50 100644 --- a/tests/regression/dumptest/resize-tests-expected.csg +++ b/tests/regression/dumptest/resize-tests-expected.csg @@ -230,42 +230,74 @@ group() { } } color([1, 0.752941, 0.796078, 1]) { - multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [4,4,4], auto = [0,0,0]) { resize(newsize = [5000,100,1000], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [-5,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 20], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [-5,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 30], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [0,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 40], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [0,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 50], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [0.5,0,7], auto = [0,0,0]) { cube(size = [0.5, 1, 1000], center = false); } } - multmatrix([[1, 0, 0, 10], [0, 1, 0, 60], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { resize(newsize = [0,0,0.5], auto = [0,0,0]) { cube(size = [6, 6, 1e+10], center = false); } } } + color([0, 1, 0, 1]) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [5,0,0], auto = [1,1,0]) { + cube(size = [9, 9, 9], center = false); + } + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [6,0,0], auto = [1,1,1]) { + cube(size = [9, 9, 9], center = false); + } + } + multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [6,0,0], auto = [1,0,1]) { + cube(size = [9, 9, 9], center = false); + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [5,0,20], auto = [0,1,1]) { + cube(size = [9, 9, 9], center = false); + } + } + multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [0,0,7], auto = [0,0,1]) { + cube(size = [9, 9, 9], center = false); + } + } + multmatrix([[1, 0, 0, 70], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + resize(newsize = [6,0,0], auto = [1,1,0]) { + cube(size = [9, 9, 9], center = false); + } + } + } } diff --git a/tests/regression/opencsgtest/resize-2d-tests-expected.png b/tests/regression/opencsgtest/resize-2d-tests-expected.png Binary files differindex d3bda96..5a2d976 100644 --- a/tests/regression/opencsgtest/resize-2d-tests-expected.png +++ b/tests/regression/opencsgtest/resize-2d-tests-expected.png diff --git a/tests/regression/opencsgtest/resize-tests-expected.png b/tests/regression/opencsgtest/resize-tests-expected.png Binary files differindex 0334ba6..66f3d43 100644 --- a/tests/regression/opencsgtest/resize-tests-expected.png +++ b/tests/regression/opencsgtest/resize-tests-expected.png diff --git a/tests/regression/throwntogethertest/resize-2d-tests-expected.png b/tests/regression/throwntogethertest/resize-2d-tests-expected.png Binary files differindex 4737cf7..1c007ed 100644 --- a/tests/regression/throwntogethertest/resize-2d-tests-expected.png +++ b/tests/regression/throwntogethertest/resize-2d-tests-expected.png diff --git a/tests/regression/throwntogethertest/resize-tests-expected.png b/tests/regression/throwntogethertest/resize-tests-expected.png Binary files differindex 7445c1c..66f3d43 100644 --- a/tests/regression/throwntogethertest/resize-tests-expected.png +++ b/tests/regression/throwntogethertest/resize-tests-expected.png |