Skip to content
Permalink
Browse files

Add some provider tests for empty rectangles

  • Loading branch information
nyalldawson committed Apr 6, 2016
1 parent 619b32d commit 5247673cda7bde28b2e6e3179201481fd8b1587f
Showing with 10 additions and 0 deletions.
  1. +10 −0 tests/src/python/providertestbase.py
@@ -282,6 +282,11 @@ def testGetFeaturesFilterRectTests(self):
features = [f['pk'] for f in self.provider.getFeatures(QgsFeatureRequest().setFilterRect(extent))]
assert set(features) == set([2, 4]), 'Got {} instead'.format(features)

# test with an empty rectangle
extent = QgsRectangle()
features = [f['pk'] for f in self.provider.getFeatures(QgsFeatureRequest().setFilterRect(extent))]
assert set(features) == set([1, 2, 3, 4, 5]), 'Got {} instead'.format(features)

def testGetFeaturesPolyFilterRectTests(self):
""" Test fetching features from a polygon layer with filter rect"""
try:
@@ -299,6 +304,11 @@ def testGetFeaturesPolyFilterRectTests(self):
features = [f['pk'] for f in self.poly_provider.getFeatures(QgsFeatureRequest().setFilterRect(extent).setFlags(QgsFeatureRequest.ExactIntersect))]
assert set(features) == set([2, 3]), 'Got {} instead'.format(features)

# test with an empty rectangle
extent = QgsRectangle()
features = [f['pk'] for f in self.provider.getFeatures(QgsFeatureRequest().setFilterRect(extent))]
assert set(features) == set([1, 2, 3, 4, 5]), 'Got {} instead'.format(features)

def testRectAndExpression(self):
extent = QgsRectangle(-70, 67, -60, 80)
result = set([f['pk'] for f in self.provider.getFeatures(

0 comments on commit 5247673

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