Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0d0e386

Browse files
rouaultgithub-actions[bot]
authored andcommittedFeb 27, 2021
test_provider_ogr.py: add test for createDataItem() on a raster with 2 layers
1 parent f7ce5b4 commit 0d0e386

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎tests/src/python/test_provider_ogr.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,19 @@ def testDataItems(self):
475475
self.assertIn('testDataItems.gpkg|layername=Layer1', children[0].uri())
476476
self.assertIn('testDataItems.gpkg|layername=Layer2', children[1].uri())
477477

478+
def testDataItemsRaster(self):
479+
480+
registry = QgsApplication.dataItemProviderRegistry()
481+
ogrprovider = next(provider for provider in registry.providers() if provider.name() == 'OGR')
482+
483+
# Multiple layer (geopackage)
484+
path = os.path.join(unitTestDataPath(), 'two_raster_layers.gpkg')
485+
item = ogrprovider.createDataItem(path, None)
486+
children = item.createChildren()
487+
self.assertEqual(len(children), 2)
488+
self.assertIn('GPKG:' + path + ':layer01', children[0].uri())
489+
self.assertIn('GPKG:' + path + ':layer02', children[1].uri())
490+
478491
def testOSM(self):
479492
""" Test that opening several layers of the same OSM datasource works properly """
480493

‎tests/testdata/two_raster_layers.gpkg

116 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.