Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test_provider_ogr.py: add test for createDataItem() on a raster with …
…2 layers
  • Loading branch information
rouault authored and github-actions[bot] committed Feb 27, 2021
1 parent f7ce5b4 commit 0d0e386
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/src/python/test_provider_ogr.py
Expand Up @@ -475,6 +475,19 @@ def testDataItems(self):
self.assertIn('testDataItems.gpkg|layername=Layer1', children[0].uri())
self.assertIn('testDataItems.gpkg|layername=Layer2', children[1].uri())

def testDataItemsRaster(self):

registry = QgsApplication.dataItemProviderRegistry()
ogrprovider = next(provider for provider in registry.providers() if provider.name() == 'OGR')

# Multiple layer (geopackage)
path = os.path.join(unitTestDataPath(), 'two_raster_layers.gpkg')
item = ogrprovider.createDataItem(path, None)
children = item.createChildren()
self.assertEqual(len(children), 2)
self.assertIn('GPKG:' + path + ':layer01', children[0].uri())
self.assertIn('GPKG:' + path + ':layer02', children[1].uri())

def testOSM(self):
""" Test that opening several layers of the same OSM datasource works properly """

Expand Down
Binary file added tests/testdata/two_raster_layers.gpkg
Binary file not shown.

0 comments on commit 0d0e386

Please sign in to comment.