Changeset View
Changeset View
Standalone View
Standalone View
tests/python/demo_file_generator.py
- This file was copied from tests/python/physics_cloth.py.
| Show All 12 Lines | |||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software Foundation, | # along with this program; if not, write to the Free Software Foundation, | ||||
| # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| # | # | ||||
| # ##### END GPL LICENSE BLOCK ##### | # ##### END GPL LICENSE BLOCK ##### | ||||
| # <pep8 compliant> | # <pep8 compliant> | ||||
| import os | |||||
| import sys | |||||
| import bpy | import bpy | ||||
| import sys | |||||
| import os | |||||
| from pathlib import Path | |||||
| sys.path.append(os.path.dirname(os.path.realpath(__file__))) | sys.path.append(os.path.dirname(os.path.realpath(__file__))) | ||||
| from modules.mesh_test import ModifierTest, PhysicsSpec | from modules.object_generator import TestObject, GenerateTestObject | ||||
| def main(): | def main(): | ||||
| test = [ | |||||
| ["testCloth", "expectedCloth", | create_test_object_list = [ | ||||
| [PhysicsSpec('Cloth', 'CLOTH', {'quality': 5}, 35)]], | |||||
| TestObject("myCollection", {'Plane': 'primitive_plane_add'}), | |||||
zazizizou: having duplicates means the given name by the user won't actually match the one created. So the… | |||||
Done Inline Actionsthe user still would have to check the names anyway to get an idea, the create duplicates parameter is optional. With test object and exp object names starting from 0 calra: the user still would have to check the names anyway to get an idea, the create duplicates… | |||||
Not Done Inline ActionsPrefer no abbreviations in interface, so vertex_group_name instead of vg_name zazizizou: Prefer no abbreviations in interface, so `vertex_group_name` instead of `vg_name` | |||||
| TestObject("SurfaceDeform", {'Cube': 'primitive_cube_add'}), | |||||
| ] | ] | ||||
| cloth_test = ModifierTest(test, threshold=1e-3) | |||||
| command = list(sys.argv) | gen_object = GenerateTestObject("C:/Users/Lenovo/Desktop/", "x_file3.blend", create_test_object_list) | ||||
| for i, cmd in enumerate(command): | gen_object.create() | ||||
| if cmd == "--run-all-tests": | |||||
| cloth_test.apply_modifiers = True | |||||
| cloth_test.run_all_tests() | |||||
| break | |||||
| elif cmd == "--run-test": | |||||
| cloth_test.apply_modifiers = False | |||||
| index = int(command[i + 1]) | |||||
| cloth_test.run_test(index) | |||||
| break | |||||
Not Done Inline ActionsGenerated files shouldn't use hard coded path. campbellbarton: Generated files shouldn't use hard coded path. | |||||
Done Inline ActionsDidn't understand, if its a utiltity. User can type their own paths. This is just an example on how to use it. calra: Didn't understand, if its a utiltity. User can type their own paths. This is just an example on… | |||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| main() | main() | ||||
having duplicates means the given name by the user won't actually match the one created. So the user has to check for names manually before writing the tests. Is this desired?