From 44f42b9bfb8790b0226f761083e4738d19bbac4a Mon Sep 17 00:00:00 2001 From: uclaros Date: Fri, 29 Nov 2024 20:20:26 +0200 Subject: [PATCH] Added asset uri tests --- tests/src/core/testqgsstac.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/src/core/testqgsstac.cpp b/tests/src/core/testqgsstac.cpp index 02d0d1a15b35..ac017c32df92 100644 --- a/tests/src/core/testqgsstac.cpp +++ b/tests/src/core/testqgsstac.cpp @@ -200,14 +200,27 @@ void TestQgsStac::testParseLocalItem() QVERIFY( asset.isCloudOptimized() ); QCOMPARE( asset.formatName(), QStringLiteral( "COG" ) ); + QgsMimeDataUtils::Uri uri = asset.uri(); + QCOMPARE( uri.uri, basePath + QStringLiteral( "20201211_223832_CS2_analytic.tif" ) ); + QCOMPARE( uri.name, QStringLiteral( "analytic" ) ); + QCOMPARE( uri.layerType, QStringLiteral( "raster" ) ); + asset = item->assets().value( QStringLiteral( "thumbnail" ), QgsStacAsset( {}, {}, {}, {}, {} ) ); QCOMPARE( asset.href(), QStringLiteral( "https://storage.googleapis.com/open-cogs/stac-examples/20201211_223832_CS2.jpg" ) ); QVERIFY( !asset.isCloudOptimized() ); + uri = asset.uri(); + QVERIFY( !uri.isValid() ); + QVERIFY( uri.uri.isEmpty() ); + QVERIFY( uri.name.isEmpty() ); // normal geotiff is not cloud optimized asset = item->assets().value( QStringLiteral( "udm" ), QgsStacAsset( {}, {}, {}, {}, {} ) ); QVERIFY( !asset.isCloudOptimized() ); QCOMPARE( asset.formatName(), QString() ); + uri = asset.uri(); + QVERIFY( !uri.isValid() ); + QVERIFY( uri.uri.isEmpty() ); + QVERIFY( uri.name.isEmpty() ); delete item; }