fixed a bug in TileSet. Traversal now works according to tests.
This commit is contained in:
@@ -923,8 +923,9 @@ class TileSet(object):
|
|||||||
raise
|
raise
|
||||||
tile_mtime = 0
|
tile_mtime = 0
|
||||||
|
|
||||||
if tile_mtime > max_child_mtime:
|
if tile_mtime < max_child_mtime:
|
||||||
# Needs rendering
|
# If any child was updated more recently than ourself, then
|
||||||
|
# we need rendering
|
||||||
yield path, None, True
|
yield path, None, True
|
||||||
else:
|
else:
|
||||||
# Nope.
|
# Nope.
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from collections import defaultdict
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import random
|
import random
|
||||||
import pprint
|
|
||||||
|
|
||||||
from overviewer_core import tileset, util
|
from overviewer_core import tileset, util
|
||||||
|
|
||||||
@@ -218,11 +217,9 @@ class TilesetTest(unittest.TestCase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
paths = set(x[0] for x in ts.iterate_work_items(0))
|
paths = set(x[0] for x in ts.iterate_work_items(0))
|
||||||
pprint.pprint(paths)
|
|
||||||
|
|
||||||
# Get what tiles we expect to be returned
|
# Get what tiles we expect to be returned
|
||||||
expected = get_tile_set(chunks)
|
expected = get_tile_set(chunks)
|
||||||
pprint.pprint(set(expected.iterkeys()))
|
|
||||||
|
|
||||||
# Check that all paths returned are in the expected list
|
# Check that all paths returned are in the expected list
|
||||||
for tilepath in paths:
|
for tilepath in paths:
|
||||||
@@ -289,6 +286,7 @@ class TilesetTest(unittest.TestCase):
|
|||||||
# Strategy: set some tiles on disk to mtime 3, and TileSet needs to
|
# Strategy: set some tiles on disk to mtime 3, and TileSet needs to
|
||||||
# find them and update them to mtime 5 as reported by the RegionSet
|
# find them and update them to mtime 5 as reported by the RegionSet
|
||||||
# object.
|
# object.
|
||||||
|
# Chosen at random:
|
||||||
outdated_tiles = [
|
outdated_tiles = [
|
||||||
(0,3,3),
|
(0,3,3),
|
||||||
(1,2,1),
|
(1,2,1),
|
||||||
@@ -318,8 +316,6 @@ class TilesetTest(unittest.TestCase):
|
|||||||
# Now see if it's right
|
# Now see if it's right
|
||||||
paths = set(x[0] for x in ts.iterate_work_items(0))
|
paths = set(x[0] for x in ts.iterate_work_items(0))
|
||||||
expected = set(outdated_tiles) | set(additional)
|
expected = set(outdated_tiles) | set(additional)
|
||||||
pprint.pprint(paths)
|
|
||||||
pprint.pprint(expected)
|
|
||||||
for tilepath in paths:
|
for tilepath in paths:
|
||||||
self.assertTrue(tilepath in expected, "%s was not expected to be returned. Expected %s" % (tilepath, expected))
|
self.assertTrue(tilepath in expected, "%s was not expected to be returned. Expected %s" % (tilepath, expected))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user