Commit: ee4742c0b779d011539380d4d6e0538827acc566
Author: calra123
Date: Sun Aug 9 00:58:25 2020 +0530
Branches: soc-2020-testing-frameworks
https://developer.blender.org/rBee4742c0b779d011539380d4d6e0538827acc566
Added test file for Particle Instance and some minor fixes
===================================================================
M tests/python/CMakeLists.txt
M tests/python/modules/test_object_generator.py
A tests/python/physics_particle_instance.py
===================================================================
diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt
index d1fc30a228e..edb1708a2ca 100644
--- a/tests/python/CMakeLists.txt
+++ b/tests/python/CMakeLists.txt
@@ -227,12 +227,19 @@ add_blender_test(
add_blender_test(
particle_system
- ${TEST_SRC_DIR}/modeling/particle_test.blend
+ ${TEST_SRC_DIR}/physics/physics_particle_test.blend
--python ${TEST_PYTHON_DIR}/physics_particle_system.py
--
--run-all-tests
)
+add_blender_test(
+ particle_instance
+ ${TEST_SRC_DIR}/physics/physics_particle_instance.blend
+ --python ${TEST_PYTHON_DIR}/physics_particle_instance.py
+ --
+ --run-all-tests
+)
add_blender_test(
constraints
diff --git a/tests/python/modules/test_object_generator.py
b/tests/python/modules/test_object_generator.py
index 51ec4c26c5a..2d135b9e8f2 100644
--- a/tests/python/modules/test_object_generator.py
+++ b/tests/python/modules/test_object_generator.py
@@ -34,7 +34,8 @@ def vertex_selection(obj, vert_set: set, randomize: bool):
Selecting vertices which will be later assigned to vertex groups
:param: obj: the selected object for vertex group
:param: vert_set: set of indices e.g.{0,2,3)
- :param: randomize: bool: select vertices randomly"""
+ :param: randomize: bool: select vertices randomly
+ """
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
@@ -59,7 +60,8 @@ def create_vertex_group(obj_name, vg_name, vg_vert_set,
randomize):
:param obj_name : blend object: - the object for vertex group
:param vg_name : str - vertex group name
:param vg_vert_set : set - set of vertices assgined to the vertex group
- :param randomize : bool - select random vertices"""
+ :param randomize : bool - select random vertices
+ """
# Validating user input
# -checking for whether the object exists
# -index value is within the right range
@@ -110,7 +112,7 @@ def create_test_objects(collection_name, obj_dict):
:param collection_name: str - name of the collection for test and expected
objects
:param obj_dict: dict (key:value) - dictionary contains test object names
and types, e.g. {'myTestCube':'Cube'}
:param helper: bool - object is a helper object or a test object.
- """
+ """
offset_y = get_last_location() + 5
obj_list = []
diff --git a/tests/python/physics_particle_instance.py
b/tests/python/physics_particle_instance.py
new file mode 100644
index 00000000000..31e5efd33cf
--- /dev/null
+++ b/tests/python/physics_particle_instance.py
@@ -0,0 +1,54 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import os
+import sys
+
+import bpy
+
+sys.path.append(os.path.dirname(os.path.realpath(__file__)))
+from modules.mesh_test import ModifierTest, ModifierSpec
+
+
+def main():
+ test = [
+
+ ["ParticleInstanceSimple", "testParticleInstance",
"expectedParticleInstance",
+ [ModifierSpec('ParticleInstance', 'PARTICLE_INSTANCE', {'object':
bpy.data.objects['Cube']})]],
+
+
+ ]
+ particle_instance_test = ModifierTest(test, threshold=1e-3)
+
+ command = list(sys.argv)
+ for i, cmd in enumerate(command):
+ if cmd == "--run-all-tests":
+ particle_instance_test.apply_modifiers = True
+ particle_instance_test.run_all_tests()
+ break
+ elif cmd == "--run-test":
+ particle_instance_test.apply_modifiers = False
+ name = str(command[i + 1])
+ particle_instance_test.run_test(name)
+ break
+
+
+if __name__ == "__main__":
+ main()
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs