Exemple #1
0
 def test_data(self):
     tile = GBTile()
     assert len(tile.data) == 16
     assert tile.data[0] == 0x00
     assert tile.data[1] == 0x00
     tile.put_pixel(0, 0, 3)
     assert tile.data[0] == 0x80
     assert tile.data[1] == 0x80
Exemple #2
0
    def test_to_hex_string(self):
        tile = GBTile()

        assert tile.to_hex_string(
        ) == "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"  # noqa

        tile.put_pixel(0, 0, 3)
        tile.put_pixel(1, 0, 3)

        assert tile.to_hex_string(
        ) == "C0 C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00"  # noqa
Exemple #3
0
    def test_gbtile_equality(self):
        tile1 = GBTile()
        tile2 = GBTile()

        assert tile1 == tile2

        tile1.put_pixel(0, 0, 3)

        assert tile1 != tile2

        tile2.put_pixel(0, 0, 3)

        assert tile1 == tile2
Exemple #4
0
    def test_put_pixel(self):
        tile = GBTile()

        for b in tile.data:
            assert b == 0

        tile.put_pixel(0, 0, 3)

        assert tile.data[0] == 0x80
        assert tile.data[1] == 0x80

        tile.put_pixel(4, 0, 2)

        assert tile.data[0] == 0x80
        assert tile.data[1] == 0x88
Exemple #5
0
 def tile2(self):
     tile = GBTile()
     tile.put_pixel(0, 0, 3)
     return tile