def testAddCategory(self): map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open("a") poigroup = map.getPOIGroup() poilayer = map.getPOILayers()[0] # poilayer.open('a') poigroup.open("a") map.close() map.writeImage("test.imi") map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open("a") poigroup = map.getPOIGroup() poigroup.open("a") cat = POICategory("Aerials") cat.addField("POI Name") subcat = cat.addSubCategory(POISubCategory("NOSUB1000")) expected = deepcopy(poigroup.getCategories()) + [cat] poigroup.addCategory(cat) # cat.addField actual = poigroup.getCategories() if actual != expected: print "actual:", actual print "expected:", expected self.assertEqual(actual, expected) map.close() map = createMap(self.testdatadir) map.open() poigroup = map.getPOIGroup() poigroup.open("r") catman = poigroup.getCategoryManager() print catman.getCategories() self.assertTrue("Aerials" in [cat.getName() for cat in catman.getCategories()]) actual = poigroup.getCategories() if actual != expected: print "actual:", actual print "expected:", expected # expected.sort(lambda x,y: cmp(x.name.upper(), y.name.upper())) self.assertEqual(actual, expected)
def testSimple(self): map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open('a') map.addPOIGroupAndLayer() poigroup = map.getPOIGroup() cat = POICategory("Aerials") cat.addField("POI Name") subcat = cat.addSubCategory(POISubCategory("NOSUB1000")) expected = [cat] poigroup.addCategory(cat) # cat.addField actual = poigroup.getCategories() if actual != expected: print 'actual:', actual print 'expected:', expected self.assertEqual(actual, expected) # Close map and try it to open it again map.close() map = Map() map = createMap(self.testdatadir) map.open() poigroup = map.getPOIGroup() poigroup.open('r') catman = poigroup.getCategoryManager() print catman.getCategories() self.assertTrue( "Aerials" in [cat.getName() for cat in catman.getCategories()]) actual = poigroup.getCategories() if actual != expected: print 'actual:', actual print 'expected:', expected self.assertEqual(actual, expected, "categories were not read back correctly")
def testSimple(self): map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open("a") map.addPOIGroupAndLayer() poigroup = map.getPOIGroup() cat = POICategory("Aerials") cat.addField("POI Name") subcat = cat.addSubCategory(POISubCategory("NOSUB1000")) expected = [cat] poigroup.addCategory(cat) # cat.addField actual = poigroup.getCategories() if actual != expected: print "actual:", actual print "expected:", expected self.assertEqual(actual, expected) # Close map and try it to open it again map.close() map = Map() map = createMap(self.testdatadir) map.open() poigroup = map.getPOIGroup() poigroup.open("r") catman = poigroup.getCategoryManager() print catman.getCategories() self.assertTrue("Aerials" in [cat.getName() for cat in catman.getCategories()]) actual = poigroup.getCategories() if actual != expected: print "actual:", actual print "expected:", expected self.assertEqual(actual, expected, "categories were not read back correctly")
def testAddCategory(self): map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open('a') poigroup = map.getPOIGroup() poilayer = map.getPOILayers()[0] # poilayer.open('a') poigroup.open('a') map.close() map.writeImage("test.imi") map = Map(MapDirectory(self.testdatadir), maptype=MapTypeImage) map.open('a') poigroup = map.getPOIGroup() poigroup.open('a') cat = POICategory("Aerials") cat.addField("POI Name") subcat = cat.addSubCategory(POISubCategory("NOSUB1000")) expected = deepcopy(poigroup.getCategories()) + [cat] poigroup.addCategory(cat) # cat.addField actual = poigroup.getCategories() if actual != expected: print 'actual:', actual print 'expected:', expected self.assertEqual(actual, expected) map.close() map = createMap(self.testdatadir) map.open() poigroup = map.getPOIGroup() poigroup.open('r') catman = poigroup.getCategoryManager() print catman.getCategories() self.assertTrue( "Aerials" in [cat.getName() for cat in catman.getCategories()]) actual = poigroup.getCategories() if actual != expected: print 'actual:', actual print 'expected:', expected # expected.sort(lambda x,y: cmp(x.name.upper(), y.name.upper())) self.assertEqual(actual, expected)