diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-14 22:33:33 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-02-16 14:51:49 +0300 |
commit | 3d2d58391ad8e5e0343af461d83fabe9fabd2745 (patch) | |
tree | df160c664fdf4cb72806535b41179e914990b559 /tests/python/CMakeLists.txt | |
parent | 0f23f618f36a7472d1c67b36344ef87a31eb586c (diff) |
Tests: add OpenGL UI drawing tests.
This reuses the Cycles regression test code to also work for OpenGL UI drawing.
We launch Blender with a bunch of .blend files, take a screenshot and compare
it with a reference screenshot, and generate a HMTL report showing the failed
tests and their differences.
For Cycles we keep small reference renders to compare to in svn, but for OpenGL
developers currently have to generate the references manually. How to use:
* WITH_OPENGL_DRAW_TESTS=ON in CMake
* BLENDER_TEST_UPDATE=1 ctest -R opengl_draw
* .. make code changes ..
* ctest -R opengl_draw
* open build_dir/tests/opengl_draw/report.html
Differential Revision: https://developer.blender.org/D3064
Diffstat (limited to 'tests/python/CMakeLists.txt')
-rw-r--r-- | tests/python/CMakeLists.txt | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 662a35558b7..ceed2ca4d09 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -538,7 +538,7 @@ if(WITH_CYCLES) ) endif() endmacro() - if(WITH_OPENGL_TESTS) + if(WITH_OPENGL_RENDER_TESTS) add_cycles_render_test(opengl) endif() add_cycles_render_test(bake) @@ -562,6 +562,52 @@ if(WITH_CYCLES) endif() endif() +if(WITH_OPENGL_DRAW_TESTS) + if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/opengl") + macro(add_opengl_draw_test subject) + if(MSVC) + add_test( + NAME opengl_draw_${subject}_test + COMMAND + "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>" + ${CMAKE_CURRENT_LIST_DIR}/opengl_draw_tests.py + -blender "$<TARGET_FILE:blender>" + -testdir "${TEST_SRC_DIR}/${subject}" + -idiff "${OPENIMAGEIO_IDIFF}" + -outdir "${TEST_OUT_DIR}/opengl_draw" + ) + else() + add_test( + NAME opengl_draw_${subject}_test + COMMAND ${CMAKE_CURRENT_LIST_DIR}/opengl_draw_tests.py + -blender "$<TARGET_FILE:blender>" + -testdir "${TEST_SRC_DIR}/${subject}" + -idiff "${OPENIMAGEIO_IDIFF}" + -outdir "${TEST_OUT_DIR}/opengl_draw" + ) + endif() + endmacro() + + function(add_opengl_draw_tests) + # Use all test folders + file(GLOB children RELATIVE ${TEST_SRC_DIR} ${TEST_SRC_DIR}/*) + foreach(child ${children}) + if(IS_DIRECTORY ${TEST_SRC_DIR}/${child}) + file(GLOB blends ${TEST_SRC_DIR}/${child}/*.blend) + if(blends) + add_opengl_draw_test(${child}) + endif() + endif() + endforeach() + endfunction() + + add_opengl_draw_tests() + else() + MESSAGE(STATUS "Disabling OpenGL tests because tests folder does not exist") + endif() +endif() + + if(WITH_ALEMBIC) find_package_wrapper(Alembic) if(NOT ALEMBIC_FOUND) |