Cycles: add animation denoising test, fix operator to work with single frames.
[blender.git] / tests / python / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # Contributor(s): Jacques Beaurain.
18 #
19 # ***** END GPL LICENSE BLOCK *****
20
21 # --env-system-scripts allows to run without the install target.
22
23 # Use '--write-blend=/tmp/test.blend' to view output
24
25 # Some tests are interesting but take too long to run
26 # and don't give deterministic results
27 set(USE_EXPERIMENTAL_TESTS FALSE)
28
29 set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests)
30 set(TEST_DATA_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests_data)
31 set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests)
32
33 # ugh, any better way to do this on testing only?
34 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_OUT_DIR})
35
36 #~      if(NOT IS_DIRECTORY ${TEST_SRC_DIR})
37 #~              message(FATAL_ERROR "CMake test directory not found!")
38 #~      endif()
39
40 # all calls to blender use this
41 if(APPLE)
42         if(${CMAKE_GENERATOR} MATCHES "Xcode")
43                 set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
44         else()
45                 set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
46         endif()
47 else()
48         set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
49 endif()
50
51 # for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no
52 # set(TEST_BLENDER_EXE_BARE ${TEST_BLENDER_EXE})
53 # set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} ${TEST_BLENDER_EXE_PARAMS} )
54
55
56 # ------------------------------------------------------------------------------
57 # GENERAL PYTHON CORRECTNESS TESTS
58 add_test(
59         NAME script_load_keymap
60         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
61         --python ${CMAKE_CURRENT_LIST_DIR}/bl_keymap_completeness.py
62 )
63
64 add_test(
65         NAME script_load_addons
66         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
67         --python ${CMAKE_CURRENT_LIST_DIR}/bl_load_addons.py
68 )
69
70 add_test(
71         NAME script_load_modules
72         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
73         --python ${CMAKE_CURRENT_LIST_DIR}/bl_load_py_modules.py
74 )
75
76 # test running operators doesn't segfault under various conditions
77 if(USE_EXPERIMENTAL_TESTS)
78         add_test(
79                 NAME script_run_operators
80                 COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
81                 --python ${CMAKE_CURRENT_LIST_DIR}/bl_run_operators.py
82         )
83 endif()
84
85 # ------------------------------------------------------------------------------
86 # PY API TESTS
87 add_test(
88         NAME script_pyapi_bpy_path
89         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
90         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_path.py
91 )
92
93 add_test(
94         NAME script_pyapi_bpy_utils_units
95         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
96         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_bpy_utils_units.py
97 )
98
99 add_test(
100         NAME script_pyapi_mathutils
101         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
102         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_mathutils.py
103 )
104
105 add_test(
106         NAME script_pyapi_idprop
107         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
108         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop.py
109 )
110
111 add_test(
112         NAME script_pyapi_idprop_datablock
113         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
114         --python ${CMAKE_CURRENT_LIST_DIR}/bl_pyapi_idprop_datablock.py
115 )
116
117 # ------------------------------------------------------------------------------
118 # MODELING TESTS
119 add_test(
120         NAME bmesh_bevel
121         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
122         ${TEST_SRC_DIR}/modeling/bevel_regression.blend
123         --python-text run_tests
124 )
125
126 add_test(
127         NAME bmesh_boolean
128         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
129         ${TEST_SRC_DIR}/modeling/bool_regression.blend
130         --python-text run_tests
131 )
132
133 add_test(
134         NAME bmesh_split_faces
135         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
136         ${TEST_SRC_DIR}/modeling/split_faces_test.blend
137         --python-text run_tests
138 )
139
140 # ------------------------------------------------------------------------------
141 # MODIFIERS TESTS
142 add_test(
143         NAME object_modifier_array
144         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
145         ${TEST_SRC_DIR}/modifier_stack/array_test.blend
146         --python-text run_tests
147 )
148
149 # ------------------------------------------------------------------------------
150 # IO TESTS
151
152 # OBJ Import tests
153 # disabled until updated & working
154 if(FALSE)
155 add_test(
156         NAME import_obj_cube
157         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
158         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
159         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\)
160         --md5=39cce4bacac2d1b18fc470380279bc15 --md5_method=SCENE
161         --write-blend=${TEST_OUT_DIR}/import_obj_cube.blend
162 )
163
164 add_test(
165         NAME import_obj_nurbs_cyclic
166         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
167         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
168         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\)
169         --md5=ad3c307e5883224a0492378cd32691ab --md5_method=SCENE
170         --write-blend=${TEST_OUT_DIR}/import_obj_nurbs_cyclic.blend
171 )
172
173 add_test(
174         NAME import_obj_makehuman
175         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
176         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
177         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\)
178         --md5=c9f78b185e58358daa4ecaecfa75464e --md5_method=SCENE
179         --write-blend=${TEST_OUT_DIR}/import_obj_makehuman.blend
180 )
181 endif()
182
183 # OBJ Export tests
184 add_test(
185         NAME export_obj_cube
186         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
187         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
188         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
189         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_cube.obj',use_selection=False\)
190         --md5_source=${TEST_OUT_DIR}/export_obj_cube.obj
191         --md5_source=${TEST_OUT_DIR}/export_obj_cube.mtl
192         --md5=e80660437ad9bfe082849641c361a233 --md5_method=FILE
193 )
194
195 add_test(
196         NAME export_obj_nurbs
197         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
198         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
199         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
200         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\)
201         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.obj
202         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.mtl
203         --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
204 )
205
206 # disabled until updated & working
207 if(FALSE)
208 add_test(
209         NAME export_obj_all_objects
210         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
211         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
212         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
213         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\)
214         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.obj
215         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.mtl
216         --md5=04b3ed97cede07a19548fc518ce9f8ca --md5_method=FILE
217 )
218 endif()
219
220
221
222 # PLY Import tests
223 add_test(
224         NAME import_ply_cube
225         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
226         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
227         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/cube_ascii.ply'\)
228         --md5=527134343c27fc0ea73115b85fbfd3ac --md5_method=SCENE
229         --write-blend=${TEST_OUT_DIR}/import_ply_cube.blend
230 )
231
232 add_test(
233         NAME import_ply_bunny
234         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
235         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
236         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/bunny2.ply'\)
237         --md5=6ea5b8533400a17accf928b8fd024eaa --md5_method=SCENE
238         --write-blend=${TEST_OUT_DIR}/import_ply_bunny.blend
239 )
240
241 add_test(
242         NAME import_ply_small_holes
243         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
244         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
245         --run={'FINISHED'}&bpy.ops.import_mesh.ply\(filepath='${TEST_SRC_DIR}/io_tests/ply/many_small_holes.ply'\)
246         --md5=c3093e26ecae5b6d59fbbcf2a0d0b39f --md5_method=SCENE
247         --write-blend=${TEST_OUT_DIR}/import_ply_small_holes.blend
248 )
249
250 # PLY Export
251 # disabled until updated & working
252 if(FALSE)
253 add_test(
254         NAME export_ply_cube_all_data
255         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
256         ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
257         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
258         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_cube_all_data.ply'\)
259         --md5_source=${TEST_OUT_DIR}/export_ply_cube_all_data.ply
260         --md5=6adc3748ceae8298496f99d0e7e76c15 --md5_method=FILE
261 )
262
263 add_test(
264         NAME export_ply_suzanne_all_data
265         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
266         ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
267         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
268         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply'\)
269         --md5_source=${TEST_OUT_DIR}/export_ply_suzanne_all_data.ply
270         --md5=68ba23f02efd6511bfd093f45f703221 --md5_method=FILE
271 )
272 endif()
273
274 add_test(
275         NAME export_ply_vertices # lame, add a better one
276         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
277         ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
278         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
279         --run={'FINISHED'}&bpy.ops.export_mesh.ply\(filepath='${TEST_OUT_DIR}/export_ply_vertices.ply'\)
280         --md5_source=${TEST_OUT_DIR}/export_ply_vertices.ply
281         --md5=37faba0aa2014451b27f951afa92f870 --md5_method=FILE
282 )
283
284
285 # STL Import tests
286 # disabled until updated & working
287 if(FALSE)
288 add_test(
289         NAME import_stl_cube
290         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
291         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
292         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/cube.stl'\)
293         --md5=8ceb5bb7e1cb5f4342fa1669988c66b4 --md5_method=SCENE
294         --write-blend=${TEST_OUT_DIR}/import_stl_cube.blend
295 )
296
297 add_test(
298         NAME import_stl_conrod
299         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
300         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
301         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/conrod.stl'\)
302         --md5=690a4b8eb9002dcd8631c5a575ea7348 --md5_method=SCENE
303         --write-blend=${TEST_OUT_DIR}/import_stl_conrod.blend
304 )
305
306 add_test(
307         NAME import_stl_knot_max_simplified
308         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
309         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
310         --run={'FINISHED'}&bpy.ops.import_mesh.stl\(filepath='${TEST_SRC_DIR}/io_tests/stl/knot_max_simplified.stl'\)
311         --md5=baf82803f45a84ec4ddbad9cef57dd3e --md5_method=SCENE
312         --write-blend=${TEST_OUT_DIR}/import_stl_knot_max_simplified.blend
313 )
314 endif()
315
316 # STL Export
317 # disabled until updated & working
318 if(FALSE)
319 add_test(
320         NAME export_stl_cube_all_data
321         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
322         ${TEST_SRC_DIR}/io_tests/blend_geometry/cube_all_data.blend
323         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
324         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_cube_all_data.stl'\)
325         --md5_source=${TEST_OUT_DIR}/export_stl_cube_all_data.stl
326         --md5=64cb97c0cabb015e1c3f76369835075a --md5_method=FILE
327 )
328
329 add_test(
330         NAME export_stl_suzanne_all_data
331         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
332         ${TEST_SRC_DIR}/io_tests/blend_geometry/suzanne_all_data.blend
333         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
334         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl'\)
335         --md5_source=${TEST_OUT_DIR}/export_stl_suzanne_all_data.stl
336         --md5=e9b23c97c139ad64961c635105bb9192 --md5_method=FILE
337 )
338
339 add_test(
340         NAME export_stl_vertices # lame, add a better one
341         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
342         ${TEST_SRC_DIR}/io_tests/blend_geometry/vertices.blend
343         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
344         --run={'FINISHED'}&bpy.ops.export_mesh.stl\(filepath='${TEST_OUT_DIR}/export_stl_vertices.stl'\)
345         --md5_source=${TEST_OUT_DIR}/export_stl_vertices.stl
346         --md5=3fd3c877e573beeebc782532cc005820 --md5_method=FILE
347 )
348 endif()
349
350
351 # X3D Import
352 # disabled until updated & working
353 if(FALSE)
354 add_test(
355         NAME import_x3d_cube
356         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
357         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
358         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\)
359         --md5=3fae9be004199c145941cd3f9f80ad7b --md5_method=SCENE
360         --write-blend=${TEST_OUT_DIR}/import_x3d_cube.blend
361 )
362
363 add_test(
364         NAME import_x3d_teapot
365         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
366         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
367         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\)
368         --md5=8ee196c71947dce4199d55698501691e --md5_method=SCENE
369         --write-blend=${TEST_OUT_DIR}/import_x3d_teapot.blend
370 )
371
372 add_test(
373         NAME import_x3d_suzanne_material
374         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
375         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
376         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\)
377         --md5=3edea1353257d8b5a5f071942f417be6 --md5_method=SCENE
378         --write-blend=${TEST_OUT_DIR}/import_x3d_suzanne_material.blend
379 )
380
381 # X3D Export
382 add_test(
383         NAME export_x3d_cube
384         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
385         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
386         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
387         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\)
388         --md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d
389         --md5=05312d278fe41da33560fdfb9bdb268f --md5_method=FILE
390 )
391
392 add_test(
393         NAME export_x3d_nurbs
394         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
395         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
396         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
397         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\)
398         --md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d
399         --md5=4286d4a2aa507ef78b22ddcbdcc88481 --md5_method=FILE
400 )
401
402 add_test(
403         NAME export_x3d_all_objects
404         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
405         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
406         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
407         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\)
408         --md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d
409         --md5=f5f9fa4c5619a0eeab66685aafd2f7f0 --md5_method=FILE
410 )
411 endif()
412
413
414
415 # 3DS Import
416 # disabled until updated & working
417 if(FALSE)
418 add_test(
419         NAME import_3ds_cube
420         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
421         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
422         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/cube.3ds'\)
423         --md5=cb5a45c35a343c3f5beca2a918472951 --md5_method=SCENE
424         --write-blend=${TEST_OUT_DIR}/import_3ds_cube.blend
425 )
426
427 add_test(
428         NAME import_3ds_hierarchy_lara
429         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
430         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
431         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_lara.3ds'\)
432         --md5=766c873d9fdb5f190e43796cfbae63b6 --md5_method=SCENE
433         --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_lara.blend
434 )
435
436 add_test(
437         NAME import_3ds_hierarchy_greek_trireme
438         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
439         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
440         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_greek_trireme.3ds'\)
441         --md5=b62ee30101e8999cb91ef4f8a8760056 --md5_method=SCENE
442         --write-blend=${TEST_OUT_DIR}/import_3ds_hierarchy_greek_trireme.blend
443 )
444 endif()
445
446 # 3DS Export
447 # disabled until updated & working
448 if(FALSE)
449 add_test(
450         NAME export_3ds_cube
451         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
452         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
453         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
454         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_cube.3ds',use_selection=False\)
455         --md5_source=${TEST_OUT_DIR}/export_3ds_cube.3ds
456         --md5=a31f5071b6c6dc7445b9099cdc7f63b3 --md5_method=FILE
457 )
458
459 add_test(
460         NAME export_3ds_nurbs
461         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
462         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
463         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
464         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_nurbs.3ds',use_selection=False\)
465         --md5_source=${TEST_OUT_DIR}/export_3ds_nurbs.3ds
466         --md5=5bdd21be3c80d814fbc83cb25edb08c2 --md5_method=FILE
467 )
468
469 add_test(
470         NAME export_3ds_all_objects
471         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
472         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
473         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
474         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\)
475         --md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds
476         --md5=68447761ab0ca38e1e22e7c177ed48a8 --md5_method=FILE
477 )
478 endif()
479
480
481
482 # FBX Export
483 # 'use_metadata=False' for reliable md5's
484 # disabled until updated & working
485 if(FALSE)
486 add_test(
487         NAME export_fbx_cube
488         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
489         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
490         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
491         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
492         --md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx
493         --md5=59a35577462f95f9a0b4e6035226ce9b --md5_method=FILE
494 )
495
496 add_test(
497         NAME export_fbx_nurbs
498         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
499         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
500         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
501         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
502         --md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx
503         --md5=d31875f18f613fa0c3b16e978f87f6f8 --md5_method=FILE
504 )
505
506 add_test(
507         NAME export_fbx_all_objects
508         COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
509         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
510         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
511         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
512         --md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx
513         --md5=b35eb2a9d0e73762ecae2278c25a38ac --md5_method=FILE
514 )
515 endif()
516
517 # Run Python script outside Blender.
518 function(add_python_test testname testscript)
519         if(MSVC)
520                 add_test(
521                         NAME ${testname}
522                         COMMAND
523                                 "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
524                                 ${testscript} ${ARGN}
525                 )
526         else()
527                 add_test(
528                         NAME ${testname}
529                         COMMAND ${testscript} ${ARGN}
530                 )
531         endif()
532 endfunction()
533
534 if(WITH_CYCLES)
535         if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/render/ctests/shader")
536                 macro(add_cycles_render_test subject)
537                         add_python_test(
538                                 cycles_${subject}_test
539                                 ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py
540                                 -blender "$<TARGET_FILE:blender>"
541                                 -testdir "${TEST_SRC_DIR}/render/ctests/${subject}"
542                                 -idiff "${OPENIMAGEIO_IDIFF}"
543                                 -outdir "${TEST_OUT_DIR}/cycles"
544                         )
545                 endmacro()
546                 if(WITH_OPENGL_RENDER_TESTS)
547                         add_cycles_render_test(opengl)
548                 endif()
549                 add_cycles_render_test(bake)
550                 add_cycles_render_test(bsdf)
551                 add_cycles_render_test(denoise)
552                 add_cycles_render_test(denoise_animation)
553                 add_cycles_render_test(displacement)
554                 add_cycles_render_test(hair)
555                 add_cycles_render_test(image_data_types)
556                 add_cycles_render_test(image_mapping)
557                 add_cycles_render_test(image_texture_limit)
558                 add_cycles_render_test(integrator)
559                 add_cycles_render_test(light)
560                 add_cycles_render_test(mesh)
561                 add_cycles_render_test(motion_blur)
562                 add_cycles_render_test(render_layer)
563                 add_cycles_render_test(reports)
564                 add_cycles_render_test(shader)
565                 add_cycles_render_test(shadow_catcher)
566                 add_cycles_render_test(sss)
567                 add_cycles_render_test(volume)
568         else()
569                 MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist")
570         endif()
571 endif()
572
573 if(WITH_OPENGL_DRAW_TESTS)
574         if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/opengl")
575                 # Use all test folders
576                 file(GLOB children RELATIVE ${TEST_SRC_DIR} ${TEST_SRC_DIR}/*)
577                 foreach(child ${children})
578                         if(IS_DIRECTORY ${TEST_SRC_DIR}/${child})
579                                 file(GLOB_RECURSE blends "${TEST_SRC_DIR}/${child}/*.blend")
580                                 if(blends)
581                                         add_python_test(
582                                                 opengl_draw_${child}_test
583                                                 ${CMAKE_CURRENT_LIST_DIR}/opengl_draw_tests.py
584                                                 -blender "$<TARGET_FILE:blender>"
585                                                 -testdir "${TEST_SRC_DIR}/${child}"
586                                                 -idiff "${OPENIMAGEIO_IDIFF}"
587                                                 -outdir "${TEST_OUT_DIR}/opengl_draw"
588                                         )
589                                 endif()
590                         endif()
591                 endforeach()
592         else()
593                 MESSAGE(STATUS "Disabling OpenGL tests because tests folder does not exist")
594         endif()
595 endif()
596
597
598 if(WITH_ALEMBIC)
599         find_package_wrapper(Alembic)
600         if(NOT ALEMBIC_FOUND)
601                 message(FATAL_ERROR "Alembic is enabled but cannot be found")
602         endif()
603         get_filename_component(real_include_dir ${ALEMBIC_INCLUDE_DIR} REALPATH)
604         get_filename_component(ALEMBIC_ROOT_DIR ${real_include_dir} DIRECTORY)
605
606         add_python_test(
607                 alembic_tests
608                 ${CMAKE_CURRENT_LIST_DIR}/alembic_tests.py
609                 --blender "$<TARGET_FILE:blender>"
610                 --testdir "${TEST_SRC_DIR}/alembic"
611                 --alembic-root "${ALEMBIC_ROOT_DIR}"
612         )
613
614         add_test(
615                 NAME script_alembic_import
616                 COMMAND "$<TARGET_FILE:blender>" ${TEST_BLENDER_EXE_PARAMS}
617                 --python ${CMAKE_CURRENT_LIST_DIR}/bl_alembic_import_test.py
618                 --
619                 --testdir "${TEST_SRC_DIR}/alembic"
620                 --with-legacy-depsgraph=${WITH_LEGACY_DEPSGRAPH}
621         )
622 endif()
623
624 if(WITH_CODEC_FFMPEG)
625         add_python_test(
626                 ffmpeg_tests
627                 ${CMAKE_CURRENT_LIST_DIR}/ffmpeg_tests.py
628                 --blender "$<TARGET_FILE:blender>"
629                 --testdir "${TEST_DATA_SRC_DIR}/ffmpeg"
630         )
631 endif()
632
633 add_subdirectory(collada)