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