diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-09-13 01:03:27 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-09-13 01:03:27 (GMT) |
commit | 30fd8b250af29c16dc25013b4aceb91cf51a7432 (patch) | |
tree | 426ea407c087c6dfa4d75e0200a45f6df69b692a | |
parent | d6a57b89682ed7991744dc142e9af21d5e74cb83 (diff) |
little tweaks, cleanups, tab fixing, eliminating comments
-rw-r--r-- | doc/testing.txt | 19 | ||||
-rw-r--r-- | src/export_png.cc | 19 | ||||
-rw-r--r-- | src/openscad.cc | 2 | ||||
-rw-r--r-- | testdata/scad/features/resize-tests.scad | 14 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/regression/cgalpngtest/resize-tests-expected.png | bin | 4765 -> 4786 bytes | |||
-rw-r--r-- | tests/regression/dumptest/resize-tests-expected.csg | 14 | ||||
-rw-r--r-- | tests/regression/opencsgtest/resize-tests-expected.png | bin | 5627 -> 5616 bytes | |||
-rw-r--r-- | tests/regression/throwntogethertest/resize-tests-expected.png | bin | 5627 -> 5616 bytes |
9 files changed, 26 insertions, 51 deletions
diff --git a/doc/testing.txt b/doc/testing.txt index 626bae5..f609b65 100644 --- a/doc/testing.txt +++ b/doc/testing.txt @@ -3,8 +3,10 @@ Running regression tests: Prerequisites: cmake, python, ImageMagick 6.5.9.3 or newer -First, get a working qmake GUI build. It is used by the tests. -Next, get MCAD installed by using 'git submodule update --init' +First, get a working qmake GUI build of the main openscad binary. It is +used by the tests. Next, get MCAD installed by using + + 'git submodule update --init' A) Building test environment @@ -67,18 +69,6 @@ This is almost the same as adding a new regression test: Migration away from dedicated regression tests: ----------------------------------------------- -As the main OpenSCAD binary gained the capability to output PNG renderings, -the necessity for dedicated test binaries went away; for many test, OpenSCAD -is now directly called, resulting in better test coverage and less code to -maintain. - -So far, the following tests have been fully converted to use the main binary: - -* moduledumptest -* csgtermtest -* cgalpngtest -* opencsgtest - Two tests still need an intermediate script that mangles away timestamps and near-zero floating point numbers: @@ -89,7 +79,6 @@ near-zero floating point numbers: Some tests are yet to be converted: * csgtexttest -- verify whether this is not redundant with dumptest -* throwntogethertest -- should be a .png output mode These look like tests, but are not actually in use: diff --git a/src/export_png.cc b/src/export_png.cc index 07c4398..744d681 100644 --- a/src/export_png.cc +++ b/src/export_png.cc @@ -41,9 +41,6 @@ void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, Camera &cam, std::ostream cam.eye = cam.center - radius*2*cameradir; } - //std::cerr << center << "\n"; - //std::cerr << radius << "\n"; - glview->setCamera( cam ); glview->setRenderer(&cgalRenderer); glview->paintGL(); @@ -60,8 +57,8 @@ enum Previewer { OPENCSG, THROWN } previewer; void export_png_preview_common( Tree &tree, Camera &cam, std::ostream &output, Previewer previewer = OPENCSG ) { - CsgInfo csgInfo = CsgInfo(); - if ( !csgInfo.compile_chains( tree ) ) { + CsgInfo csgInfo = CsgInfo(); + if ( !csgInfo.compile_chains( tree ) ) { fprintf(stderr,"Couldn't initialize CSG chains\n"); return; } @@ -74,7 +71,7 @@ void export_png_preview_common( Tree &tree, Camera &cam, std::ostream &output, P } Renderer *renderer; - if ( previewer == OPENCSG) { + if ( previewer == OPENCSG ) { #ifdef ENABLE_OPENCSG OpenCSGRenderer openCSGRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo); renderer = &openCSGRenderer; @@ -97,15 +94,13 @@ void export_png_preview_common( Tree &tree, Camera &cam, std::ostream &output, P } csgInfo.glview->setCamera( cam ); + csgInfo.glview->setRenderer( renderer ); #ifdef ENABLE_OPENCSG - csgInfo.glview->setRenderer(renderer); - OpenCSG::setContext(0); - OpenCSG::setOption(OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject); -#else - csgInfo.glview->setRenderer(renderer); + OpenCSG::setContext( 0 ); + OpenCSG::setOption( OpenCSG::OffscreenSetting, OpenCSG::FrameBufferObject ); #endif csgInfo.glview->paintGL(); - csgInfo.glview->save(output); + csgInfo.glview->save( output ); } void export_png_with_opencsg(Tree &tree, Camera &cam, std::ostream &output) diff --git a/src/openscad.cc b/src/openscad.cc index 56b8acf..c202c88 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -88,7 +88,7 @@ static void help(const char *progname) "%*s[ --camera=translatex,y,z,rotx,y,z,dist | \\\n" "%*s --camera=eyex,y,z,centerx,y,z ] \\\n" "%*s[ --imgsize=width,height ] [ --projection=(o)rtho|(p)ersp] \\\n" - "%*s[ --render | --preview[=throwntogether] ] \\\n" + "%*s[ --render | --preview[=throwntogether] ] \\\n" "%*sfilename\n", progname, tab, "", tab, "", tab, "", tab, "", tab, "", tab, ""); exit(1); diff --git a/testdata/scad/features/resize-tests.scad b/testdata/scad/features/resize-tests.scad index 3150e86..5e78f06 100644 --- a/testdata/scad/features/resize-tests.scad +++ b/testdata/scad/features/resize-tests.scad @@ -73,13 +73,13 @@ translate([10,90,10]) resize([0,0,7],auto=[true,true,false]) cube(); } color("pink"){ -translate([0 , 0,-10]) resize([4,4,4]) resize([5000,100,1000]) cube(); -translate([10,0,-10]) resize([-5,0,0]) cube(); -translate([20,0,-10]) resize([-5,0,0],auto=3) cube(); -translate([30,0,-10]) resize(-5,0,0,auto=3) cube(); -translate([40,0,-10]) resize(5,0,0) cube(); -translate([50,0,-10]) resize([0.5,0,7]) cube([0.5,1,1000]); -translate([60,0,-10]) resize([0,0,0.5]) cube([6,6,10000000000]); +translate([10 , 0,-10]) resize([4,4,4]) resize([5000,100,1000]) cube(); +translate([20,0,-10]) resize([-5,0,0]) cube(); +translate([30,0,-10]) resize([-5,0,0],auto=3) cube(); +translate([40,0,-10]) resize(-5,0,0,auto=3) cube(); +translate([50,0,-10]) resize(5,0,0) cube(); +translate([60,0,-10]) resize([0.5,0,7]) cube([0.5,1,1000]); +translate([70,0,-10]) resize([0,0,0.5]) cube([6,6,10000000000]); } color("lime"){ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5d4614a..2b54c0a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -541,14 +541,6 @@ set_target_properties(cgalcachetest PROPERTIES COMPILE_FLAGS "-DENABLE_CGAL ${CG target_link_libraries(cgalcachetest tests-cgal ${TESTS-CGAL-LIBRARIES} ${GLEW_LIBRARY} ${COCOA_LIBRARY}) # -# 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}) - -# # GUI binary tests # if(APPLE) @@ -866,7 +858,6 @@ add_cmdline_test(csgtermtest EXE ${GUI_BINPATH} ARGS -o SUFFIX term FILES 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 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/regression/cgalpngtest/resize-tests-expected.png b/tests/regression/cgalpngtest/resize-tests-expected.png Binary files differindex 996a7a6..6a5bb32 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 29e7f50..98fef74 100644 --- a/tests/regression/dumptest/resize-tests-expected.csg +++ b/tests/regression/dumptest/resize-tests-expected.csg @@ -230,39 +230,39 @@ group() { } } color([1, 0.752941, 0.796078, 1]) { - multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [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 = [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, 0], [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, 20], [0, 1, 0, 0], [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 = [-5,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [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, 40], [0, 1, 0, 0], [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,0,0], auto = [0,0,0]) { cube(size = [1, 1, 1], center = false); } } - multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [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.5,0,7], auto = [0,0,0]) { cube(size = [0.5, 1, 1000], center = false); } } - multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 70], [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); } diff --git a/tests/regression/opencsgtest/resize-tests-expected.png b/tests/regression/opencsgtest/resize-tests-expected.png Binary files differindex 66f3d43..669835d 100644 --- a/tests/regression/opencsgtest/resize-tests-expected.png +++ b/tests/regression/opencsgtest/resize-tests-expected.png diff --git a/tests/regression/throwntogethertest/resize-tests-expected.png b/tests/regression/throwntogethertest/resize-tests-expected.png Binary files differindex 66f3d43..669835d 100644 --- a/tests/regression/throwntogethertest/resize-tests-expected.png +++ b/tests/regression/throwntogethertest/resize-tests-expected.png |