Skip to content

Commit 29f319d

Browse files
committed
Added asset uri tests
1 parent 3ea70a2 commit 29f319d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/src/core/testqgsstac.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,27 @@ void TestQgsStac::testParseLocalItem()
200200
QVERIFY( asset.isCloudOptimized() );
201201
QCOMPARE( asset.formatName(), QStringLiteral( "COG" ) );
202202

203+
QgsMimeDataUtils::Uri uri = asset.uri();
204+
QCOMPARE( uri.uri, basePath + QStringLiteral( "20201211_223832_CS2_analytic.tif" ) );
205+
QCOMPARE( uri.name, QStringLiteral( "analytic" ) );
206+
QCOMPARE( uri.layerType, QStringLiteral( "raster" ) );
207+
203208
asset = item->assets().value( QStringLiteral( "thumbnail" ), QgsStacAsset( {}, {}, {}, {}, {} ) );
204209
QCOMPARE( asset.href(), QStringLiteral( "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.jpg" ) );
205210
QVERIFY( !asset.isCloudOptimized() );
211+
uri = asset.uri();
212+
QVERIFY( !uri.isValid() );
213+
QVERIFY( uri.uri.isEmpty() );
214+
QVERIFY( uri.name.isEmpty() );
206215

207216
// normal geotiff is not cloud optimized
208217
asset = item->assets().value( QStringLiteral( "udm" ), QgsStacAsset( {}, {}, {}, {}, {} ) );
209218
QVERIFY( !asset.isCloudOptimized() );
210219
QCOMPARE( asset.formatName(), QString() );
220+
uri = asset.uri();
221+
QVERIFY( !uri.isValid() );
222+
QVERIFY( uri.uri.isEmpty() );
223+
QVERIFY( uri.name.isEmpty() );
211224

212225
delete item;
213226
}

0 commit comments

Comments
 (0)