Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Aug 24, 2020
1 parent 653c1e0 commit 57ddc98
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -164,6 +164,8 @@ class TestQgsGeometry : public QObject

void testRandomPointsInPolygon();

void wktParser();

private:
//! Must be called before each render test
void initPainterTest();
Expand Down Expand Up @@ -18097,5 +18099,23 @@ void TestQgsGeometry::testRandomPointsInPolygon()
QVERIFY( foundp2Point );
}

void TestQgsGeometry::wktParser()
{
// unbalanced parenthesis
QVERIFY(! QgsPoint().fromWkt("POINT((0, 1)"));
QVERIFY(! QgsPoint().fromWkt("POINT(0, 1) )"));
QVERIFY(! QgsPoint().fromWkt("POINT ((0, 1)"));
QVERIFY(! QgsPoint().fromWkt("POINT (0, 1) )"));
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))"));
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) )) "));
}
QGSTEST_MAIN( TestQgsGeometry )
#include "testqgsgeometry.moc"

0 comments on commit 57ddc98

Please sign in to comment.