Add test coverage for this regression

This commit is contained in:
nirvn 2021-11-05 17:32:59 +07:00 committed by Nyall Dawson
parent 14da7f189e
commit e5a8915bff
2 changed files with 14 additions and 0 deletions

View File

@ -1634,6 +1634,20 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
self.assertEqual(vl.dataProvider().defaultValueClause(0), '')
self.assertEqual(vl.dataProvider().defaultValue(0), 1)
def testViewsExtentFilter(self):
"""Test extent filtering of a views-based spatialite layer"""
vl = QgsVectorLayer("dbname='%s' table=\"vs_controle_ok_nok\" (geom)" %
os.path.join(TEST_DATA_DIR, "views_test.sqlite"), "vs_controle_ok_nok", "spatialite")
self.assertTrue(vl.isValid())
feature = QgsFeature()
rect = QgsRectangle(822733, 6699265, 829351, 6707266)
it = vl.getFeatures(rect)
it.nextFeature(feature)
self.assertTrue(feature.isValid())
if __name__ == '__main__':
unittest.main()

BIN
tests/testdata/views_test.sqlite vendored Normal file

Binary file not shown.