Skip to content
Permalink
Browse files

indent

  • Loading branch information
lbartoletti committed Aug 24, 2020
1 parent d327222 commit 5fe0ee7b77fb20cb0a9488af435510e2d74bcf79
Showing with 15 additions and 15 deletions.
  1. +1 −1 src/core/geometry/qgsgeometryutils.cpp
  2. +14 −14 tests/src/core/testqgsgeometry.cpp
@@ -1301,7 +1301,7 @@ QPair<QgsWkbTypes::Type, QString> QgsGeometryUtils::wktReadBlock( const QString
QString wktParsed = wkt;
QString contents;
if ( wktParsed.count( '(' ) != wktParsed.count( ')' ) ) // if unbalanced parenthesis will returns false
contents = QStringLiteral("NULL");
contents = QStringLiteral( "NULL" );
else if ( wkt.contains( QString( "EMPTY" ), Qt::CaseInsensitive ) )
{
QRegularExpression wktRegEx( QStringLiteral( "^\\s*(\\w+)\\s+(\\w+)\\s*$" ) );
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) )) "));
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 5fe0ee7

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