Пример #1
0
    def test_from_block(self):
        arrangement_item = EbTileArrangementItem()
        block = Block()
        block.from_list([3] * 3)

        block.write_multi(0, 0x8000 | 0x2000 | (7 << 10) | 0x120, 2)
        arrangement_item.from_block(block, 0)
        assert_true(arrangement_item.is_vertically_flipped)
        assert_false(arrangement_item.is_horizontally_flipped)
        assert_true(arrangement_item.is_priority, True)
        assert_equal(arrangement_item.subpalette, 7)
        assert_equal(arrangement_item.tile, 0x120)

        block.write_multi(1, 0x4000 | (2 << 10) | 0x3F5, 2)
        arrangement_item.from_block(block, 1)
        assert_false(arrangement_item.is_vertically_flipped)
        assert_true(arrangement_item.is_horizontally_flipped)
        assert_false(arrangement_item.is_priority)
        assert_equal(arrangement_item.subpalette, 2)
        assert_equal(arrangement_item.tile, 0x3F5)
Пример #2
0
    def test_init(self):
        arrangement_item = EbTileArrangementItem(tile=12,
                                                 subpalette=3,
                                                 is_vertically_flipped=False,
                                                 is_horizontally_flipped=True,
                                                 is_priority=True)
        assert_equal(arrangement_item.tile, 12)
        assert_equal(arrangement_item.subpalette, 3)
        assert_false(arrangement_item.is_vertically_flipped, False)
        assert_true(arrangement_item.is_horizontally_flipped, True)
        assert_true(arrangement_item.is_priority, True)

        assert_raises(InvalidArgumentError, EbTileArrangementItem, -1, 0)
        assert_raises(InvalidArgumentError, EbTileArrangementItem, 0, -1)
        assert_raises(InvalidArgumentError, EbTileArrangementItem, -1, -1)
        assert_raises(InvalidArgumentError, EbTileArrangementItem, 0x400, 0)
        assert_raises(InvalidArgumentError, EbTileArrangementItem, 0, 8)
        assert_raises(InvalidArgumentError, EbTileArrangementItem, 0x400, 8)
Пример #3
0
    def test_from_block(self):
        arrangement_item = EbTileArrangementItem()
        block = Block()
        block.from_list([3] * 3)

        block.write_multi(0, 0x8000 | 0x2000 | (7 << 10) | 0x120, 2)
        arrangement_item.from_block(block, 0)
        assert_true(arrangement_item.is_vertically_flipped)
        assert_false(arrangement_item.is_horizontally_flipped)
        assert_true(arrangement_item.is_priority, True)
        assert_equal(arrangement_item.subpalette, 7)
        assert_equal(arrangement_item.tile, 0x120)

        block.write_multi(1, 0x4000 | (2 << 10) | 0x3f5, 2)
        arrangement_item.from_block(block, 1)
        assert_false(arrangement_item.is_vertically_flipped)
        assert_true(arrangement_item.is_horizontally_flipped)
        assert_false(arrangement_item.is_priority)
        assert_equal(arrangement_item.subpalette, 2)
        assert_equal(arrangement_item.tile, 0x3f5)
Пример #4
0
    def test_to_block(self):
        arrangement_item = EbTileArrangementItem()
        block = Block()
        block.from_list([4] * 3)

        arrangement_item.is_vertically_flipped = True
        arrangement_item.is_horizontally_flipped = False
        arrangement_item.is_priority = True
        arrangement_item.subpalette = 7
        arrangement_item.tile = 0x120
        arrangement_item.to_block(block, 0)
        assert_equal(block.read_multi(0, 2),
                     0x8000 | 0x2000 | (7 << 10) | 0x120)

        arrangement_item.is_vertically_flipped = False
        arrangement_item.is_horizontally_flipped = True
        arrangement_item.is_priority = False
        arrangement_item.subpalette = 2
        arrangement_item.tile = 0x3f5
        arrangement_item.to_block(block, 1)
        assert_equal(block.read_multi(1, 2), 0x4000 | (2 << 10) | 0x3f5)
Пример #5
0
    def test_to_block(self):
        arrangement_item = EbTileArrangementItem()
        block = Block()
        block.from_list([4] * 3)

        arrangement_item.is_vertically_flipped = True
        arrangement_item.is_horizontally_flipped = False
        arrangement_item.is_priority = True
        arrangement_item.subpalette = 7
        arrangement_item.tile = 0x120
        arrangement_item.to_block(block, 0)
        assert_equal(block.read_multi(0, 2), 0x8000 | 0x2000 | (7 << 10) | 0x120)

        arrangement_item.is_vertically_flipped = False
        arrangement_item.is_horizontally_flipped = True
        arrangement_item.is_priority = False
        arrangement_item.subpalette = 2
        arrangement_item.tile = 0x3F5
        arrangement_item.to_block(block, 1)
        assert_equal(block.read_multi(1, 2), 0x4000 | (2 << 10) | 0x3F5)