mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Followup c6f9b07, add unit test
This commit is contained in:
parent
7d97ab50fc
commit
7f3180926d
@ -221,6 +221,12 @@ void TestQgsFeature::geometry()
|
|||||||
QVERIFY( ! copy.constGeometry() );
|
QVERIFY( ! copy.constGeometry() );
|
||||||
QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
||||||
|
|
||||||
|
//test no crash when setting an empty geometry and triggering a detach
|
||||||
|
QgsFeature emptyGeomFeature;
|
||||||
|
emptyGeomFeature.setGeometry( 0 );
|
||||||
|
copy = emptyGeomFeature;
|
||||||
|
copy.setFeatureId( 5 ); //force detach
|
||||||
|
|
||||||
//setGeometry
|
//setGeometry
|
||||||
//always start with a copy so that we can test implicit sharing detachment is working
|
//always start with a copy so that we can test implicit sharing detachment is working
|
||||||
copy = feature;
|
copy = feature;
|
||||||
@ -257,14 +263,14 @@ void TestQgsFeature::geometry()
|
|||||||
QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
||||||
|
|
||||||
//geometryAndOwnership
|
//geometryAndOwnership
|
||||||
Q_NOWARN_DEPRECATED_PUSH
|
Q_NOWARN_DEPRECATED_PUSH
|
||||||
copy = feature;
|
copy = feature;
|
||||||
QCOMPARE( *copy.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
QCOMPARE( *copy.constGeometry()->asWkb(), *mGeometry.data()->asWkb() );
|
||||||
QgsGeometry* geom1 = copy.geometryAndOwnership();
|
QgsGeometry* geom1 = copy.geometryAndOwnership();
|
||||||
QCOMPARE( *geom1->asWkb(), *mGeometry->asWkb() );
|
QCOMPARE( *geom1->asWkb(), *mGeometry->asWkb() );
|
||||||
QgsGeometry* geom2 = feature.geometryAndOwnership();
|
QgsGeometry* geom2 = feature.geometryAndOwnership();
|
||||||
QCOMPARE( *geom2->asWkb(), *mGeometry->asWkb() );
|
QCOMPARE( *geom2->asWkb(), *mGeometry->asWkb() );
|
||||||
Q_NOWARN_DEPRECATED_POP
|
Q_NOWARN_DEPRECATED_POP
|
||||||
delete geom1;
|
delete geom1;
|
||||||
delete geom2;
|
delete geom2;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user