changed Tile to RenderTile
This commit is contained in:
@@ -502,7 +502,7 @@ class TileSet(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Computes the path in the quadtree from the col,row coordinates
|
# Computes the path in the quadtree from the col,row coordinates
|
||||||
tile = Tile.compute_path(c, r, depth)
|
tile = RenderTile.compute_path(c, r, depth)
|
||||||
|
|
||||||
if rendercheck == 2:
|
if rendercheck == 2:
|
||||||
# Skip all other checks, mark tiles as dirty unconditionally
|
# Skip all other checks, mark tiles as dirty unconditionally
|
||||||
@@ -783,7 +783,7 @@ class RendertileSet(object):
|
|||||||
c += 1
|
c += 1
|
||||||
return c
|
return c
|
||||||
|
|
||||||
class Tile(object):
|
class RenderTile(object):
|
||||||
"""A simple container class that represents a single render-tile.
|
"""A simple container class that represents a single render-tile.
|
||||||
|
|
||||||
A render-tile is a tile that is rendered, not a tile composed of other
|
A render-tile is a tile that is rendered, not a tile composed of other
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from overviewer_core.util import iterate_base4
|
from overviewer_core.util import iterate_base4
|
||||||
from overviewer_core.tileset import Tile
|
from overviewer_core.tileset import RenderTile
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
((-4,-8), (0,0)),
|
((-4,-8), (0,0)),
|
||||||
@@ -29,33 +29,33 @@ class TileTest(unittest.TestCase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
for path in iterate_base4(7):
|
for path in iterate_base4(7):
|
||||||
t1 = Tile.from_path(path)
|
t1 = RenderTile.from_path(path)
|
||||||
col = t1.col
|
col = t1.col
|
||||||
row = t1.row
|
row = t1.row
|
||||||
depth = len(path)
|
depth = len(path)
|
||||||
|
|
||||||
t2 = Tile.compute_path(col, row, depth)
|
t2 = RenderTile.compute_path(col, row, depth)
|
||||||
self.assertEqual(t1, t2)
|
self.assertEqual(t1, t2)
|
||||||
|
|
||||||
def test_equality(self):
|
def test_equality(self):
|
||||||
t1 = Tile(-6, -20, (0,1,2,3))
|
t1 = RenderTile(-6, -20, (0,1,2,3))
|
||||||
|
|
||||||
self.assertEqual(t1, Tile(-6, -20, (0,1,2,3)))
|
self.assertEqual(t1, RenderTile(-6, -20, (0,1,2,3)))
|
||||||
self.assertNotEqual(t1, Tile(-4, -20, (0,1,2,3)))
|
self.assertNotEqual(t1, RenderTile(-4, -20, (0,1,2,3)))
|
||||||
self.assertNotEqual(t1, Tile(-6, -24, (0,1,2,3)))
|
self.assertNotEqual(t1, RenderTile(-6, -24, (0,1,2,3)))
|
||||||
self.assertNotEqual(t1, Tile(-6, -20, (0,1,2,0)))
|
self.assertNotEqual(t1, RenderTile(-6, -20, (0,1,2,0)))
|
||||||
|
|
||||||
def test_depth2_from_path(self):
|
def test_depth2_from_path(self):
|
||||||
"""Test frompath on all 16 tiles of a depth 2 tree"""
|
"""Test frompath on all 16 tiles of a depth 2 tree"""
|
||||||
for (col, row), path in items:
|
for (col, row), path in items:
|
||||||
t = Tile.from_path(path)
|
t = RenderTile.from_path(path)
|
||||||
self.assertEqual(t.col, col)
|
self.assertEqual(t.col, col)
|
||||||
self.assertEqual(t.row, row)
|
self.assertEqual(t.row, row)
|
||||||
|
|
||||||
def test_depth2_compute_path(self):
|
def test_depth2_compute_path(self):
|
||||||
"""Test comptue_path on all 16 tiles of a depth 2 tree"""
|
"""Test comptue_path on all 16 tiles of a depth 2 tree"""
|
||||||
for (col, row), path in items:
|
for (col, row), path in items:
|
||||||
t = Tile.compute_path(col, row, 2)
|
t = RenderTile.compute_path(col, row, 2)
|
||||||
self.assertEqual(t.path, path)
|
self.assertEqual(t.path, path)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user