Skip to content
Permalink
Browse files

Added MultiGeometries tests for test friday

  • Loading branch information
slarosa committed Aug 17, 2012
1 parent b7e6e64 commit d05701fdf4a7a17cb48e5e7cb42460d4a8f573cf
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/src/python/test_qgsgeometry.py
@@ -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()

0 comments on commit d05701f

Please sign in to comment.
You can’t perform that action at this time.