[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31298] branches/soc-2010-leifandersen/ tests: 1.
Leif Andersen
leif.a.andersen at gmail.com
Thu Aug 12 19:48:11 CEST 2010
Revision: 31298
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31298
Author: leifandersen
Date: 2010-08-12 19:48:11 +0200 (Thu, 12 Aug 2010)
Log Message:
-----------
1. Added several readme files, although the versions currently in the tree are empty. (Only commiting because they're there at the moment).
2. Cleaned up the tests/data folder, moved the tests/data/data folder to tests/data, and the tests/data/ops folder to their appropriate locations. Although the folder still needs to remain disabled do to a few remaining bugs in the api.
3. Updated tests from framework at the begining of the project (although it's hard to test this, as I can't simply run the script).
Modified Paths:
--------------
branches/soc-2010-leifandersen/tests/hashfile.txt
branches/soc-2010-leifandersen/tests/physics/CMakeLists.txt
Added Paths:
-----------
branches/soc-2010-leifandersen/tests/addon/README.txt
branches/soc-2010-leifandersen/tests/addon/empty.blend
branches/soc-2010-leifandersen/tests/addon/pawns.blend
branches/soc-2010-leifandersen/tests/addon/setup.py
branches/soc-2010-leifandersen/tests/data/CMakeLists.txt
branches/soc-2010-leifandersen/tests/data/lamps.py
branches/soc-2010-leifandersen/tests/data/meshes.py
branches/soc-2010-leifandersen/tests/data/objects.py
branches/soc-2010-leifandersen/tests/data/scenes.py
branches/soc-2010-leifandersen/tests/export_import_testing/README.txt
branches/soc-2010-leifandersen/tests/gameengine/README.txt
branches/soc-2010-leifandersen/tests/manual/README.txt
branches/soc-2010-leifandersen/tests/mesh_modeling/README.txt
branches/soc-2010-leifandersen/tests/physics/README.txt
branches/soc-2010-leifandersen/tests/physics/output/
branches/soc-2010-leifandersen/tests/physics/particle.py
branches/soc-2010-leifandersen/tests/physics/render/
branches/soc-2010-leifandersen/tests/python/README.txt
branches/soc-2010-leifandersen/tests/sequence_editing/README.txt
Removed Paths:
-------------
branches/soc-2010-leifandersen/tests/data/CMakeLists.txt
branches/soc-2010-leifandersen/tests/data/data/
branches/soc-2010-leifandersen/tests/data/ops/
branches/soc-2010-leifandersen/tests/export_import_testing/hashfile.txt
branches/soc-2010-leifandersen/tests/physics/hashfile.txt
branches/soc-2010-leifandersen/tests/python/hashfile.txt
Added: branches/soc-2010-leifandersen/tests/addon/README.txt
===================================================================
Copied: branches/soc-2010-leifandersen/tests/addon/empty.blend (from rev 31295, branches/soc-2010-leifandersen/tests/data/ops/wm/empty.blend)
===================================================================
(Binary files differ)
Copied: branches/soc-2010-leifandersen/tests/addon/pawns.blend (from rev 31295, branches/soc-2010-leifandersen/tests/data/ops/wm/pawns.blend)
===================================================================
(Binary files differ)
Copied: branches/soc-2010-leifandersen/tests/addon/setup.py (from rev 31295, branches/soc-2010-leifandersen/tests/data/ops/wm/setup.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/addon/setup.py (rev 0)
+++ branches/soc-2010-leifandersen/tests/addon/setup.py 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,52 @@
+import bpy
+import unittest
+
+class TestReadHomefile(unittest.TestCase):
+
+ # No setUp required for this test, as we'll be testing the various setUp methods here
+ def setUp(self):
+ pass
+
+ def test_factory_default(self):
+ bpy.ops.wm.read_homefile(factory=True)
+
+ def test_users_default(self):
+ bpy.ops.wm.read_homefile(factory=False)
+
+ def test_no_params(self):
+ bpy.ops.wm.read_homefile()
+
+class TestLoadBlendfile(unittest.TestCase):
+ def setUp(self):
+ pass
+
+ def test_load_empty_file(self):
+ bpy.ops.wm.open_mainfile(filepath="empty.blend")
+
+ def test_load_file_with_data(self):
+ bpy.ops.wm.open_mainfile(filepath="pawns.blend")
+
+class TestSaveBlendfile(unittest.TestCase):
+ def setUp(self):
+ bpy.ops.wm.open_mainfile(filepath="empty.blend")
+
+ def test_save_empty_file(self):
+ bpy.ops.wm.save_mainfile(filepath="empty_out.blend")
+
+ def test_save_file_with_data(self):
+ bpy.ops.wm.open_mainfile(filepath="pawns.blend")
+ bpy.ops.wm.save_as_mainfile(filepath="pawns_out.blend")
+
+ def test_loading_saved_file(self):
+ bpy.ops.open_mainfile(filepath="empty_out.blend")
+
+def suite():
+ return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestReadHomefile),
+unittest.TestLoader().loadTestsFromTestCase(TestLoadBlendfile),
+unittest.TestLoader().loadTestsFromTestCase(TestSaveBlendfile),
+])
+
+if __name__ == "__main__":
+ unittest.TextTestRunner(verbosity=2).run(suite())
+ bpy.ops.wm.exit_blender()
Deleted: branches/soc-2010-leifandersen/tests/data/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/data/CMakeLists.txt 2010-08-12 17:37:36 UTC (rev 31297)
+++ branches/soc-2010-leifandersen/tests/data/CMakeLists.txt 2010-08-12 17:48:11 UTC (rev 31298)
@@ -1,28 +0,0 @@
-# $Id: CMakeLists.txt 28799 2010-05-17 00:10:16Z leifandersen $
-# ***** 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Leif Andersen.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-add_subdirectory(data)
-add_subdirectory(ops)
Copied: branches/soc-2010-leifandersen/tests/data/CMakeLists.txt (from rev 31295, branches/soc-2010-leifandersen/tests/data/data/CMakeLists.txt)
===================================================================
--- branches/soc-2010-leifandersen/tests/data/CMakeLists.txt (rev 0)
+++ branches/soc-2010-leifandersen/tests/data/CMakeLists.txt 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,14 @@
+FILE(GLOB SRC *.py)
+
+STRING(REGEX REPLACE ${Blender_SOURCE_DIR} ";${Blender_BINARY_DIR}" BIN ${SRC})
+
+FOREACH(PATH ${BIN})
+ STRING(REGEX REPLACE "${Blender_BINARY_DIR}/tests/data/data/" "" NAME ${PATH})
+ ADD_TEST(DA_${NAME} ${Blender_BINARY_DIR}/bin/blender
+ -P ${PATH}
+ )
+ SET_TESTS_PROPERTIES(DA_${NAME} PROPERTIES
+ PASS_REGULAR_EXPRESSION "OK"
+ TIMEOUT 10
+ )
+ENDFOREACH(PATH)
Copied: branches/soc-2010-leifandersen/tests/data/lamps.py (from rev 31295, branches/soc-2010-leifandersen/tests/data/data/lamps.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/data/lamps.py (rev 0)
+++ branches/soc-2010-leifandersen/tests/data/lamps.py 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,18 @@
+import bpy
+import tests
+import unittest
+
+class TestLampCreationAndRemoval(unittest.TestCase):
+ def setUp(self):
+ bpy.ops.wm.read_homefile(factory=True)
+
+ def test_lamp_creation(self):
+ pass
+
+def suite():
+ return unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(TestLampCreationAndRemoval)])
+
+if __name__ == "__main__":
+ unittest.TextTestRunner(verbosity=2).run(suite())
+ bpy.ops.wm.exit_blender()
+
Copied: branches/soc-2010-leifandersen/tests/data/meshes.py (from rev 31295, branches/soc-2010-leifandersen/tests/data/data/meshes.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/data/meshes.py (rev 0)
+++ branches/soc-2010-leifandersen/tests/data/meshes.py 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,29 @@
+import unittest
+import random
+
+class TestMeshCreation(unittest.TestCase):
+ def setUp(self):
+ bpy.ops.wm.read_homefile(factory=True)
+
+ def test_mesh_count(self):
+ self.assertEqual(1,len(bpy.data.meshes))
+
+ def test_mesh_creation(self):
+ self.assertEqual(1,len(bpy.data.meshes))
+ bpy.data.meshes.new("Test")
+ self.assertEqual(2,len(bpy.data.meshes))
+
+ def test_mesh_count_setup(self):
+ self.assertEqual(1,len(bpy.data.meshes))
+
+ def test_name(self):
+ self.assertEqual("Test", bpy.data.meshes['Test'].name)
+
+def suite():
+ return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestMeshCreation),
+])
+
+if __name__ == "__main__":
+ unittest.TextTestRunner(verbosity=2).run(suite())
+ bpy.ops.wm.exit_blender()
Copied: branches/soc-2010-leifandersen/tests/data/objects.py (from rev 31295, branches/soc-2010-leifandersen/tests/data/data/objects.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/data/objects.py (rev 0)
+++ branches/soc-2010-leifandersen/tests/data/objects.py 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,71 @@
+import bpy
+import mathutils
+import tests
+import unittest
+import random
+
+class TestObjectProperties(unittest.TestCase):
+ def setUp(self):
+ bpy.ops.wm.read_homefile(factory=True)
+
+ def test_object_matrix(self):
+ object = bpy.data.objects.new("Object", None)
+ bpy.data.scenes[0].objects.link(object)
+ object.scale = (1, 1, 1)
+ object.location = (0, 0, 0)
+ object.rotation_euler = (0, 0, 0)
+ self.assertEquals(mathutils.Matrix((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)), object.matrix)
+ object.scale = (5, 5, 5)
+ bpy.data.scenes[0].update()
+ self.assertEquals(mathutils.Matrix((5,0,0,0),(0,5,0,0),(0,0,5,0),(0,0,0,1)), object.matrix)
+
+
+class TestObjectParent(unittest.TestCase):
+ def setUp(self):
+ bpy.ops.wm.read_homefile(factory=True)
+
+ def test_object_relationship(self):
+ parent = bpy.data.objects.new("Parent", None)
+ child_1 = bpy.data.objects.new("Child-1", None)
+ child_2 = bpy.data.objects.new("Child-2", None)
+ self.assertEquals(child_1.parent, None)
+ self.assertEquals(parent.children, ())
+ child_1.parent = child_2.parent = parent
+ self.assertEquals(child_2.parent, parent)
+ self.assertEquals(parent.children, (child_1, child_2)) #XXX, should we be testing the order?
+ child_2.parent = None
+ self.assertEquals(child_2.parent, None)
+ self.assertEquals(parent.children, (child_1,))
+ child_1.parent = None
+ self.assertEquals(child_1.parent, None)
+ self.assertEquals(parent.children, ())
+
+ def test_object_matrix(self):
+ child_mesh = bpy.data.meshes.new("Child")
+ parent_mesh = bpy.data.meshes.new("Parent")
+ child = bpy.data.objects.new("Child", child_mesh)
+ parent = bpy.data.objects.new("Parent", parent_mesh)
+ bpy.data.scenes[0].objects.link(child)
+ bpy.data.scenes[0].objects.link(parent)
+ child.scale = (3, 3, 3)
+ parent.scale = (.5, .5, .5)
+
+ child.parent = parent
+
+ child.scale = (1, 1, 1)
+ parent.scale = (1, 1, 1)
+ child.location = (5, 5, 5)
+ parent.location = (0, 0, 0)
+ child.rotation_euler = (0, 0, 0)
+ parent.rotation_euler = (0, 0, 0)
+ bpy.data.scenes[0].update()
+ self.assertEquals(mathutils.Matrix((1,0,0,0),(0,1,0,0),(0,0,1,0),(5,5,5,1)), child.matrix)
+
+def suite():
+ return unittest.TestSuite([
+unittest.TestLoader().loadTestsFromTestCase(TestObjectProperties),
+unittest.TestLoader().loadTestsFromTestCase(TestObjectParent)])
+
+if __name__ == "__main__":
+ unittest.TextTestRunner(verbosity=2).run(suite())
+ bpy.ops.wm.exit_blender()
Copied: branches/soc-2010-leifandersen/tests/data/scenes.py (from rev 31295, branches/soc-2010-leifandersen/tests/data/data/scenes.py)
===================================================================
--- branches/soc-2010-leifandersen/tests/data/scenes.py (rev 0)
+++ branches/soc-2010-leifandersen/tests/data/scenes.py 2010-08-12 17:48:11 UTC (rev 31298)
@@ -0,0 +1,196 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list