Skip to content

Commit

Permalink
Added asset uri tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros committed Dec 2, 2024
1 parent 8e518e3 commit b47592b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/src/core/testqgsstac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b47592b

Please sign in to comment.