RendertileSet: Round-robin the four top-level subtrees
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import unittest
|
||||
|
||||
from overviewer_core.tileset import iterate_base4, RendertileSet
|
||||
from overviewer_core.util import roundrobin
|
||||
|
||||
class RendertileSetTest(unittest.TestCase):
|
||||
# If you change this definition, you must also change the hard-coded
|
||||
@@ -196,6 +197,65 @@ class RendertileSetTest(unittest.TestCase):
|
||||
|
||||
self.assertRaises(StopIteration, next, iterator)
|
||||
|
||||
def test_posttraverse_roundrobin(self):
|
||||
"""Test a round-robin post-traversal of the tree's dirty tiles"""
|
||||
# Expect these results in this proper order.
|
||||
expected_lists = [
|
||||
[
|
||||
(0,0,3),
|
||||
(0,0,1),
|
||||
(0,0,2),
|
||||
(0,0,0),
|
||||
(0,0),
|
||||
(0,),
|
||||
],
|
||||
[
|
||||
(1,2,0),
|
||||
(1,2),
|
||||
|
||||
(1,0,3),
|
||||
(1,0),
|
||||
|
||||
(1,1,3),
|
||||
(1,1),
|
||||
(1,),
|
||||
],
|
||||
[
|
||||
(2,1,1),
|
||||
(2,1,0),
|
||||
(2,1,3),
|
||||
(2,1,2),
|
||||
(2,1),
|
||||
|
||||
(2,0,1),
|
||||
(2,0,3),
|
||||
(2,0,0),
|
||||
(2,0,2),
|
||||
(2,0),
|
||||
|
||||
(2,3,1),
|
||||
(2,3,0),
|
||||
(2,3,3),
|
||||
(2,3,2),
|
||||
(2,3),
|
||||
|
||||
(2,2,1),
|
||||
(2,2,0),
|
||||
(2,2,3),
|
||||
(2,2,2),
|
||||
(2,2),
|
||||
(2,),
|
||||
],
|
||||
]
|
||||
expected_list = list(roundrobin(expected_lists)) + [ () ]
|
||||
|
||||
iterator = iter(self.tree.posttraversal(robin=True))
|
||||
from itertools import izip
|
||||
for expected, actual in izip(expected_list, iterator):
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
self.assertRaises(StopIteration, next, iterator)
|
||||
|
||||
def test_count_all(self):
|
||||
"""Tests getting a count of all tiles (render tiles plus upper tiles)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user