1
1
import unittest
2
2
3
- from qgis .core import (QgsGeometry , QGis )
3
+ from qgis .core import (QgsGeometry ,
4
+ QgsPoint ,
5
+ QGis )
4
6
5
7
# Convenience instances in case you may need them
6
8
# not used in this test
@@ -13,8 +15,20 @@ def testWktPointLoading(self):
13
15
myWKT = 'POINT(10 10)'
14
16
myGeometry = QgsGeometry .fromWkt (myWKT )
15
17
myMessage = ('Expected:\n %s\n Got:\n %s\n ' %
16
- (QGis .Point , myGeometry .type ()))
17
- assert myGeometry .type () == QGis .Point , myMessage
18
+ (QGis .WKBPoint , myGeometry .type ()))
19
+ assert myGeometry .wkbType () == QGis .WKBPoint , myMessage
20
+
21
+ def testFromPoint (self ):
22
+ myPoint = QgsGeometry .fromPoint (QgsPoint (10 , 10 ))
23
+ myMessage = ('Expected:\n %s\n Got:\n %s\n ' %
24
+ (QGis .WKBPoint , myPoint .type ()))
25
+ assert myPoint .wkbType () == QGis .WKBPoint , myMessage
26
+
27
+ def testFromLine (self ):
28
+ myLine = QgsGeometry .fromPolyline ([QgsPoint (1 , 1 ), QgsPoint (2 , 2 )])
29
+ myMessage = ('Expected:\n %s\n Got:\n %s\n ' %
30
+ (QGis .WKBLineString , myLine .type ()))
31
+ assert myLine .wkbType () == QGis .WKBLineString , myMessage
18
32
19
33
20
34
if __name__ == '__main__' :
0 commit comments