Skip to content
Permalink
Browse files
add tests
  • Loading branch information
lbartoletti committed Aug 24, 2020
1 parent 50249b5 commit 80cccfb3003d6634b32ef11e38e487c57cf98f35
Showing with 174 additions and 30 deletions.
  1. +174 −30 tests/src/core/testqgsgeometry.cpp
@@ -18102,89 +18102,135 @@ void TestQgsGeometry::testRandomPointsInPolygon()
void TestQgsGeometry::wktParser()
{
// POINT
// unbalanced parenthesis
// unbalanced parentheses
QVERIFY( QgsPoint().fromWkt( "POINT((0 1)" ) );
QVERIFY( QgsPoint().fromWkt( "POINT(0 1) )" ) );
QVERIFY( QgsPoint().fromWkt( "POINT ((0 1)" ) );
QVERIFY( QgsPoint().fromWkt( "POINT (0 1) )" ) );
// extra parentheses
QVERIFY( QgsPoint().fromWkt( "POINT ( (5 1) )" ) );
// not a number
QVERIFY( ! QgsPoint().fromWkt( "POINT (a, b)" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT (a b)" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT((0, 1)" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT(0, 1) )" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT ((0, 1)" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT (0, 1) )" ) );
// not a number
QVERIFY( ! QgsPoint().fromWkt( "POINT ( (5, 1) )" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT ( (5 1) )" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT (a, b)" ) );
QVERIFY( ! QgsPoint().fromWkt( "POINT (a b)" ) );

// valid
QgsPoint p;
QVERIFY( p.fromWkt( "POINT (5 1)" ) );
QCOMPARE( p.asWkt(), QStringLiteral( "Point (5 1)" ) );
// extra parentheses
QVERIFY( p.fromWkt( "POINT ( (5 1) )" ) );
// unbalanced parentheses
QVERIFY( p.fromWkt( "POINT ( (5 1)" ) );
QCOMPARE( p.asWkt(), QStringLiteral( "Point (5 1)" ) );
QVERIFY( p.fromWkt( "POINT (5 1) )" ) );
QCOMPARE( p.asWkt(), QStringLiteral( "Point (5 1)" ) );

QVERIFY( p.fromWkt( "POINT (5.1234 1.4321)" ) );
QCOMPARE( p.asWkt( 4 ), QStringLiteral( "Point (5.1234 1.4321)" ) );
QVERIFY( p.fromWkt( "POINT (-5.1234 -1.4321)" ) );
QCOMPARE( p.asWkt( 4 ), QStringLiteral( "Point (-5.1234 -1.4321)" ) );
QVERIFY( p.fromWkt( "POINT (-12e4 -1.4e-1)" ) );
QCOMPARE( p.asWkt( 2 ), QStringLiteral( "Point (-120000 -0.14)" ) );

QVERIFY( p.fromWkt( "POINT ( )" ) );
QCOMPARE( p.asWkt(), QStringLiteral( "Point EMPTY" ) );
QVERIFY( ! p.fromWkt( "POINT (a, b)" ) );
QCOMPARE( p.asWkt(), QStringLiteral( "Point EMPTY" ) );
// LINESTRING
QVERIFY( QgsLineString().fromWkt( "LineString(0 1, 1 2) )" ) );
QVERIFY( QgsLineString().fromWkt( "LineString (0 1, 1 2) )" ) );
QVERIFY( QgsLineString().fromWkt( "LineString ( (0 1) )" ) );
QVERIFY( QgsLineString().fromWkt( "LineString ( ( 0 1, 2 3 ) )" ) );
QVERIFY( QgsMultiLineString().fromWkt( "MULTILINESTRING ((((1 2, 2 4, 4 5))" ) );
QVERIFY( QgsMultiLineString().fromWkt( "MULTILINESTRING((((1 2, 2 4, 4 5))" ) );
// not a number
QVERIFY( ! QgsLineString().fromWkt( "LineString(0, 1) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "LineString(0 1, 1 2) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "LineString (0, 1) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "LineString (0 1, 1 2) )" ) );
QVERIFY( ! QgsMultiLineString().fromWkt( "MULTILINESTRING ((((1 2, 2 4, 4 5))" ) );
QVERIFY( ! QgsMultiLineString().fromWkt( "MULTILINESTRING((((1 2, 2 4, 4 5))" ) );
// not a number
QVERIFY( ! QgsLineString().fromWkt( "LineString ( (0 1) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "LineString ( ( 0 1, 2 3 ) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "LineString (a b, 3 4)" ) );
QVERIFY( ! QgsMultiLineString().fromWkt( "MULTILINESTRING ((1 2, 2 a, 4 b))" ) );
// valid
QgsLineString l;
QVERIFY( l.fromWkt( "LINESTRING ( 1 2, 3 4 )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString (1 2, 3 4)" ) );
// unbalanced parentheses
QVERIFY( l.fromWkt( "LINESTRING ( ( 1 2, 3 4 )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString (1 2, 3 4)" ) );
QVERIFY( l.fromWkt( "LINESTRING ( 1 2, 3 4 ) )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString (1 2, 3 4)" ) );
// extra parentheses
QVERIFY( l.fromWkt( "LINESTRING( ( 1 2, 3 4 ) )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString (1 2, 3 4)" ) );
// empty
QVERIFY( l.fromWkt( "LINESTRING ( )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString EMPTY" ) );
QVERIFY( ! l.fromWkt( "LINESTRING ( a b, 2 3 )" ) );
QCOMPARE( l.asWkt(), QStringLiteral( "LineString EMPTY" ) );
QVERIFY( l.fromWkt( "LINESTRING ( 1e4 -2, 3 +4.5 )" ) );
QCOMPARE( l.asWkt( 1 ), QStringLiteral( "LineString (10000 -2, 3 4.5)" ) );
QgsMultiLineString m;
m.fromWkt( "MULTILINESTRING ((1 2, 2 3, 4 5))" ) ;
QVERIFY( m.fromWkt( "MULTILINESTRING ((1 2, 2 3, 4 5))" ) );
QCOMPARE( m.asWkt( 1 ), QStringLiteral( "MultiLineString ((1 2, 2 3, 4 5))" ) );

// TRIANGLE
// unbalanced parenthesis
QVERIFY( ! QgsLineString().fromWkt( "Triangle(0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "Triangle (0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "Triangle( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( ! QgsLineString().fromWkt( "Triangle ( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsTriangle().fromWkt( "Triangle( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsTriangle().fromWkt( "Triangle ( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle(0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle (0 1, 1 2, 3 3) )" ) );
// not a number
QVERIFY( ! QgsLineString().fromWkt( "Triangle ( (0 a, b 2, 3 3 )) " ) );
QVERIFY( ! QgsLineString().fromWkt( "Triangle ( (0 a, b 2, 3 3, 0 a )) " ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle ( (0 a, b 2, 3 3 )) " ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle ( (0 a, b 2, 3 3, 0 a )) " ) );
// incorrect number of points
QVERIFY( ! QgsTriangle().fromWkt( "Triangle (( 0 0, 1 1))" ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle (( 0 0, 1 1, 1 0, 2 3, 4 5))" ) );
QVERIFY( ! QgsTriangle().fromWkt( "Triangle (( 0 1, 2 3, 3 4, 1 0))" ) ); // four points but start and last points are differents
// valid
QgsTriangle t;
QVERIFY( t.fromWkt( "TRIANGLE(( 0 1, 2 3, 3 4))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle ((0 1, 2 3, 3 4))" ) );
QVERIFY( t.fromWkt( "TRIANGLE(( 0 1, 2 3, 3 4, 0 1))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle ((0 1, 2 3, 3 4, 0 1))" ) );
QVERIFY( t.fromWkt( "TRIANGLE((0 1e3, -2 3, +3 4, 0 1))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle ((0 1000, -2 3, 3 4, 0 1))" ) );
QVERIFY( t.fromWkt( "TRIANGLE(( 0 1, 2 3, 3 4, 0 1))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle ((0 1, 2 3, 3 4, 0 1))" ) );
QVERIFY( ! t.fromWkt( "TRIANGLE(( 0 1, 2 3, 3 4, 0 3))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle EMPTY" ) );
QVERIFY( ! t.fromWkt( "TRIANGLE(( 0 1, 2 3, 3 4, 0 3, 4 5))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle EMPTY" ) );
QVERIFY( ! t.fromWkt( "TRIANGLE(( 0 1, 2 3 ))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle EMPTY" ) );
QVERIFY( t.fromWkt( "TRIANGLE((0 1e3, -2 3, +3 4, 0 1e3))" ) );
QCOMPARE( t.asWkt(), QStringLiteral( "Triangle ((0 1000, -2 3, 3 4, 0 1000))" ) );

// POLYGON
// unbalanced parenthesis
QVERIFY( ! QgsLineString().fromWkt( "Polygon(0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "Polygon (0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsLineString().fromWkt( "Polygon( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( ! QgsLineString().fromWkt( "Polygon ( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsPolygon().fromWkt( "Polygon( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsPolygon().fromWkt( "Polygon ( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( ! QgsPolygon().fromWkt( "Polygon(0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsPolygon().fromWkt( "Polygon (0 1, 1 2, 3 3) )" ) );
// not a number
QVERIFY( ! QgsLineString().fromWkt( "Polygon ( (0 a, b 2, 3 3 )) " ) );
QVERIFY( ! QgsLineString().fromWkt( "Polygon ( (0 a, b 2, 3 3, 0 a )) " ) );
QVERIFY( ! QgsPolygon().fromWkt( "Polygon ( (0 a, b 2, 3 3 )) " ) );
QVERIFY( ! QgsPolygon().fromWkt( "Polygon ( (0 a, b 2, 3 3, 0 a )) " ) );
// valid
QgsPolygon poly;
QVERIFY( poly.fromWkt( "Polygon(( 0 1, 2 3, 3 4))" ) );
QCOMPARE( poly.asWkt(), QStringLiteral( "Polygon ((0 1, 2 3, 3 4))" ) ); // TODO: A polygon must be closed
QVERIFY( poly.fromWkt( "Polygon(( 0 1, 2 3, 3 4, 0 1))" ) );
QCOMPARE( poly.asWkt(), QStringLiteral( "Polygon ((0 1, 2 3, 3 4, 0 1))" ) );
QVERIFY( poly.fromWkt( "Polygon((0 1e3, -2 3, +3 4, 0 1))" ) );
QCOMPARE( poly.asWkt(), QStringLiteral( "Polygon ((0 1000, -2 3, 3 4, 0 1))" ) );

// Circular string
// unbalanced parenthesis
QVERIFY( ! QgsCircularString().fromWkt( "CircularString(0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsCircularString().fromWkt( "CircularString (0 1, 1 2, 3 3) )" ) );
QVERIFY( ! QgsCircularString().fromWkt( "CircularString( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( ! QgsCircularString().fromWkt( "CircularString ( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsCircularString().fromWkt( "CircularString(0 1, 1 2, 3 3) )" ) );
QVERIFY( QgsCircularString().fromWkt( "CircularString (0 1, 1 2, 3 3) )" ) );
QVERIFY( QgsCircularString().fromWkt( "CircularString( (0 1, 1 2, 3 3) )) " ) );
QVERIFY( QgsCircularString().fromWkt( "CircularString ( (0 1, 1 2, 3 3) )) " ) );
// not a number
QVERIFY( ! QgsCircularString().fromWkt( "CircularString (0 a, b 2, 3 3) " ) );
QVERIFY( ! QgsCircularString().fromWkt( "CircularString (0 a, b 2, 3 3, 0 a) " ) );
@@ -18194,6 +18240,104 @@ void TestQgsGeometry::wktParser()
QCOMPARE( c.asWkt(), QStringLiteral( "CircularString (0 1, 2 3, 3 4)" ) );
QVERIFY( c.fromWkt( "CircularString(0 1e3, -2 3, +3 4)" ) );
QCOMPARE( c.asWkt(), QStringLiteral( "CircularString (0 1000, -2 3, 3 4)" ) );

// multipoint
QgsMultiPoint mp;
QVERIFY( ! mp.fromWkt( "MULTIPOINT (((10 40), (40 30), (20 20), (30 10))" ) );
QVERIFY( ! mp.fromWkt( "MULTIPOINT (((10 40), (40 30), (xx20 20), (30 10))" ) );
QVERIFY( ! mp.fromWkt( "MULTIPOINT ((10 40, 40 30, 20 20, 30 10)" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))))" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT ( )" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT EMPTY" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))" ) );
QCOMPARE( mp.asWkt(), QStringLiteral( "MultiPoint ((10 40),(40 30),(20 20),(30 10))" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT (10 40, 40 30, 20 20, 30 10)" ) );
QCOMPARE( mp.asWkt(), QStringLiteral( "MultiPoint ((10 40),(40 30),(20 20),(30 10))" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))))" ) );
QCOMPARE( mp.asWkt(), QStringLiteral( "MultiPoint ((10 40),(40 30),(20 20),(30 10))" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT ( )" ) );
QCOMPARE( mp.asWkt(), QStringLiteral( "MultiPoint EMPTY" ) );
QVERIFY( mp.fromWkt( "MULTIPOINT EMPTY" ) );
QCOMPARE( mp.asWkt(), QStringLiteral( "MultiPoint EMPTY" ) );
// compoundcurve
QgsCompoundCurve cc;
QVERIFY( ! cc.fromWkt( "COMPOUNDCURVE((CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QVERIFY( cc.fromWkt( "COMPOUNDCURVE(CIRCULARSTRING( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( cc.asWkt(), QStringLiteral( "CompoundCurve (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( cc.fromWkt( "COMPOUNDCURVE(CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QCOMPARE( cc.asWkt(), QStringLiteral( "CompoundCurve (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( cc.fromWkt( "COMPOUNDCURVE(CIRCULARSTRING( 0 0, 1 1, 2 2), LINESTRING((2 2, 3 3)))" ) );
QCOMPARE( cc.asWkt(), QStringLiteral( "CompoundCurve (CircularString (0 0, 1 1, 2 2),(2 2, 3 3))" ) );
QVERIFY( cc.fromWkt( "COMPOUNDCURVE ( )" ) );
QCOMPARE( cc.asWkt(), QStringLiteral( "CompoundCurve EMPTY" ) );
QVERIFY( cc.fromWkt( "COMPOUNDCURVE EMPTY" ) );
QCOMPARE( cc.asWkt(), QStringLiteral( "CompoundCurve EMPTY" ) );
// geometrycollection
QgsGeometryCollection gc;
QVERIFY( gc.fromWkt( "GeometryCollection((CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection (GeometryCollection (CircularString (0 0, 1 1, 2 2)))" ) );
QVERIFY( gc.fromWkt( "GeometryCollection(CIRCULARSTRING( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( gc.fromWkt( "GeometryCollection(CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( gc.fromWkt( "GeometryCollection(CIRCULARSTRING( 0 0, 1 1, 2 2), LINESTRING((2 2, 3 3)))" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection (CircularString (0 0, 1 1, 2 2),LineString (2 2, 3 3))" ) );
QVERIFY( gc.fromWkt( "GeometryCollection ( )" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection EMPTY" ) );
QVERIFY( gc.fromWkt( "GeometryCollection EMPTY" ) );
QCOMPARE( gc.asWkt(), QStringLiteral( "GeometryCollection EMPTY" ) );
// curvepolygon
QgsCurvePolygon cp;
QVERIFY( ! cp.fromWkt( "CurvePolygon((CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QVERIFY( cp.fromWkt( "CurvePolygon(CIRCULARSTRING( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( cp.asWkt(), QStringLiteral( "CurvePolygon (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( cp.fromWkt( "CurvePolygon(CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QCOMPARE( cp.asWkt(), QStringLiteral( "CurvePolygon (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( cp.fromWkt( "CurvePolygon(CIRCULARSTRING( 0 0, 1 1, 2 2), LINESTRING((2 2, 3 3)))" ) );
QCOMPARE( cp.asWkt(), QStringLiteral( "CurvePolygon (CircularString (0 0, 1 1, 2 2),(2 2, 3 3))" ) );
QVERIFY( cp.fromWkt( "CurvePolygon ( )" ) );
QCOMPARE( cp.asWkt(), QStringLiteral( "CurvePolygon EMPTY" ) );
QVERIFY( cp.fromWkt( "CurvePolygon EMPTY" ) );
QCOMPARE( cp.asWkt(), QStringLiteral( "CurvePolygon EMPTY" ) );
// multicurve
QgsMultiCurve mc;
QVERIFY( ! mc.fromWkt( "MultiCurve((CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QVERIFY( mc.fromWkt( "MultiCurve(CIRCULARSTRING( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( mc.asWkt(), QStringLiteral( "MultiCurve (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( mc.fromWkt( "MultiCurve(CIRCULARSTRING( 0 0, 1 1, 2 2))" ) );
QCOMPARE( mc.asWkt(), QStringLiteral( "MultiCurve (CircularString (0 0, 1 1, 2 2))" ) );
QVERIFY( mc.fromWkt( "MultiCurve(CIRCULARSTRING( 0 0, 1 1, 2 2), LINESTRING((2 2, 3 3)))" ) );
QCOMPARE( mc.asWkt(), QStringLiteral( "MultiCurve (CircularString (0 0, 1 1, 2 2),LineString (2 2, 3 3))" ) );
QVERIFY( mc.fromWkt( "MultiCurve ( )" ) );
QCOMPARE( mc.asWkt(), QStringLiteral( "MultiCurve EMPTY" ) );
QVERIFY( mc.fromWkt( "MultiCurve EMPTY" ) );
QCOMPARE( mc.asWkt(), QStringLiteral( "MultiCurve EMPTY" ) );
// multisurface
QgsMultiSurface ms;
QVERIFY( ! ms.fromWkt( "MultiSurface((Polygon( 0 0, 1 1, 2 2))" ) );
QVERIFY( ms.fromWkt( "MultiSurface(Polygon(( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( ms.asWkt(), QStringLiteral( "MultiSurface (Polygon ((0 0, 1 1, 2 2)))" ) );
QVERIFY( ms.fromWkt( "MultiSurface(Polygon(( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( ms.asWkt(), QStringLiteral( "MultiSurface (Polygon ((0 0, 1 1, 2 2)))" ) );
QVERIFY( ms.fromWkt( "MultiSurface(Polygon(( 0 0, 1 1, 2 2)), Polygon((2 2, 3 3, 3 2)))" ) );
QCOMPARE( ms.asWkt(), QStringLiteral( "MultiSurface (Polygon ((0 0, 1 1, 2 2)),Polygon ((2 2, 3 3, 3 2)))" ) );
QVERIFY( ms.fromWkt( "MultiSurface ( )" ) );
QCOMPARE( ms.asWkt(), QStringLiteral( "MultiSurface EMPTY" ) );
QVERIFY( ms.fromWkt( "MultiSurface EMPTY" ) );
QCOMPARE( ms.asWkt(), QStringLiteral( "MultiSurface EMPTY" ) );
// multipolygon
QgsMultiPolygon mpoly;
QVERIFY( ! mpoly.fromWkt( "MultiPolygon((Polygon( 0 0, 1 1, 2 2))" ) );
QVERIFY( mpoly.fromWkt( "MultiPolygon(Polygon(( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( mpoly.asWkt(), QStringLiteral( "MultiPolygon (((0 0, 1 1, 2 2)))" ) );
QVERIFY( mpoly.fromWkt( "MultiPolygon(Polygon(( 0 0, 1 1, 2 2)))" ) );
QCOMPARE( mpoly.asWkt(), QStringLiteral( "MultiPolygon (((0 0, 1 1, 2 2)))" ) );
QVERIFY( mpoly.fromWkt( "MultiPolygon(Polygon(( 0 0, 1 1, 2 2)), Polygon((2 2, 3 3, 3 2)))" ) );
QCOMPARE( mpoly.asWkt(), QStringLiteral( "MultiPolygon (((0 0, 1 1, 2 2)),((2 2, 3 3, 3 2)))" ) );
QVERIFY( mpoly.fromWkt( "MultiPolygon ( )" ) );
QCOMPARE( mpoly.asWkt(), QStringLiteral( "MultiPolygon EMPTY" ) );
QVERIFY( mpoly.fromWkt( "MultiPolygon EMPTY" ) );
QCOMPARE( mpoly.asWkt(), QStringLiteral( "MultiPolygon EMPTY" ) );
}
QGSTEST_MAIN( TestQgsGeometry )
#include "testqgsgeometry.moc"

0 comments on commit 80cccfb

Please sign in to comment.