import/export automated testing using CMake's CTest
[blender.git] / source / test / CMakeLists.txt
1 # -*- mode: cmake; indent-tabs-mode: t; -*-
2 # $Id: CMakeLists.txt 34198 2011-01-09 15:12:08Z campbellbarton $
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19 # Contributor(s): Jacques Beaurain.
20 #
21 # ***** END GPL LICENSE BLOCK *****
22
23 # --env-system-scripts allows to run without WITH_INSTALL
24
25 # Use '--write-blend=/tmp/test.blend' to view output
26
27
28 set(TEST_SRC_DIR ${CMAKE_SOURCE_DIR}/../lib/tests)
29 set(TEST_OUT_DIR ${CMAKE_BINARY_DIR}/tests)
30
31 #~ if(NOT IS_DIRECTORY ${TEST_SRC_DIR})
32 #~      message(FATAL_ERROR "CMake test directory not found!")
33 #~ endif()
34
35 # all calls to blender use this
36 set(GENERIC_ARGS --background --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts)
37
38
39 # OBJ Import tests
40 add_test(import_obj_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
41         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
42         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/cube.obj'\)
43         --md5=4d090508b812b5e08168aa2614746bda --md5_method=SCENE
44 )
45
46 add_test(import_obj_nurbs_cyclic ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
47         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
48         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/nurbs_cyclic.obj'\)
49         --md5=9e0da7b65b4c4f818a203d56af2d3a4b --md5_method=SCENE
50         --write-blend=/root/foo99.blend
51 )
52
53 add_test(import_obj_makehuman ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
54         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
55         --run={'FINISHED'}&bpy.ops.import_scene.obj\(filepath='${TEST_SRC_DIR}/io_tests/obj/makehuman.obj'\)
56         --md5=e0829dc078b0789e1d81f1071235bc4f --md5_method=SCENE
57 )
58
59 # OBJ Export tests
60 add_test(export_obj_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
61         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
62         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
63         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_cube.obj',use_selection=False\)
64         --md5_source=${TEST_OUT_DIR}/export_obj_cube.obj
65         --md5_source=${TEST_OUT_DIR}/export_obj_cube.mtl
66         --md5=70bdc394c2726203ad26c085176e3484 --md5_method=FILE
67 )
68
69 add_test(export_obj_nurbs ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
70         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
71         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
72         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_nurbs.obj',use_selection=False,use_nurbs=True\)
73         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.obj
74         --md5_source=${TEST_OUT_DIR}/export_obj_nurbs.mtl
75         --md5=a733ae4fa4a591ea9b0912da3af042de --md5_method=FILE
76 )
77
78 add_test(export_obj_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
79         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
80         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
81         --run={'FINISHED'}&bpy.ops.export_scene.obj\(filepath='${TEST_OUT_DIR}/export_obj_all_objects.obj',use_selection=False,use_nurbs=True\)
82         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.obj
83         --md5_source=${TEST_OUT_DIR}/export_obj_all_objects.mtl
84         --md5=c835899ca8993495af8a13c2f229629b --md5_method=FILE
85 )
86
87 # X3D Import
88 add_test(import_x3d_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
89         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
90         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/color_cube.x3d'\)
91         --md5=c80538e272812c9d765d43df269d8a9b --md5_method=SCENE
92 )
93
94 add_test(import_x3d_teapot ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
95         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
96         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/teapot.x3d'\)
97         --md5=fa19713ff71d4b3893dcbe0ab3a73955 --md5_method=SCENE
98         --write-blend=/root/foo99.blend
99 )
100
101 add_test(import_x3d_suzanne_material ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
102         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
103         --run={'FINISHED'}&bpy.ops.import_scene.x3d\(filepath='${TEST_SRC_DIR}/io_tests/x3d/suzanne_material.x3d'\)
104         --md5=52a59dcf731904ac49953dd82c020ae5 --md5_method=SCENE
105 )
106
107 # X3D Export
108 add_test(export_x3d_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
109         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
110         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
111         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_cube.x3d',use_selection=False\)
112         --md5_source=${TEST_OUT_DIR}/export_x3d_cube.x3d
113         --md5=560ba3762a6604669994f661235ef93c --md5_method=FILE
114 )
115
116 add_test(export_x3d_nurbs ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
117         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
118         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
119         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_nurbs.x3d',use_selection=False\)
120         --md5_source=${TEST_OUT_DIR}/export_x3d_nurbs.x3d
121         --md5=078c0ca5a08f123cd2cdac48afb54853 --md5_method=FILE
122 )
123
124 add_test(export_x3d_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
125         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
126         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
127         --run={'FINISHED'}&bpy.ops.export_scene.x3d\(filepath='${TEST_OUT_DIR}/export_x3d_all_objects.x3d',use_selection=False\)
128         --md5_source=${TEST_OUT_DIR}/export_x3d_all_objects.x3d
129         --md5=b4bddb55efd8e34af673ffb42bf4c372 --md5_method=FILE
130 )
131
132 # 3DS Import
133 add_test(import_3ds_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
134         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
135         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/cube.3ds'\)
136         --md5=cb5a45c35a343c3f5beca2a918472951 --md5_method=SCENE
137 )
138
139 add_test(import_3ds_hierarchy_lara ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
140         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
141         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_lara.3ds'\)
142         --md5=2e9812099b26ad607fdcf4c7be918c71 --md5_method=SCENE
143         --write-blend=/root/foo99.blend
144 )
145
146 add_test(import_3ds_hierarchy_greek_trireme ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
147         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
148         --run={'FINISHED'}&bpy.ops.import_scene.autodesk_3ds\(filepath='${TEST_SRC_DIR}/io_tests/3ds/hierarchy_greek_trireme.3ds'\)
149         --md5=d05b922d7be20356d8409d1f768a3a9a --md5_method=SCENE
150 )
151
152 # 3DS Export
153 add_test(export_3ds_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
154         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
155         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
156         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_cube.3ds',use_selection=False\)
157         --md5_source=${TEST_OUT_DIR}/export_3ds_cube.3ds
158         --md5=0df6cfb130052d01e31ef77d391d4cc0 --md5_method=FILE
159 )
160
161 add_test(export_3ds_nurbs ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
162         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
163         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
164         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_nurbs.3ds',use_selection=False\)
165         --md5_source=${TEST_OUT_DIR}/export_3ds_nurbs.3ds
166         --md5=ba1a6d43346fee3bcadc7e30e3c95935 --md5_method=FILE
167 )
168
169 add_test(export_3ds_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
170         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
171         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
172         --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\)
173         --md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds
174         --md5=1523ca2e31cf7d781c7de1e17bd14520   --md5_method=FILE
175 )
176
177
178 # FBX Export
179 # 'use_metadata=False' for reliable md5's
180 add_test(export_fbx_cube ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
181         ${TEST_SRC_DIR}/io_tests/blend_geometry/all_quads.blend
182         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
183         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
184         --md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx
185         --md5=ce937e605e493958464d62e6de4a2f9f --md5_method=FILE
186 )
187
188 add_test(export_fbx_nurbs ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
189         ${TEST_SRC_DIR}/io_tests/blend_geometry/nurbs.blend
190         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
191         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
192         --md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx
193         --md5=e02f0147afba2a4ce1ae110567ac3531 --md5_method=FILE
194 )
195
196 add_test(export_fbx_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS}
197         ${TEST_SRC_DIR}/io_tests/blend_scene/all_objects.blend
198         --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
199         --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
200         --md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx
201         --md5=c29a3aa600d2e432e4a521cc1e513ba8   --md5_method=FILE
202 )