diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-21 22:11:27 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-21 22:11:27 +0200 |
commit | d37d6ef47325f709e3d1b0785bab3bb04697d382 (patch) | |
tree | bd126b659de8ad37f4b765c1b0e83799a1ffe5f6 /testxml/testxml.py | |
parent | 4b884b5679fd66a1eb07f44632a0730b236ddaec (diff) | |
download | evol-tools-d37d6ef47325f709e3d1b0785bab3bb04697d382.tar.gz evol-tools-d37d6ef47325f709e3d1b0785bab3bb04697d382.tar.bz2 evol-tools-d37d6ef47325f709e3d1b0785bab3bb04697d382.tar.xz evol-tools-d37d6ef47325f709e3d1b0785bab3bb04697d382.zip |
Add validation for floor item attribute in items.xml
Diffstat (limited to 'testxml/testxml.py')
-rwxr-xr-x | testxml/testxml.py | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/testxml/testxml.py b/testxml/testxml.py index 8024178..f051cf2 100755 --- a/testxml/testxml.py +++ b/testxml/testxml.py @@ -671,6 +671,17 @@ def testItems(fileName, imgDir): imagecolor = "" try: + floor = node.attributes["floor"].value + floor0 = floor + flr = splitImage(floor) + floor = flr[0] + floorcolor = flr[1] + except: + floor = None + floor0 = None + floorcolor = None + + try: description = node.attributes["description"].value except: description = "" @@ -713,6 +724,9 @@ def testItems(fileName, imgDir): elif len(imagecolor) > 0: testDye(id, imagecolor, "image=" + image0, "items.xml", True) + if floorcolor != None and len(floorcolor) > 0: + testDye(id, floorcolor, "floor=" + floor0, "items.xml", True) + if description == "": print "warn: missing description attribute on id=" + id warnings = warnings + 1 @@ -722,11 +736,15 @@ def testItems(fileName, imgDir): testSounds(id, node, "item") try: - floor = node.getElementsByTagName("floor")[0] + floorSprite = node.getElementsByTagName("floor")[0] except: - floor = None - if floor != None: - testSprites(id, floor, False, err) + floorSprite = None + if floorSprite != None: + if floor != None: + print "error: found attribute floor and tag floor. " + \ + "Should be only one tag or attribute. id=" + id + errors = errors + 1 + testSprites(id, floorSprite, False, err) fullPath = os.path.abspath(parentDir + "/" + imgDir + image) if not os.path.isfile(fullPath) or os.path.exists(fullPath) == False: @@ -735,6 +753,15 @@ def testItems(fileName, imgDir): else: testImageFile(imgDir + image, fullPath, 32, True) + if floor != None: + fullPath = os.path.abspath(parentDir + "/" + imgDir + floor) + if not os.path.isfile(fullPath) or os.path.exists(fullPath) == False: + showFileErrorById (id, imgDir, floor) + error = errors + 1 + else: + testImageFile(imgDir + floor, fullPath, 0, True) + + if type != "usable" and type != "unusable" and type != "generic" \ and type != "equip-necklace" and type != "equip-1hand" \ and type != "equip-2hand" and type != "equip-ammo" \ |