Skip to content

Test3dexport#816

Closed
donbright wants to merge 135 commits intomasterfrom
test3dexport
Closed

Test3dexport#816
donbright wants to merge 135 commits intomasterfrom
test3dexport

Conversation

@donbright
Copy link
Member

Test 3d file format export, by exporting 3d format, creating temporary '.scad' file that import()s the generated 3d file, then re-exporting to PNG, and comparing against the cgalpngtest expected file. The set of tests is somewhat small to begin with, but can be grown by editing CMakeLists.txt

The new tests are named for the 3dformat then 'png'. The first two are

       stlpngtests
       offpngtests

Each 3d format must have import() functionality for these tests to work.

In order to output 'monochrome' tests to deal with the fact that 3d formats like STL have no 'back face'/'front face', there was Major refactoring of entire color subsystem, with 'color schemes' inside colormap.cc / colormap.h and centralization of colorization when calling renderers.

This is not quite as clean a design as i would like but i think it is cleaner than it was before. (Less hard-coding of RGB inside .cc code... and easier to move to a custom color-scheme system in the future )

New cmdnline option --colorscheme, New tests to test colorscheme option

New colorscheme for black-background previewing (Starnight) (there are a lot of websites / etc where people use openscad with black-on-white text in the editor, this should help them. some people find black-on-white to be hard for their eyes to see)

New colorscheme to make 'backface' same color as 'front face' (Monochrome)

Export test is a new .py file based on @t-paul 's design of csgtest.

Known Bugs:

Not 100% backwards compatible. For example, Throwntogether doesnt have the magenta on backwards faces... some work needs to be done to fix that.

Starnight scheme hides the 'x y z' letters on the axes.


Major issue

the threshold of 10% in the ImageMagick Compare test is causing all the tests to pass, even though we are comparing an image with Green backfaces to an image with Gold backfaces, even without feeding --monochrome to the openscad binary. So either the Imagemagick is 'too loose', or the colorscheme refactoring was totally unnecessary. I'm a bit confused how this happened.

donbright and others added 30 commits January 30, 2014 17:50
…3dexport

Conflicts:
	tests/regression/export3d_off_test/example001-expected.png
	tests/regression/export3d_off_test/example002-expected.png
	tests/regression/export3d_off_test/example003-expected.png
	tests/regression/export3d_off_test/example004-expected.png
	tests/regression/export3d_off_test/example005-expected.png
	tests/regression/export3d_off_test/example009-expected.png
	tests/regression/export3d_off_test/example010-expected.png
	tests/regression/export3d_off_test/example011-expected.png
	tests/regression/export3d_off_test/example014-expected.png
	tests/regression/export3d_off_test/example016-expected.png
	tests/regression/export3d_off_test/example019-expected.png
	tests/regression/export3d_off_test/example020-expected.png
	tests/regression/export3d_off_test/example023-expected.png
	tests/regression/export3d_off_test/polyhedron-nonplanar-tests-expected.png
	tests/regression/export3d_stl_test/example001-expected.png
	tests/regression/export3d_stl_test/example002-expected.png
	tests/regression/export3d_stl_test/example003-expected.png
	tests/regression/export3d_stl_test/example004-expected.png
	tests/regression/export3d_stl_test/example005-expected.png
	tests/regression/export3d_stl_test/example009-expected.png
	tests/regression/export3d_stl_test/example010-expected.png
	tests/regression/export3d_stl_test/example011-expected.png
	tests/regression/export3d_stl_test/example014-expected.png
	tests/regression/export3d_stl_test/example016-expected.png
	tests/regression/export3d_stl_test/example019-expected.png
	tests/regression/export3d_stl_test/example020-expected.png
	tests/regression/export3d_stl_test/example023-expected.png
	tests/regression/export3d_stl_test/polyhedron-nonplanar-tests-expected.png
Conflicts:
	src/CGAL_renderer.h
	src/MainWindow.h
	src/OGL_helper.h
	src/mainwin.cc
	src/openscad.cc
	tests/test_cmdline_tool.py
	tests/test_pretty_print.py
Conflicts:
	src/CGAL_renderer.h
	src/MainWindow.h
	src/OGL_helper.h
	src/mainwin.cc
	src/openscad.cc
	tests/test_cmdline_tool.py
	tests/test_pretty_print.py
about a programmer whose system was almost messed up by it.
…3dexport

Conflicts:
	src/CGAL_renderer.h
	src/MainWindow.h
	src/OGL_helper.h
	src/openscad.cc
	tests/test_cmdline_tool.py
	tests/test_pretty_print.py
Conflicts:
	src/CGALRenderer.cc
	src/CGALRenderer.h
@donbright
Copy link
Member Author

uhmmm ok...

i notice there are no csgpng tests for the text/font stuff?

text.cc toString() doesn't output valid .scad code, it dumps single-quoted strings for one.

for example it uses single quotes. OpenSCAD doesn't support single quotes (yet).

@donbright
Copy link
Member Author

uhm... export/import of csgpng for text() is completely broken because text.cc toString() doesnt output valid .csg code (first off, it outputs single quotes instead of double quotes).

this was not caught before probably because the 'standard' test suite did not use --enable=test for the dumptests.

fixing that is a little beyond the scope of this particular branch...

therefore i did not --enable=test for dumptest in this branch.

@t-paul
Copy link
Member

t-paul commented Jul 9, 2014

I'll fix the text() CSG export for master. Catching those cases was actually the reason why I added those tests in the first place as offset() had that problem too.

@kintel
Copy link
Member

kintel commented Jul 17, 2014

@donbright Your commit "undo a few problematic commits" makes this hard to merge with master as it reverts commits in master which has later been amended. Not sure how to proceed as the merging is getting complex - cherrypick commits from this branch back to master perhaps?

kintel added 2 commits July 22, 2014 11:04
This reverts commit 1f6c89b.

Conflicts:
	tests/CMakeLists.txt
Conflicts:
	tests/CMakeLists.txt
	tests/export_import_pngtest.py
	tests/regression/cgalpngtest/text-font-alignment-tests-expected.png
	tests/regression/cgalpngtest/text-font-direction-tests-expected.png
	tests/regression/cgalpngtest/text-font-simple-tests-expected.png
	tests/regression/cgalpngtest/text-font-tests-expected.png
	tests/regression/cgalpngtest/text_on_cube-expected.png
	tests/regression/opencsgtest/text-font-alignment-tests-expected.png
	tests/regression/opencsgtest/text-font-direction-tests-expected.png
	tests/regression/opencsgtest/text-font-simple-tests-expected.png
	tests/regression/opencsgtest/text-font-tests-expected.png
	tests/regression/opencsgtest/text_on_cube-expected.png
	tests/regression/openscad-camortho/camera-tests-expected.png
	tests/regression/throwntogethertest/text-font-alignment-tests-expected.png
	tests/regression/throwntogethertest/text-font-direction-tests-expected.png
	tests/regression/throwntogethertest/text-font-simple-tests-expected.png
	tests/regression/throwntogethertest/text-font-tests-expected.png
@kintel
Copy link
Member

kintel commented Jul 22, 2014

Fixed the above issue by git revert'ing the mentioned commit.

kintel added 9 commits July 22, 2014 11:49
This reverts commit 4a1e19c.

Conflicts:
	src/renderer.cc
Conflicts:
	src/Camera.cc
	src/PlatformUtils.cc
	tests/CMakeLists.txt
	tests/regression/cgalpngtest/arc-expected.png
	tests/regression/cgalpngtest/circle-advanced-expected.png
	tests/regression/cgalpngtest/circle-double-expected.png
	tests/regression/cgalpngtest/circle-expected.png
	tests/regression/cgalpngtest/circle-small-expected.png
	tests/regression/cgalpngtest/circle-tests-expected.png
	tests/regression/cgalpngtest/control-hull-dimension-expected.png
	tests/regression/cgalpngtest/difference-2d-tests-expected.png
	tests/regression/cgalpngtest/ellipse-arc-expected.png
	tests/regression/cgalpngtest/ellipse-arc-rot-expected.png
	tests/regression/cgalpngtest/ellipse-expected.png
	tests/regression/cgalpngtest/ellipse-reverse-expected.png
	tests/regression/cgalpngtest/ellipse-rot-expected.png
	tests/regression/cgalpngtest/flat_body-expected.png
	tests/regression/cgalpngtest/hull2-tests-expected.png
	tests/regression/cgalpngtest/import_dxf-tests-expected.png
	tests/regression/cgalpngtest/intersection2-tests-expected.png
	tests/regression/cgalpngtest/issue585-expected.png
	tests/regression/cgalpngtest/issue612-expected.png
	tests/regression/cgalpngtest/lwpolyline2-expected.png
	tests/regression/cgalpngtest/minkowski2-hole-tests-expected.png
	tests/regression/cgalpngtest/minkowski2-tests-expected.png
	tests/regression/cgalpngtest/multiple-layers-expected.png
	tests/regression/cgalpngtest/null-polygons-expected.png
	tests/regression/cgalpngtest/offset-tests-expected.png
	tests/regression/cgalpngtest/polygon-concave-expected.png
	tests/regression/cgalpngtest/polygon-concave-hole-expected.png
	tests/regression/cgalpngtest/polygon-concave-simple-expected.png
	tests/regression/cgalpngtest/polygon-holes-touch-expected.png
	tests/regression/cgalpngtest/polygon-intersect-expected.png
	tests/regression/cgalpngtest/polygon-many-holes-expected.png
	tests/regression/cgalpngtest/polygon-mesh-expected.png
	tests/regression/cgalpngtest/polygon-overlap-expected.png
	tests/regression/cgalpngtest/polygon-riser-expected.png
	tests/regression/cgalpngtest/polygon-self-intersect-expected.png
	tests/regression/cgalpngtest/polygon-tests-expected.png
	tests/regression/cgalpngtest/polygon8-expected.png
	tests/regression/cgalpngtest/polygons-expected.png
	tests/regression/cgalpngtest/projection-tests-expected.png
	tests/regression/cgalpngtest/render-2d-tests-expected.png
	tests/regression/cgalpngtest/resize-2d-tests-expected.png
	tests/regression/cgalpngtest/rotate_extrude_dxf-tests-expected.png
	tests/regression/cgalpngtest/scale2D-tests-expected.png
	tests/regression/cgalpngtest/square-tests-expected.png
	tests/regression/cgalpngtest/text-search-test-expected.png
	tests/regression/cgalpngtest/transform-insert-expected.png
	tests/regression/cgalpngtest/triangle-with-duplicate-vertex-expected.png
	tests/regression/opencsgtest/arc-expected.png
	tests/regression/opencsgtest/circle-advanced-expected.png
	tests/regression/opencsgtest/circle-double-expected.png
	tests/regression/opencsgtest/circle-expected.png
	tests/regression/opencsgtest/circle-small-expected.png
	tests/regression/opencsgtest/circle-tests-expected.png
	tests/regression/opencsgtest/control-hull-dimension-expected.png
	tests/regression/opencsgtest/difference-2d-tests-expected.png
	tests/regression/opencsgtest/ellipse-arc-expected.png
	tests/regression/opencsgtest/ellipse-arc-rot-expected.png
	tests/regression/opencsgtest/ellipse-expected.png
	tests/regression/opencsgtest/ellipse-reverse-expected.png
	tests/regression/opencsgtest/ellipse-rot-expected.png
	tests/regression/opencsgtest/flat_body-expected.png
	tests/regression/opencsgtest/hull2-tests-expected.png
	tests/regression/opencsgtest/import_dxf-tests-expected.png
	tests/regression/opencsgtest/intersection2-tests-expected.png
	tests/regression/opencsgtest/issue585-expected.png
	tests/regression/opencsgtest/issue612-expected.png
	tests/regression/opencsgtest/lwpolyline2-expected.png
	tests/regression/opencsgtest/minkowski2-hole-tests-expected.png
	tests/regression/opencsgtest/minkowski2-tests-expected.png
	tests/regression/opencsgtest/multiple-layers-expected.png
	tests/regression/opencsgtest/null-polygons-expected.png
	tests/regression/opencsgtest/offset-tests-expected.png
	tests/regression/opencsgtest/polygon-concave-expected.png
	tests/regression/opencsgtest/polygon-concave-hole-expected.png
	tests/regression/opencsgtest/polygon-concave-simple-expected.png
	tests/regression/opencsgtest/polygon-holes-touch-expected.png
	tests/regression/opencsgtest/polygon-intersect-expected.png
	tests/regression/opencsgtest/polygon-many-holes-expected.png
	tests/regression/opencsgtest/polygon-mesh-expected.png
	tests/regression/opencsgtest/polygon-overlap-expected.png
	tests/regression/opencsgtest/polygon-riser-expected.png
	tests/regression/opencsgtest/polygon-self-intersect-expected.png
	tests/regression/opencsgtest/polygon-tests-expected.png
	tests/regression/opencsgtest/polygon8-expected.png
	tests/regression/opencsgtest/polygons-expected.png
	tests/regression/opencsgtest/projection-tests-expected.png
	tests/regression/opencsgtest/render-2d-tests-expected.png
	tests/regression/opencsgtest/resize-2d-tests-expected.png
	tests/regression/opencsgtest/rotate_extrude_dxf-tests-expected.png
	tests/regression/opencsgtest/scale2D-tests-expected.png
	tests/regression/opencsgtest/square-tests-expected.png
	tests/regression/opencsgtest/text-search-test-expected.png
	tests/regression/opencsgtest/transform-insert-expected.png
	tests/regression/opencsgtest/triangle-with-duplicate-vertex-expected.png
	tests/regression/throwntogethertest/arc-expected.png
	tests/regression/throwntogethertest/circle-advanced-expected.png
	tests/regression/throwntogethertest/circle-double-expected.png
	tests/regression/throwntogethertest/circle-expected.png
	tests/regression/throwntogethertest/circle-small-expected.png
	tests/regression/throwntogethertest/circle-tests-expected.png
	tests/regression/throwntogethertest/control-hull-dimension-expected.png
	tests/regression/throwntogethertest/difference-2d-tests-expected.png
	tests/regression/throwntogethertest/ellipse-arc-expected.png
	tests/regression/throwntogethertest/ellipse-arc-rot-expected.png
	tests/regression/throwntogethertest/ellipse-expected.png
	tests/regression/throwntogethertest/ellipse-reverse-expected.png
	tests/regression/throwntogethertest/ellipse-rot-expected.png
	tests/regression/throwntogethertest/flat_body-expected.png
	tests/regression/throwntogethertest/hull2-tests-expected.png
	tests/regression/throwntogethertest/import_dxf-tests-expected.png
	tests/regression/throwntogethertest/intersection2-tests-expected.png
	tests/regression/throwntogethertest/lwpolyline2-expected.png
	tests/regression/throwntogethertest/minkowski2-hole-tests-expected.png
	tests/regression/throwntogethertest/minkowski2-tests-expected.png
	tests/regression/throwntogethertest/multiple-layers-expected.png
	tests/regression/throwntogethertest/null-polygons-expected.png
	tests/regression/throwntogethertest/offset-tests-expected.png
	tests/regression/throwntogethertest/polygon-concave-expected.png
	tests/regression/throwntogethertest/polygon-concave-hole-expected.png
	tests/regression/throwntogethertest/polygon-concave-simple-expected.png
	tests/regression/throwntogethertest/polygon-holes-touch-expected.png
	tests/regression/throwntogethertest/polygon-intersect-expected.png
	tests/regression/throwntogethertest/polygon-many-holes-expected.png
	tests/regression/throwntogethertest/polygon-mesh-expected.png
	tests/regression/throwntogethertest/polygon-overlap-expected.png
	tests/regression/throwntogethertest/polygon-riser-expected.png
	tests/regression/throwntogethertest/polygon-self-intersect-expected.png
	tests/regression/throwntogethertest/polygon-tests-expected.png
	tests/regression/throwntogethertest/polygon8-expected.png
	tests/regression/throwntogethertest/polygons-expected.png
	tests/regression/throwntogethertest/projection-tests-expected.png
	tests/regression/throwntogethertest/render-2d-tests-expected.png
	tests/regression/throwntogethertest/resize-2d-tests-expected.png
	tests/regression/throwntogethertest/rotate_extrude_dxf-tests-expected.png
	tests/regression/throwntogethertest/scale2D-tests-expected.png
	tests/regression/throwntogethertest/square-tests-expected.png
	tests/regression/throwntogethertest/text-search-test-expected.png
	tests/regression/throwntogethertest/transform-insert-expected.png
	tests/regression/throwntogethertest/triangle-with-duplicate-vertex-expected.png
Conflicts:
	tests/CMakeLists.txt
	tests/export_import_pngtest.py
	tests/regression/offpngtest/demo_cut-expected.png
	tests/regression/offpngtest/difference-expected.png
	tests/regression/offpngtest/fence-expected.png
	tests/regression/offpngtest/rounded_box-expected.png
	tests/regression/offpngtest/surface-expected.png
	tests/regression/offpngtest/translation-expected.png
	tests/regression/stlpngtest/demo_cut-expected.png
	tests/regression/stlpngtest/difference-expected.png
	tests/regression/stlpngtest/fence-expected.png
	tests/regression/stlpngtest/rounded_box-expected.png
	tests/regression/stlpngtest/surface-expected.png
	tests/regression/stlpngtest/translation-expected.png
	tests/test_pretty_print.py
Conflicts:
	tests/export_import_pngtest.py
	tests/regression/offpngtest/text_on_cube-expected.png
	tests/regression/stlpngtest/text_on_cube-expected.png
kintel added a commit that referenced this pull request Aug 14, 2014
@kintel
Copy link
Member

kintel commented Aug 14, 2014

All of this has been merged to master now

@donbright
Copy link
Member Author

sorry about that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants