def test_zoomZeroEven(self): topLeft = [256, 512] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 0) self.assertEqual(tileOffset, [1, 2], "tile offset") self.assertEqual(inTileOffsetPx, [0, 0], "px offset")
def test_zoomOneNegativeRound(self): topLeft = [-257, -511] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 1) self.assertEqual(tileOffset, [-3, -4], "tile offset") self.assertEqual(inTileOffsetPx, [254, 2], "px offset")
def test_zoomOneNegativeEven(self): topLeft = [-256, -512] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 1) self.assertEqual(tileOffset, [-2, -4], "tile offset") self.assertEqual(inTileOffsetPx, [0, 0], "px offset")
def test_zoomOneRound(self): topLeft = [257, 520] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 1) self.assertEqual(tileOffset, [2, 4], "tile offset") self.assertEqual(inTileOffsetPx, [2, 16], "px offset")
def test_zoomZeroNegativeRound(self): topLeft = [-257, -511] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 0) self.assertEqual(tileOffset, [-2, -2], "tile offset") self.assertEqual(inTileOffsetPx, [255, 1], "px offset")
def test_zoomZeroRound(self): topLeft = [257, 520] tileOffset, inTileOffsetPx = tileMap.scaleRelativeToGlobal(topLeft, 0) self.assertEqual(tileOffset, [1, 2], "tile offset") self.assertEqual(inTileOffsetPx, [1, 8], "px offset")