Skip to content

Commit c8ba814

Browse files
committed
Update tests
1 parent 66e9978 commit c8ba814

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/src/geometry_checker/testqgsvectorlayerfeaturepool.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,29 @@ void TestQgsVectorLayerFeaturePool::changeGeometry()
142142
feat.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "Polygon((100 100, 110 100, 110 110, 100 110, 100 100))" ) ) );
143143
vl->updateFeature( feat );
144144

145-
// No features in the AOI
145+
// Still working on the cached data
146146
QgsFeatureIds ids3 = pool.getIntersects( QgsRectangle( 0, 0, 10, 10 ) );
147-
QCOMPARE( ids3.size(), 0 );
147+
QCOMPARE( ids3.size(), 1 );
148+
149+
// Repopulate the cache
150+
QgsFeatureIds ids4 = pool.getFeatures( QgsFeatureRequest().setFilterRect( QgsRectangle( 0, 0, 10, 10 ) ) );
151+
QCOMPARE( ids4.size(), 0 );
152+
153+
// Still working on the cached data
154+
QgsFeatureIds ids5 = pool.getIntersects( QgsRectangle( 0, 0, 10, 10 ) );
155+
QCOMPARE( ids5.size(), 0 );
148156

149157
// Update a feature to be inside the AOI
150158
feat.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "Polygon((0 0, 10 0, 10 10, 0 10, 0 0))" ) ) );
151159
vl->updateFeature( feat );
152160

153-
// One there again
154-
QgsFeatureIds ids4 = pool.getIntersects( QgsRectangle( 0, 0, 10, 10 ) );
155-
QCOMPARE( ids4.size(), 1 );
161+
// Still cached
162+
QgsFeatureIds ids6 = pool.getIntersects( QgsRectangle( 0, 0, 10, 10 ) );
163+
QCOMPARE( ids6.size(), 0 );
164+
165+
// One in there again
166+
QgsFeatureIds ids7 = pool.getFeatures( QgsFeatureRequest().setFilterRect( QgsRectangle( 0, 0, 10, 10 ) ) );
167+
QCOMPARE( ids7.size(), 1 );
156168
}
157169

158170
std::unique_ptr<QgsVectorLayer> TestQgsVectorLayerFeaturePool::createPopulatedLayer()

0 commit comments

Comments
 (0)