Beispiel #1
0
 def test_gen_image(self):
     sprite = Sprite(self.paths, sprite_path=os.getcwd() + "/tests/")
     sprite.gen_image()
     assert sprite.image.size[0] == 128
     assert sprite.image.size[1] == 64
     assert sprite.image.size[0] == sprite.width
     assert sprite.image.size[1] == sprite.height
     assert sprite.image.mode == "RGBA"
Beispiel #2
0
 def test_gen_image(self):
     sprite = Sprite(self.paths, sprite_path=os.getcwd() + "/tests/")
     sprite.gen_image()
     assert sprite.image.size[0] == 128
     assert sprite.image.size[1] == 64
     assert sprite.image.size[0] == sprite.width
     assert sprite.image.size[1] == sprite.height
     assert sprite.image.mode == "RGBA"
Beispiel #3
0
 def test_write_a_default_image_when_some_path_does_not_exist(self):
     self.paths.append("tests/ERROR.png")
     default_path = os.getcwd() + "/tests/fixtures/default.png"
     sprite = Sprite(self.paths, default_path=default_path)
     sprite.gen_image()
     path = sprite.do_write_image()
     css = sprite.get_css()
     self.assertIn(".sprite.serror", css)
     sprite_img = Image.open(path)
     compare = Image.open(os.getcwd() + "/tests/fixtures/with_default.png")
     #This assert the default image is in the sprite
     self.assertEquals(sprite_img.histogram(), compare.histogram())
Beispiel #4
0
 def test_write_a_default_image_when_some_path_does_not_exist(self):
     self.paths.append("tests/ERROR.png")
     default_path = os.getcwd() + "/tests/fixtures/default.png"
     sprite = Sprite(self.paths, default_path=default_path)
     sprite.gen_image()
     path = sprite.do_write_image()
     css = sprite.get_css()
     self.assertIn(".sprite.serror", css)
     sprite_img = Image.open(path)
     compare = Image.open(os.getcwd() + "/tests/fixtures/with_default.png")
     #This assert the default image is in the sprite
     self.assertEquals(sprite_img.histogram(), compare.histogram())
Beispiel #5
0
 def test_do_write_image(self):
     sprite = Sprite(self.paths, sprite_path=os.getcwd() + "/tests/")
     path = sprite.do_write_image()
     sprite.gen_image()
     self.assertTrue(os.path.exists(path))
Beispiel #6
0
 def test_do_write_image(self):
     sprite = Sprite(self.paths, sprite_path=os.getcwd() + "/tests/")
     path = sprite.do_write_image()
     sprite.gen_image()
     self.assertTrue(os.path.exists(path))