Skip to content

Commit

Permalink
Added MultiGeometries tests for test friday
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Aug 17, 2012
1 parent b7e6e64 commit d05701f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/src/python/test_qgsgeometry.py
Expand Up @@ -24,18 +24,37 @@ def testFromPoint(self):
(QGis.WKBPoint, myPoint.type()))
assert myPoint.wkbType() == QGis.WKBPoint, myMessage

def testFromMultiPoint(self):
myMultiPoint = QgsGeometry.fromMultiPoint([(QgsPoint(0, 0)),(QgsPoint(1, 1))])
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBMultiPoint, myMultiPoint.type()))
assert myMultiPoint.wkbType() == QGis.WKBMultiPoint, myMessage

def testFromLine(self):
myLine = QgsGeometry.fromPolyline([QgsPoint(1, 1), QgsPoint(2, 2)])
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBLineString, myLine.type()))
assert myLine.wkbType() == QGis.WKBLineString, myMessage

def testFromMultiLine(self):
myMultiPolyline = QgsGeometry.fromMultiPolyline([[QgsPoint(0, 0),QgsPoint(1, 1)],[QgsPoint(0, 1), QgsPoint(2, 1)]])
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBMultiLineString, myMultiPolyline.type()))
assert myMultiPolyline.wkbType() == QGis.WKBMultiLineString, myMessage

def testFromPolygon(self):
myPolygon = QgsGeometry.fromPolygon([[QgsPoint(1, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)]])
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBPolygon, myPolygon.type()))
assert myPolygon.wkbType() == QGis.WKBPolygon, myMessage

def testFromMultiPolygon(self):
myMultiPolygon = QgsGeometry.fromMultiPolygon([[[QgsPoint(1, 1), QgsPoint(2, 2), QgsPoint(1, 2), QgsPoint(1, 1)]],
[[QgsPoint(2, 2), QgsPoint(3, 3), QgsPoint(3, 1), QgsPoint(2, 2)]]])
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBMultiPolygon, myMultiPolygon.type()))
assert myMultiPolygon.wkbType() == QGis.WKBMultiPolygon, myMessage


if __name__ == '__main__':
unittest.main()
Expand Down

0 comments on commit d05701f

Please sign in to comment.