Skip to content

Commit

Permalink
Use isNull for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 6, 2023
1 parent 3137b21 commit 71ab3a8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/src/core/geometry/testqgsrectangle.cpp
Expand Up @@ -81,7 +81,7 @@ void TestQgsRectangle::isNull()
void TestQgsRectangle::fromWkt()
{
QgsRectangle rect = QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1,0 0))" ) );
QVERIFY( ! rect.isEmpty() );
QVERIFY( ! rect.isNull() );
QCOMPARE( rect.xMinimum(), 0.0 );
QCOMPARE( rect.yMinimum(), 0.0 );
QCOMPARE( rect.xMaximum(), 1.0 );
Expand All @@ -90,7 +90,7 @@ void TestQgsRectangle::fromWkt()
QVERIFY( rect == QgsRectangle::fromWkt( rect.asWktPolygon() ) );

rect = QgsRectangle::fromWkt( QStringLiteral( "POLYGONZ((0 0 2,1 0 2,1 1 2,0 1 2,0 0 2))" ) );
QVERIFY( ! rect.isEmpty() );
QVERIFY( ! rect.isNull() );
QCOMPARE( rect.xMinimum(), 0.0 );
QCOMPARE( rect.yMinimum(), 0.0 );
QCOMPARE( rect.xMaximum(), 1.0 );
Expand All @@ -100,7 +100,7 @@ void TestQgsRectangle::fromWkt()

// this is ok, a single rectangular polygon in a multipolygon object
rect = QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))" ) );
QVERIFY( ! rect.isEmpty() );
QVERIFY( ! rect.isNull() );
QCOMPARE( rect.xMinimum(), 0.0 );
QCOMPARE( rect.yMinimum(), 0.0 );
QCOMPARE( rect.xMaximum(), 1.0 );
Expand All @@ -109,22 +109,22 @@ void TestQgsRectangle::fromWkt()

// this is ok, a single rectangular polygon in a collection
rect = QgsRectangle::fromWkt( QStringLiteral( "GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0))))" ) );
QVERIFY( ! rect.isEmpty() );
QVERIFY( ! rect.isNull() );
QCOMPARE( rect.xMinimum(), 0.0 );
QCOMPARE( rect.yMinimum(), 0.0 );
QCOMPARE( rect.xMaximum(), 1.0 );
QCOMPARE( rect.yMaximum(), 1.0 );
QVERIFY( rect == QgsRectangle::fromWkt( rect.asWktPolygon() ) );

QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "xxx" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "LINESTRING ()" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON()" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "LINESTRING (0 0,1 0,1 1,0 1,0 0)" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON(((0 0,3 0,3 3,0 3,0 0)),((1 1, 1 2, 2 2, 2 1)))" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON(((0 0,3 0,3 3,0 3,0 0), (10 10,13 10,13 13,10 13,10 10)))" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1,0 1))" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1,0 1))" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1))" ) ).isEmpty() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "xxx" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "LINESTRING ()" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON()" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "LINESTRING (0 0,1 0,1 1,0 1,0 0)" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON(((0 0,3 0,3 3,0 3,0 0)),((1 1, 1 2, 2 2, 2 1)))" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "MULTIPOLYGON(((0 0,3 0,3 3,0 3,0 0), (10 10,13 10,13 13,10 13,10 10)))" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1,0 1))" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1,0 1))" ) ).isNull() );
QVERIFY( QgsRectangle::fromWkt( QStringLiteral( "POLYGON((0 0,1 0,1 1,0 1))" ) ).isNull() );
}

void TestQgsRectangle::constructor()
Expand Down

0 comments on commit 71ab3a8

Please sign in to comment.