Added from wkbPoint and Polyline tests to python geometry tests

This commit is contained in:
Tim Sutton 2012-08-03 16:19:32 +02:00
parent 5ae312cfad
commit 8761bc7730

View File

@ -1,6 +1,8 @@
import unittest
from qgis.core import (QgsGeometry, QGis)
from qgis.core import (QgsGeometry,
QgsPoint,
QGis)
# Convenience instances in case you may need them
# not used in this test
@ -13,8 +15,20 @@ class TestQgsGeometry(unittest.TestCase):
myWKT='POINT(10 10)'
myGeometry = QgsGeometry.fromWkt(myWKT)
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.Point, myGeometry.type()))
assert myGeometry.type() == QGis.Point, myMessage
(QGis.WKBPoint, myGeometry.type()))
assert myGeometry.wkbType() == QGis.WKBPoint, myMessage
def testFromPoint(self):
myPoint = QgsGeometry.fromPoint(QgsPoint(10, 10))
myMessage = ('Expected:\n%s\nGot:\n%s\n' %
(QGis.WKBPoint, myPoint.type()))
assert myPoint.wkbType() == QGis.WKBPoint, 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
if __name__ == '__main__':