Example #1
0
 def test_260(self):
     from zaloa import Tile
     from zaloa import generate_coordinates_260
     tile = Tile(2, 1, 1)
     all_coords = generate_coordinates_260(tile)
     just_tile_coords = [x.tile for x in all_coords]
     exp_coords = [
         Tile(2, 0, 0), Tile(2, 1, 0), Tile(2, 2, 0),
         Tile(2, 0, 1), Tile(2, 1, 1), Tile(2, 2, 1),
         Tile(2, 0, 2), Tile(2, 1, 2), Tile(2, 2, 2),
     ]
     self.assertEquals(exp_coords, just_tile_coords)
Example #2
0
 def test_edge_260_midright(self):
     from zaloa import Tile
     from zaloa import generate_coordinates_260
     tile = Tile(2, 3, 1)
     all_coords = generate_coordinates_260(tile)
     nw, n, ne, w, c, e, sw, s, se = all_coords
     self.assertEquals(w.tile, Tile(2, 2, 1))
     self.assertEquals(c.tile, Tile(2, 3, 1))
     self.assertEquals(e.tile, Tile(2, 0, 1))
     self.assertEquals(w.image_spec.crop_bounds, (254, 0, 256, 256))
     self.assertIsNone(c.image_spec.crop_bounds)
     self.assertEquals(e.image_spec.crop_bounds, (0, 0, 2, 256))
Example #3
0
 def test_edge_260_botleft(self):
     from zaloa import Tile
     from zaloa import generate_coordinates_260
     tile = Tile(2, 0, 3)
     all_coords = generate_coordinates_260(tile)
     nw, n, ne, w, c, e, sw, s, se = all_coords
     self.assertEquals(sw.tile, Tile(2, 3, 3))
     self.assertEquals(s.tile, Tile(2, 0, 3))
     self.assertEquals(se.tile, Tile(2, 1, 3))
     self.assertEquals(w.tile, Tile(2, 3, 3))
     self.assertEquals(c.tile, Tile(2, 0, 3))
     self.assertEquals(e.tile, Tile(2, 1, 3))
     self.assertEquals(sw.image_spec.crop_bounds, (254, 254, 256, 256))
     self.assertEquals(s.image_spec.crop_bounds, (0, 254, 256, 256))
     self.assertEquals(se.image_spec.crop_bounds, (0, 254, 2, 256))
Example #4
0
 def test_edge_260_topmid(self):
     from zaloa import Tile
     from zaloa import generate_coordinates_260
     tile = Tile(2, 1, 0)
     all_coords = generate_coordinates_260(tile)
     nw, n, ne, w, c, e, sw, s, se = all_coords
     self.assertEquals(nw.tile, Tile(2, 0, 0))
     self.assertEquals(n.tile, Tile(2, 1, 0))
     self.assertEquals(ne.tile, Tile(2, 2, 0))
     self.assertEquals(w.tile, Tile(2, 0, 0))
     self.assertEquals(c.tile, Tile(2, 1, 0))
     self.assertEquals(e.tile, Tile(2, 2, 0))
     self.assertEquals(nw.image_spec.crop_bounds, (254, 0, 256, 2))
     self.assertEquals(n.image_spec.crop_bounds, (0, 0, 256, 2))
     self.assertEquals(ne.image_spec.crop_bounds, (0, 0, 2, 2))