Skip to content

Commit

Permalink
Fix build failure due to dabc3b1
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jun 20, 2016
1 parent f3bbf89 commit ab98858
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions tests/src/core/testqgsmaptopixelgeometrysimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ void TestQgsMapToPixelGeometrySimplifier::testWkbDimensionMismatch()
// NOTE: wkb onwership transferred to QgsGeometry
g12416.fromWkb( wkb, size );
QString wkt = g12416.exportToWkt();
QCOMPARE( wkt, QString( "MultiLineString ((0 0 0, 1 1 0, 2 0 0, 3 1 0, 10 0 -0.000001),(0 0 0, 0 0 0.000001))" ) );
QCOMPARE( wkt, QString( "MultiLineStringZ ((0 0 0, 1 1 0, 2 0 0, 3 1 0, 10 0 -0.000001),(0 0 0, 0 0 0.000001))" ) );

int fl = QgsMapToPixelSimplifier::SimplifyGeometry;
int ret = QgsMapToPixelSimplifier::simplifyGeometry( &g12416, fl, 20.0 );
// NOTE: currently false due to thrown exception, but fixing the
// simplification code might actually give a success
QVERIFY( ! ret );
QVERIFY( ret );
}

QTEST_MAIN( TestQgsMapToPixelGeometrySimplifier )
Expand Down
13 changes: 6 additions & 7 deletions tests/src/python/test_qgsgeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3310,23 +3310,23 @@ def testMisc(self):
multipolygon = QgsMultiPolygonV2()
cp = QgsCurvePolygonV2()
cp.fromWkt("CurvePolygon ((0 0,0 1,1 1,0 0))")
assert not multipolygon.addGeometry( cp )
assert not multipolygon.addGeometry(cp)

# Test that importing an invalid WKB (a MultiPolygon with a CurvePolygon) fails
geom = QgsGeometry.fromWkt('MultiSurface(((0 0,0 1,1 1,0 0)), CurvePolygon ((0 0,0 1,1 1,0 0)))')
wkb = geom.asWkb()
wkb = bytearray(wkb)
if wkb[1] == QgsWKBTypes.MultiSurface:
wkb[1] = QgsWKBTypes.MultiPolygon
elif wkb[1+4] == QgsWKBTypes.MultiSurface:
wkb[1+4] = QgsWKBTypes.MultiPolygon
wkb[1] = QgsWKBTypes.MultiPolygon
elif wkb[1 + 4] == QgsWKBTypes.MultiSurface:
wkb[1 + 4] = QgsWKBTypes.MultiPolygon
else:
self.assertTrue(False)
self.assertTrue(False)
geom = QgsGeometry()
geom.fromWkb(wkb)
self.assertEqual(geom.exportToWkt(), QgsMultiPolygonV2().asWkt())

# Test that fromWkt() on a GeometryCollection works with all possible geometries
# Test that fromWkt() on a GeometryCollection works with all possible geometries
wkt = "GeometryCollection( "
wkt += "Point(0 1)"
wkt += ","
Expand Down Expand Up @@ -3360,6 +3360,5 @@ def testMisc(self):
wkb2 = geom.asWkb()
self.assertEqual(wkb1, wkb2)


if __name__ == '__main__':
unittest.main()

0 comments on commit ab98858

Please sign in to comment.