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