Revision: 30055 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30055 Author: leifandersen Date: 2010-07-06 20:57:56 +0200 (Tue, 06 Jul 2010)
Log Message: ----------- 1. Started using the render diff test for other tests, ie tests/pyunit/ops/physics. The outputted HTML isn't as nice, but it works. 2. Moved the images to match the render test requirments. 3. Disabledd the wm test for the time being, so as to let the test automate finishing. Modified Paths: -------------- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt branches/soc-2010-leifandersen/tests/render/run.py Added Paths: ----------- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/output/ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/render/ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/render/cube_hair.png Removed Paths: ------------- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/cube_hair.png branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle_image.py Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt =================================================================== --- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt 2010-07-06 18:07:10 UTC (rev 30054) +++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt 2010-07-06 18:57:56 UTC (rev 30055) @@ -1,8 +1,11 @@ ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -P ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/particle.py) -ADD_TEST(Ops_Particle_Test_Image_Compare ${CMAKE_COMMAND} -P ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/runtests.cmake +SET_TESTS_PROPERTIES(Ops_Particle_Test + PROPERTIES PASS_REGULAR_EXPRESSION "OK" ) -SET_TESTS_PROPERTIES(Ops_Particle_Test Ops_Particle_Test_Image_Compare - PROPERTIES PASS_REGULAR_EXPRESSION "OK" +ADD_TEST(Ops_Particle_Test_Image_Compare python ${Blender_BINARY_DIR}/tests/render/run.py --blender-bin ${Blender_BINARY_DIR}/bin/blender --image ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/cube_hair.blend --image ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/cube_hair_group.blend --image ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/cube_hair_object.blend) + +SET_TESTS_PROPERTIES(Ops_Particle_Test_Image_Compare + PROPERTIES PASS_REGULAR_EXPRESSION "All tests passed" ) Deleted: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/cube_hair.png =================================================================== (Binary files differ) Deleted: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle_image.py =================================================================== --- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle_image.py 2010-07-06 18:07:10 UTC (rev 30054) +++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle_image.py 2010-07-06 18:57:56 UTC (rev 30055) @@ -1,86 +0,0 @@ -import Image -import unittest - -class TestParticles(unittest.TestCase): - pass - -class TestHair(unittest.TestCase): - def setUp(self): - pass - - - def test_hair_generation(self): - good = Image.open("cube_hair.png") - test = Image.open("cube_hair0001.png") - good_red = good_green = good_blue = test_red = test_green = test_blue = 0 - -# Much faster, should this be used instead? Also, perhaps maping the pixel sums into sections -# might work. Also, this doesn't really keep track of -# good_sum = 0 -# test_sum = 0 -# for i in good.histogram(): -# good_sum+=i -# for i in test.histogram(): -# test_sum+=i - self.assertEquals(good.size, test.size) - for i in range(0, good.size[0]): - for j in range(0, good.size[1]): - good_red+=good.getpixel((i,j))[0] - good_green+=good.getpixel((i,j))[1] - good_blue+=good.getpixel((i,j))[2] - test_red+=test.getpixel((i,j))[0] - test_green+=test.getpixel((i,j))[1] - test_blue+=test.getpixel((i,j))[2] - - self.assertEquals(good_red, test_red) - self.assertEquals(good_green, test_green) - self.assertEquals(good_blue, test_blue) - - - def test_hair_ren_as_object(self): - good = Image.open("cube_hair.png") - test = Image.open("cube_hair_object0001.png") - good_red = good_green = good_blue = test_red = test_green = test_blue = 0 - - self.assertEquals(good.size, test.size) - for i in range(0, good.size[0]): - for j in range(0, good.size[1]): - good_red+=good.getpixel((i,j))[0] - good_green+=good.getpixel((i,j))[1] - good_blue+=good.getpixel((i,j))[2] - test_red+=test.getpixel((i,j))[0] - test_green+=test.getpixel((i,j))[1] - test_blue+=test.getpixel((i,j))[2] - - self.assertEquals(good_red, test_red) - self.assertEquals(good_green, test_green) - self.assertEquals(good_blue, test_blue) - - - def test_hair_ren_as_group(self): - good = Image.open("cube_hair.png") - test = Image.open("cube_hair_group0001.png") - good_red = good_green = good_blue = test_red = test_green = test_blue = 0 - - self.assertEquals(good.size, test.size) - for i in range(0, good.size[0]): - for j in range(0, good.size[1]): - good_red+=good.getpixel((i,j))[0] - good_green+=good.getpixel((i,j))[1] - good_blue+=good.getpixel((i,j))[2] - test_red+=test.getpixel((i,j))[0] - test_green+=test.getpixel((i,j))[1] - test_blue+=test.getpixel((i,j))[2] - - self.assertEquals(good_red, test_red) - self.assertEquals(good_green, test_green) - self.assertEquals(good_blue, test_blue) - -def suite(): - return unittest.TestSuite([ -unittest.TestLoader().loadTestsFromTestCase(TestParticles), -unittest.TestLoader().loadTestsFromTestCase(TestHair), -]) - -if __name__ == "__main__": - unittest.TextTestRunner(verbosity=2).run(suite()) Copied: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/render/cube_hair.png (from rev 29549, branches/soc-2010-leifandersen/tests/pyunit/ops/physics/cube_hair.png) =================================================================== (Binary files differ) Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt =================================================================== --- branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt 2010-07-06 18:07:10 UTC (rev 30054) +++ branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt 2010-07-06 18:57:56 UTC (rev 30055) @@ -1,2 +1,2 @@ -ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -P ${Blender_BINARY_DIR}/tests/pyunit/ops/wm/setup.py) -SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK") +#ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -P ${Blender_BINARY_DIR}/tests/pyunit/ops/wm/setup.py) +#SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK") Modified: branches/soc-2010-leifandersen/tests/render/run.py =================================================================== --- branches/soc-2010-leifandersen/tests/render/run.py 2010-07-06 18:07:10 UTC (rev 30054) +++ branches/soc-2010-leifandersen/tests/render/run.py 2010-07-06 18:57:56 UTC (rev 30055) @@ -15,6 +15,7 @@ VERBOSE = False SAVEOUT = sys.stdout LOG = None +HTML_OUTPUT = sys.path[0] class RenderTestCase: '''A Render Test Case. Steps must be run in order: @@ -151,9 +152,9 @@ else: print "All tests passed" -def generate_output(images): +def generate_output(images, output_file): '''''' - file = open(os.path.join(sys.path[0],"index.html"), "w") + file = open(output_file, "w") file.write('<html><head>\n') file.write('<link rel="stylesheet" href="_static/default.css" type="text/css" />\n') file.write('<link rel="stylesheet" href="_static/pygments.css" type="text/css" />\n') @@ -261,6 +262,7 @@ argv_path = sys.argv[argv_i + 1] (argv_directory, argv_file) = os.path.split(argv_path) cases.append(RenderTestCase('Image', argv_path, os.path.join(argv_directory, 'render', string.replace(argv_file, '.blend', '.png')), os.path.join(argv_directory, 'output', string.replace(argv_file, '.blend', '')))) + HTML_OUTPUT = argv_directory if arg == '-v' or arg == '-V' or arg == '--verbose': VERBOSE = True argv_i += 1 @@ -277,12 +279,12 @@ sys.stdout = LOG test_case.render_image() test_case.setup_test() - test_case.save_diff(os.path.join(sys.path[0], 'output', string.replace(test_case.name, '.blend', '_diff.png'))) + test_case.save_diff(os.path.join(HTML_OUTPUT, 'output', string.replace(test_case.name, '.blend', '_diff.png'))) if not VERBOSE: sys.stdout = SAVEOUT print test_case.passed # Output Result console_output(cases) - generate_output(cases) + generate_output(cases, os.path.join(HTML_OUTPUT, 'index.html')) _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs