Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 3, 2025
1 parent 2c206b2 commit e7a7d0a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 5 additions & 5 deletions tests/src/core/testqgsvectortilelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void TestQgsVectorTileLayer::testMbtilesProviderMetadata()
QCOMPARE( vectorTileMetadata->validLayerTypesForUri( QStringLiteral( "type=mbtiles&url=%1/vector_tile/mbtiles_vt.mbtiles" ).arg( TEST_DATA_DIR ) ), { Qgis::LayerType::VectorTile } );

// query sublayers
QString localMbtilesPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral("/vector_tile/mbtiles_vt.mbtiles") ) );
QString localMbtilesPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral( "/vector_tile/mbtiles_vt.mbtiles" ) ) );
QList<QgsProviderSublayerDetails> sublayers = vectorTileMetadata->querySublayers( QStringLiteral( "%1/vector_tile/mbtiles_vt.mbtiles" ).arg( TEST_DATA_DIR ) );

QCOMPARE( sublayers.size(), 1 );
Expand Down Expand Up @@ -295,7 +295,7 @@ void TestQgsVectorTileLayer::testMbtilesProviderMetadata()

// fast scan mode means that any mbtile file will be reported, including those with only raster tiles
// (we are skipping a potentially expensive db open and format check)
QString localIsleOfManPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral("/isle_of_man.mbtiles") ) );
QString localIsleOfManPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral( "/isle_of_man.mbtiles" ) ) );

sublayers = vectorTileMetadata->querySublayers( QStringLiteral( "%1/isle_of_man.mbtiles" ).arg( TEST_DATA_DIR ), Qgis::SublayerQueryFlag::FastScan );
QCOMPARE( sublayers.size(), 1 );
Expand Down Expand Up @@ -332,7 +332,7 @@ void TestQgsVectorTileLayer::test_relativePathsMbTiles()
QgsReadWriteContext contextRel;
contextRel.setPathResolver( QgsPathResolver( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/project.qgs" ) ) );
const QgsReadWriteContext contextAbs;
QString localMbtilesPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral("/vector_tile/mbtiles_vt.mbtiles") ) );
QString localMbtilesPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral( "/vector_tile/mbtiles_vt.mbtiles" ) ) );

const QString srcMbtiles = QStringLiteral( "type=mbtiles&url=%1" ).arg( localMbtilesPath );

Expand Down Expand Up @@ -449,7 +449,7 @@ void TestQgsVectorTileLayer::testVtpkProviderMetadata()
QVERIFY( vectorTileMetadata->querySublayers( QStringLiteral( "type=vtpk&url=%1/points.shp" ).arg( TEST_DATA_DIR ) ).isEmpty() );

// vtpk uris
QString localVtpkPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral("/testvtpk.vtpk") ) );
QString localVtpkPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral( "/testvtpk.vtpk" ) ) );

QCOMPARE( vectorTileMetadata->priorityForUri( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/testvtpk.vtpk" ) ), 100 );
QCOMPARE( vectorTileMetadata->validLayerTypesForUri( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/testvtpk.vtpk" ) ), { Qgis::LayerType::VectorTile } );
Expand Down Expand Up @@ -495,7 +495,7 @@ void TestQgsVectorTileLayer::test_relativePathsVtpk()
contextRel.setPathResolver( QgsPathResolver( QStringLiteral( TEST_DATA_DIR ) + QStringLiteral( "/project.qgs" ) ) );
const QgsReadWriteContext contextAbs;

QString localVtpkPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral("/testvtpk.vtpk") ) );
QString localVtpkPath = QStringLiteral( "%1%2" ).arg( QUrl::toPercentEncoding( TEST_DATA_DIR ), QUrl::toPercentEncoding( QStringLiteral( "/testvtpk.vtpk" ) ) );

const QString srcVtpk = QStringLiteral( "type=vtpk&url=%1" ).arg( localVtpkPath );

Expand Down
14 changes: 9 additions & 5 deletions tests/src/python/test_qgsvectortile.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def testEncodeDecodeUri(self):

parts["path"] = "/my/new/file.mbtiles"
uri = md.encodeUri(parts)
self.assertEqual(uri, 'type=mbtiles&url=%2Fmy%2Fnew%2Ffile.mbtiles')
self.assertEqual(uri, "type=mbtiles&url=%2Fmy%2Fnew%2Ffile.mbtiles")

uri = (
"type=xyz&url=https://fake.server/%7Bx%7D/%7By%7D/%7Bz%7D.png&zmin=0&zmax=2"
Expand All @@ -123,7 +123,10 @@ def testEncodeDecodeUri(self):

parts["url"] = "https://fake.new.server/{x}/{y}/{z}.png"
uri = md.encodeUri(parts)
self.assertEqual(uri, 'type=xyz&url=https%3A%2F%2Ffake.new.server%2F%7Bx%7D%2F%7By%7D%2F%7Bz%7D.png&zmax=2&zmin=0')
self.assertEqual(
uri,
"type=xyz&url=https%3A%2F%2Ffake.new.server%2F%7Bx%7D%2F%7By%7D%2F%7Bz%7D.png&zmax=2&zmin=0",
)

uri = "type=xyz&serviceType=arcgis&url=https://fake.server/%7Bx%7D/%7By%7D/%7Bz%7D.png&zmax=2&http-header:referer=https://qgis.org/&styleUrl=https://qgis.org/"
parts = md.decodeUri(uri)
Expand All @@ -142,9 +145,10 @@ def testEncodeDecodeUri(self):

parts["url"] = "https://fake.new.server/{x}/{y}/{z}.png"
uri = md.encodeUri(parts)
self.assertEqual(uri,
'serviceType=arcgis&styleUrl=https%3A%2F%2Fqgis.org%2F&type=xyz&url=https%3A%2F%2Ffake.new.server%2F%7Bx%7D%2F%7By%7D%2F%7Bz%7D.png&zmax=2&http-header:referer=https://qgis.org/')

self.assertEqual(
uri,
"serviceType=arcgis&styleUrl=https%3A%2F%2Fqgis.org%2F&type=xyz&url=https%3A%2F%2Ffake.new.server%2F%7Bx%7D%2F%7By%7D%2F%7Bz%7D.png&zmax=2&http-header:referer=https://qgis.org/",
)

def testZoomRange(self):
"""
Expand Down

0 comments on commit e7a7d0a

Please sign in to comment.