Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHabib Gahbiche <zazizizou>2021-03-26 18:04:09 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-26 18:15:02 +0300
commit252c87b9e87242a85a644da25edc739cf247d322 (patch)
treea1066fb7b4b6a8904695e3ed42374c7e9f5d8070 /tests
parent39ecf90185bddfdd210d4d88af8cabcf6918e808 (diff)
Compositor automated testing
Added support for compositor tests. Compositor tests can be added, executed and viewed in a similar way to cycles and other render engines tests. Running test: `ctest -R compositor` Updating test: `BLENDER_TEST_UPDATE=1 ctest -R compositor` Viewing test results: typically saved under `build_folder/tests/compositor/report.html` Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6334
Diffstat (limited to 'tests')
-rw-r--r--tests/python/CMakeLists.txt27
-rw-r--r--tests/python/compositor_render_tests.py64
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index 969b748e973..92cebb7d274 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -713,6 +713,33 @@ if(WITH_CYCLES OR WITH_OPENGL_RENDER_TESTS)
endif()
endif()
+if(WITH_COMPOSITOR)
+ set(compositor_tests
+ color
+ converter
+ distort
+ filter
+ input
+ matte
+ output
+ vector
+
+ multiple_node_setups
+ )
+
+ foreach(comp_test ${compositor_tests})
+ add_python_test(
+ compositor_${comp_test}_test
+ ${CMAKE_CURRENT_LIST_DIR}/compositor_render_tests.py
+ -blender "${TEST_BLENDER_EXE}"
+ -testdir "${TEST_SRC_DIR}/compositor/${comp_test}"
+ -idiff "${OPENIMAGEIO_IDIFF}"
+ -outdir "${TEST_OUT_DIR}/compositor"
+ )
+ endforeach()
+
+endif()
+
if(WITH_OPENGL_DRAW_TESTS)
if(NOT OPENIMAGEIO_IDIFF)
MESSAGE(STATUS "Disabling OpenGL draw tests because OIIO idiff does not exist")
diff --git a/tests/python/compositor_render_tests.py b/tests/python/compositor_render_tests.py
new file mode 100644
index 00000000000..6a026ae88d2
--- /dev/null
+++ b/tests/python/compositor_render_tests.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+# Apache License, Version 2.0
+
+import argparse
+import os
+import shlex
+import shutil
+import subprocess
+import sys
+
+
+# When run from inside Blender, render and exit.
+try:
+ import bpy
+ inside_blender = True
+except ImportError:
+ inside_blender = False
+
+def get_arguments(filepath, output_filepath):
+ return [
+ "--background",
+ "-noaudio",
+ "--factory-startup",
+ "--enable-autoexec",
+ "--debug-memory",
+ "--debug-exit-on-error",
+ filepath,
+ "-P",
+ os.path.realpath(__file__),
+ "-o", output_filepath,
+ "-F", "PNG",
+ "-f", "1"]
+
+
+def create_argparse():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-blender", nargs="+")
+ parser.add_argument("-testdir", nargs=1)
+ parser.add_argument("-outdir", nargs=1)
+ parser.add_argument("-idiff", nargs=1)
+ return parser
+
+
+def main():
+ parser = create_argparse()
+ args = parser.parse_args()
+
+ blender = args.blender[0]
+ test_dir = args.testdir[0]
+ idiff = args.idiff[0]
+ output_dir = args.outdir[0]
+
+ from modules import render_report
+ report = render_report.Report("Compositor", output_dir, idiff)
+ report.set_pixelated(True)
+ report.set_reference_dir("compositor_renders")
+ ok = report.run(test_dir, blender, get_arguments, batch=True)
+
+ sys.exit(not ok)
+
+
+if not inside_blender and __name__ == "__main__":
+ main()
+