File indexing completed on 2023-05-30 10:49:17
0001 /* 0002 SPDX-FileCopyrightText: 2016 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "TestUtils.h" 0008 0009 #include <GeoSceneEquirectTileProjection.h> 0010 #include <GeoSceneMercatorTileProjection.h> 0011 #include <GeoDataLatLonBox.h> 0012 #include <TileId.h> 0013 0014 0015 namespace Marble 0016 { 0017 0018 class TileProjectionTest : public QObject 0019 { 0020 Q_OBJECT 0021 0022 private Q_SLOTS: 0023 void testTypeEquirect(); 0024 void testTypeMercator(); 0025 0026 void testLevelZeroColumnsRowsEquirect(); 0027 void testLevelZeroColumnsRowsMercator(); 0028 0029 void testTileIndexesEquirect_data(); 0030 void testTileIndexesEquirect(); 0031 void testTileIndexesMercator_data(); 0032 void testTileIndexesMercator(); 0033 0034 void testGeoCoordinatesEquirect_data(); 0035 void testGeoCoordinatesEquirect(); 0036 void testGeoCoordinatesMercator_data(); 0037 void testGeoCoordinatesMercator(); 0038 0039 private: 0040 void testLevelZeroColumnsRows(GeoSceneAbstractTileProjection& projection); 0041 }; 0042 0043 0044 void TileProjectionTest::testLevelZeroColumnsRows(GeoSceneAbstractTileProjection& projection) 0045 { 0046 // test default 0047 QCOMPARE(projection.levelZeroColumns(), 1); 0048 QCOMPARE(projection.levelZeroRows(), 1); 0049 0050 // test setting a different value 0051 const int levelZeroColumns = 4; 0052 const int levelZeroRows = 6; 0053 0054 projection.setLevelZeroColumns(levelZeroColumns); 0055 projection.setLevelZeroRows(levelZeroRows); 0056 0057 QCOMPARE(projection.levelZeroColumns(), levelZeroColumns); 0058 QCOMPARE(projection.levelZeroRows(), levelZeroRows); 0059 } 0060 0061 void TileProjectionTest::testLevelZeroColumnsRowsEquirect() 0062 { 0063 GeoSceneEquirectTileProjection projection; 0064 testLevelZeroColumnsRows(projection); 0065 } 0066 0067 void TileProjectionTest::testLevelZeroColumnsRowsMercator() 0068 { 0069 GeoSceneMercatorTileProjection projection; 0070 testLevelZeroColumnsRows(projection); 0071 } 0072 0073 void TileProjectionTest::testTypeEquirect() 0074 { 0075 GeoSceneEquirectTileProjection projection; 0076 QCOMPARE(projection.type(), GeoSceneAbstractTileProjection::Equirectangular); 0077 } 0078 0079 void TileProjectionTest::testTypeMercator() 0080 { 0081 GeoSceneMercatorTileProjection projection; 0082 QCOMPARE(projection.type(), GeoSceneAbstractTileProjection::Mercator); 0083 } 0084 0085 0086 void TileProjectionTest::testTileIndexesEquirect_data() 0087 { 0088 QTest::addColumn<qreal>("westLon"); 0089 QTest::addColumn<qreal>("northLat"); 0090 QTest::addColumn<qreal>("eastLon"); 0091 QTest::addColumn<qreal>("southLat"); 0092 QTest::addColumn<int>("zoomLevel"); 0093 QTest::addColumn<int>("expectedTileXWest"); 0094 QTest::addColumn<int>("expectedTileYNorth"); 0095 QTest::addColumn<int>("expectedTileXEast"); 0096 QTest::addColumn<int>("expectedTileYSouth"); 0097 0098 // zoomlevel zero: 1 tile 0099 // bounds matching the tile map 0100 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0101 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0102 << 0 0103 << 0 << 0 << 0 << 0; 0104 // bounds inside the 1 tile 0105 addRow() << qreal(-M_PI*0.5) << qreal(+M_PI * 0.25) 0106 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0107 << 0 0108 << 0 << 0 << 0 << 0; 0109 // bounds west and north on tile map borders, with normal border values 0110 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0111 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0112 << 0 0113 << 0 << 0 << 0 << 0; 0114 // bounds west and north on tile map borders, with border values from other map border sides 0115 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0116 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0117 << 0 0118 << 0 << 0 << 0 << 0; 0119 0120 // zoomlevel 1: 2 tiles per dimension 0121 // bounds matching the tile map 0122 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0123 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0124 << 1 0125 << 0 << 0 << 1 << 1; 0126 // bounds inside the 4 tiles 0127 addRow() << qreal(-M_PI*0.5) << qreal(+M_PI * 0.25) 0128 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0129 << 1 0130 << 0 << 0 << 1 << 1; 0131 // bounds matching the most north-west tile, with normal border values 0132 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0133 << qreal(0) << qreal(0) 0134 << 1 0135 << 0 << 0 << 0 << 0; 0136 // bounds matching the most north-west tile, with border values from other map border sides 0137 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0138 << qreal(0) << qreal(0) 0139 << 1 0140 << 0 << 0 << 0 << 0; 0141 // bounds matching the most south-east tile, with normal border values 0142 addRow() << qreal(0) << qreal(0) 0143 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0144 << 1 0145 << 1 << 1 << 1 << 1; 0146 // bounds matching the most south-east tile, with border values from other map border sides 0147 addRow() << qreal(0) << qreal(0) 0148 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0149 << 1 0150 << 1 << 1 << 1 << 1; 0151 0152 // zoomlevel 9: 2^8==512 tiles per dimension 0153 // bounds matching the tile map 0154 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0155 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0156 << 9 0157 << 0 << 0 << 511 << 511; 0158 // bounds inside the outer tiles 0159 addRow() << qreal(-M_PI*(511/512.0)) << qreal(+M_PI * 0.5 * (511/512.0)) 0160 << qreal(+M_PI*(511/512.0)) << qreal(-M_PI * 0.5 * (511/512.0)) 0161 << 9 0162 << 0 << 0 << 511 << 511; 0163 // bounds matching the most north-west tile, with normal border values 0164 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0165 << qreal(-M_PI*(255/256.0)) << qreal(+M_PI * 0.5 *(255/256.0)) 0166 << 9 0167 << 0 << 0 << 0 << 0; 0168 // bounds matching the most north-west tile, with border values from other map border sides 0169 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0170 << qreal(-M_PI*(255/256.0)) << qreal(+M_PI * 0.5 *(255/256.0)) 0171 << 9 0172 << 0 << 0 << 0 << 0; 0173 // bounds matching the most south-east tile, with normal border values 0174 addRow() << qreal(+M_PI*(255/256.0)) << qreal(-M_PI * 0.5 *(255/256.0)) 0175 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0176 << 9 0177 << 511 << 511 << 511 << 511; 0178 // bounds matching the most south-east tile, with border values from other map border sides 0179 addRow() << qreal(+M_PI*(255/256.0)) << qreal(-M_PI * 0.5 *(255/256.0)) 0180 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0181 << 9 0182 << 511 << 511 << 511 << 511; 0183 } 0184 0185 0186 void TileProjectionTest::testTileIndexesEquirect() 0187 { 0188 QFETCH(qreal, westLon); 0189 QFETCH(qreal, northLat); 0190 QFETCH(qreal, eastLon); 0191 QFETCH(qreal, southLat); 0192 QFETCH(int, zoomLevel); 0193 QFETCH(int, expectedTileXWest); 0194 QFETCH(int, expectedTileYNorth); 0195 QFETCH(int, expectedTileXEast); 0196 QFETCH(int, expectedTileYSouth); 0197 0198 GeoDataLatLonBox latLonBox(northLat, southLat, eastLon, westLon); 0199 0200 const GeoSceneEquirectTileProjection projection; 0201 0202 const QRect rect = projection.tileIndexes(latLonBox, zoomLevel); 0203 0204 QCOMPARE(rect.left(), expectedTileXWest); 0205 QCOMPARE(rect.top(), expectedTileYNorth); 0206 QCOMPARE(rect.right(), expectedTileXEast); 0207 QCOMPARE(rect.bottom(), expectedTileYSouth); 0208 } 0209 0210 0211 void TileProjectionTest::testTileIndexesMercator_data() 0212 { 0213 QTest::addColumn<qreal>("westLon"); 0214 QTest::addColumn<qreal>("northLat"); 0215 QTest::addColumn<qreal>("eastLon"); 0216 QTest::addColumn<qreal>("southLat"); 0217 QTest::addColumn<int>("zoomLevel"); 0218 QTest::addColumn<int>("expectedTileXWest"); 0219 QTest::addColumn<int>("expectedTileYNorth"); 0220 QTest::addColumn<int>("expectedTileXEast"); 0221 QTest::addColumn<int>("expectedTileYSouth"); 0222 0223 // zoomlevel zero: 1 tile 0224 // bounds matching the tile map up to 90 degree latitude 0225 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0226 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0227 << 0 0228 << 0 << 0 << 0 << 0; 0229 // bounds matching the tile map with 85 degree latitude limit 0230 addRow() << qreal(-M_PI) << qreal(85.0 * DEG2RAD) 0231 << qreal(+M_PI) << qreal(-85.0 * DEG2RAD) 0232 << 0 0233 << 0 << 0 << 0 << 0; 0234 // bounds inside the 1 tile 0235 addRow() << qreal(-M_PI*0.5) << qreal(+M_PI * 0.25) 0236 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0237 << 0 0238 << 0 << 0 << 0 << 0; 0239 // bounds west and north on tile map borders, with normal border values 0240 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0241 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0242 << 0 0243 << 0 << 0 << 0 << 0; 0244 // bounds west and north on tile map borders, with border values from other map border sides 0245 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0246 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0247 << 0 0248 << 0 << 0 << 0 << 0; 0249 0250 // zoomlevel 1: 2 tiles per dimension 0251 // bounds matching the tile map up to 90 degree latitude 0252 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0253 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0254 << 1 0255 << 0 << 0 << 1 << 1; 0256 // bounds matching the tile map with 85 degree latitude limit 0257 addRow() << qreal(-M_PI) << qreal(85.0 * DEG2RAD) 0258 << qreal(+M_PI) << qreal(-85.0 * DEG2RAD) 0259 << 1 0260 << 0 << 0 << 1 << 1; 0261 // bounds inside the 4 tiles 0262 addRow() << qreal(-M_PI*0.5) << qreal(+M_PI * 0.25) 0263 << qreal(+M_PI*0.5) << qreal(-M_PI * 0.25) 0264 << 1 0265 << 0 << 0 << 1 << 1; 0266 // bounds matching the most north-west tile, with normal border values 0267 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0268 << qreal(0) << qreal(0) 0269 << 1 0270 << 0 << 0 << 0 << 0; 0271 // bounds matching the most north-west tile, with border values from other map border sides 0272 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0273 << qreal(0) << qreal(0) 0274 << 1 0275 << 0 << 0 << 0 << 0; 0276 // bounds matching the most south-east tile, with normal border values 0277 addRow() << qreal(0) << qreal(0) 0278 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0279 << 1 0280 << 1 << 1 << 1 << 1; 0281 // bounds matching the most south-east tile, with border values from other map border sides 0282 addRow() << qreal(0) << qreal(0) 0283 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0284 << 1 0285 << 1 << 1 << 1 << 1; 0286 0287 // zoomlevel 9: 2^8==512 tiles per dimension 0288 // GeoSceneMercatorTileProjection bounds latitude value at +/- 85.0 degree (so not at 85.05113), 0289 // which results in some tiles missed at the outer sides. 0290 // bounds matching the tile map up to 90 degree latitude 0291 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0292 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0293 << 9 0294 << 0 << 5 << 511 << 506; 0295 // bounds matching the tile map with 85 degree latitude limit 0296 addRow() << qreal(-M_PI) << qreal(85.0 * DEG2RAD) 0297 << qreal(+M_PI) << qreal(-85.0 * DEG2RAD) 0298 << 9 0299 << 0 << 5 << 511 << 506; 0300 // bounds inside the outer tiles 0301 addRow() << qreal(-M_PI*(511/512.0)) << qreal(+M_PI * 0.5 * (511/512.0)) 0302 << qreal(+M_PI*(511/512.0)) << qreal(-M_PI * 0.5 * (511/512.0)) 0303 << 9 0304 << 0 << 5 << 511 << 506; 0305 // bounds matching the most north-west tile, with normal border values 0306 addRow() << qreal(-M_PI) << qreal(+M_PI * 0.5) 0307 << qreal(-M_PI*(255/256.0)) << qreal(+M_PI * 0.5 *(255/256.0)) 0308 << 9 0309 << 0 << 5 << 0 << 5; 0310 // bounds matching the most north-west tile, with border values from other map border sides 0311 addRow() << qreal(+M_PI) << qreal(-M_PI * 0.5) 0312 << qreal(-M_PI*(255/256.0)) << qreal(+M_PI * 0.5 *(255/256.0)) 0313 << 9 0314 << 0 << 5 << 0 << 5; 0315 // bounds matching the most south-east tile, with normal border values 0316 addRow() << qreal(+M_PI*(255/256.0)) << qreal(-M_PI * 0.5 *(255/256.0)) 0317 << qreal(+M_PI) << qreal(-M_PI * 0.5) 0318 << 9 0319 << 511 << 506 << 511 << 506; 0320 // bounds matching the most south-east tile, with border values from other map border sides 0321 addRow() << qreal(+M_PI*(255/256.0)) << qreal(-M_PI * 0.5 *(255/256.0)) 0322 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0323 << 9 0324 << 511 << 506 << 511 << 506; 0325 } 0326 0327 0328 void TileProjectionTest::testTileIndexesMercator() 0329 { 0330 QFETCH(qreal, westLon); 0331 QFETCH(qreal, northLat); 0332 QFETCH(qreal, eastLon); 0333 QFETCH(qreal, southLat); 0334 QFETCH(int, zoomLevel); 0335 QFETCH(int, expectedTileXWest); 0336 QFETCH(int, expectedTileYNorth); 0337 QFETCH(int, expectedTileXEast); 0338 QFETCH(int, expectedTileYSouth); 0339 0340 GeoDataLatLonBox latLonBox(northLat, southLat, eastLon, westLon); 0341 0342 const GeoSceneMercatorTileProjection projection; 0343 0344 const QRect rect = projection.tileIndexes(latLonBox, zoomLevel); 0345 0346 QCOMPARE(rect.left(), expectedTileXWest); 0347 QCOMPARE(rect.top(), expectedTileYNorth); 0348 QCOMPARE(rect.right(), expectedTileXEast); 0349 QCOMPARE(rect.bottom(), expectedTileYSouth); 0350 } 0351 0352 0353 void TileProjectionTest::testGeoCoordinatesEquirect_data() 0354 { 0355 QTest::addColumn<int>("tileX"); 0356 QTest::addColumn<int>("tileY"); 0357 QTest::addColumn<int>("zoomLevel"); 0358 QTest::addColumn<qreal>("expectedWesternTileEdgeLon"); 0359 QTest::addColumn<qreal>("expectedNorthernTileEdgeLat"); 0360 QTest::addColumn<qreal>("expectedEasternTileEdgeLon"); 0361 QTest::addColumn<qreal>("expectedSouthernTileEdgeLat"); 0362 0363 // zoomlevel zero: 1 tile 0364 addRow() << 0 << 0 << 0 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0365 << qreal(+M_PI) << qreal(-M_PI * 0.5); 0366 0367 // zoomlevel 1: 2 tiles per dimension 0368 addRow() << 0 << 0 << 1 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0369 << qreal(0) << qreal(0); 0370 addRow() << 0 << 1 << 1 << qreal(-M_PI) << qreal(0) 0371 << qreal(0) << qreal(-M_PI * 0.5); 0372 addRow() << 1 << 0 << 1 << qreal(0) << qreal(+M_PI * 0.5) 0373 << qreal(+M_PI) << qreal(0); 0374 addRow() << 1 << 1 << 1 << qreal(0) << qreal(0) 0375 << qreal(+M_PI) << qreal(-M_PI * 0.5); 0376 0377 // zoomlevel 9: 2^8==512 tiles per dimension 0378 addRow() << 0 << 0 << 9 << qreal(-M_PI) << qreal(+M_PI * 0.5) 0379 << qreal(-M_PI * (255/256.0)) << qreal(+M_PI * 0.5 * (255/256.0)); 0380 addRow() << 0 << 256 << 9 << qreal(-M_PI) << qreal(0) 0381 << qreal(-M_PI * (255/256.0)) << qreal(-M_PI * 0.5 * (1/256.0)); 0382 addRow() << 256 << 0 << 9 << qreal(0) << qreal(+M_PI * 0.5) 0383 << qreal(M_PI * (1/256.0)) << qreal(+M_PI * 0.5 * (255/256.0)); 0384 addRow() << 511 << 511 << 9 << qreal(M_PI * (255/256.0)) << qreal(-M_PI * 0.5 * (255/256.0)) 0385 << qreal(+M_PI) << qreal(-M_PI * 0.5); 0386 } 0387 0388 0389 void TileProjectionTest::testGeoCoordinatesEquirect() 0390 { 0391 QFETCH(int, tileX); 0392 QFETCH(int, tileY); 0393 QFETCH(int, zoomLevel); 0394 QFETCH(qreal, expectedWesternTileEdgeLon); 0395 QFETCH(qreal, expectedNorthernTileEdgeLat); 0396 QFETCH(qreal, expectedEasternTileEdgeLon); 0397 QFETCH(qreal, expectedSouthernTileEdgeLat); 0398 0399 const GeoSceneEquirectTileProjection projection; 0400 0401 // method variants with GeoDataLatLonBox 0402 const GeoDataLatLonBox latLonBox = projection.geoCoordinates(zoomLevel, tileX, tileY); 0403 0404 QCOMPARE(latLonBox.west(), expectedWesternTileEdgeLon); 0405 QCOMPARE(latLonBox.north(), expectedNorthernTileEdgeLat); 0406 QCOMPARE(latLonBox.east(), expectedEasternTileEdgeLon); 0407 QCOMPARE(latLonBox.south(), expectedSouthernTileEdgeLat); 0408 0409 TileId tileId(QStringLiteral("testmap"), zoomLevel, tileX, tileY); 0410 const GeoDataLatLonBox latLonBox2 = projection.geoCoordinates(tileId); 0411 0412 QCOMPARE(latLonBox2.west(), expectedWesternTileEdgeLon); 0413 QCOMPARE(latLonBox2.north(), expectedNorthernTileEdgeLat); 0414 QCOMPARE(latLonBox2.east(), expectedEasternTileEdgeLon); 0415 QCOMPARE(latLonBox2.south(), expectedSouthernTileEdgeLat); 0416 } 0417 0418 void TileProjectionTest::testGeoCoordinatesMercator_data() 0419 { 0420 QTest::addColumn<int>("tileX"); 0421 QTest::addColumn<int>("tileY"); 0422 QTest::addColumn<int>("zoomLevel"); 0423 QTest::addColumn<qreal>("expectedWesternTileEdgeLon"); 0424 QTest::addColumn<qreal>("expectedNorthernTileEdgeLat"); 0425 QTest::addColumn<qreal>("expectedEasternTileEdgeLon"); 0426 QTest::addColumn<qreal>("expectedSouthernTileEdgeLat"); 0427 0428 const qreal absMaxLat = DEG2RAD * 85.05113; 0429 0430 // zoomlevel zero: 1 tile 0431 addRow() << 0 << 0 << 0 << qreal(-M_PI) << qreal(+absMaxLat) 0432 << qreal(+M_PI) << qreal(-absMaxLat); 0433 0434 // zoomlevel 1: 2 tiles per dimension 0435 addRow() << 0 << 0 << 1 << qreal(-M_PI) << qreal(+absMaxLat) 0436 << qreal(0) << qreal(0); 0437 addRow() << 0 << 1 << 1 << qreal(-M_PI) << qreal(0) 0438 << qreal(0) << qreal(-absMaxLat); 0439 addRow() << 1 << 0 << 1 << qreal(0) << qreal(+absMaxLat) 0440 << qreal(+M_PI) << qreal(0); 0441 addRow() << 1 << 1 << 1 << qreal(0) << qreal(0) 0442 << qreal(+M_PI) << qreal(-absMaxLat); 0443 0444 // zoomlevel 9: 2^8==512 tiles per dimension 0445 addRow() << 0 << 0 << 9 << qreal(-M_PI) << qreal(+absMaxLat) 0446 << qreal(-M_PI * (255/256.0)) << qreal(+1.48336); 0447 addRow() << 0 << 256 << 9 << qreal(-M_PI) << qreal(0) 0448 << qreal(-M_PI * (255/256.0)) << qreal(-0.0122715); 0449 addRow() << 256 << 0 << 9 << qreal(0) << qreal(+absMaxLat) 0450 << qreal(M_PI * (1/256.0)) << qreal(+1.48336); 0451 addRow() << 511 << 511 << 9 << qreal(M_PI * (255/256.0)) << qreal(-1.48336) 0452 << qreal(+M_PI) << qreal(-absMaxLat); 0453 } 0454 0455 0456 void TileProjectionTest::testGeoCoordinatesMercator() 0457 { 0458 QFETCH(int, tileX); 0459 QFETCH(int, tileY); 0460 QFETCH(int, zoomLevel); 0461 QFETCH(qreal, expectedWesternTileEdgeLon); 0462 QFETCH(qreal, expectedNorthernTileEdgeLat); 0463 QFETCH(qreal, expectedEasternTileEdgeLon); 0464 QFETCH(qreal, expectedSouthernTileEdgeLat); 0465 0466 const GeoSceneMercatorTileProjection projection; 0467 0468 // method variants with GeoDataLatLonBox 0469 const GeoDataLatLonBox latLonBox = projection.geoCoordinates(zoomLevel, tileX, tileY); 0470 0471 QCOMPARE(latLonBox.west(), expectedWesternTileEdgeLon); 0472 QFUZZYCOMPARE(latLonBox.north(), expectedNorthernTileEdgeLat, 0.00001); 0473 QCOMPARE(latLonBox.east(), expectedEasternTileEdgeLon); 0474 QFUZZYCOMPARE(latLonBox.south(), expectedSouthernTileEdgeLat, 0.00001); 0475 0476 TileId tileId(QStringLiteral("testmap"), zoomLevel, tileX, tileY); 0477 const GeoDataLatLonBox latLonBox2 = projection.geoCoordinates(tileId); 0478 0479 QCOMPARE(latLonBox2.west(), expectedWesternTileEdgeLon); 0480 QFUZZYCOMPARE(latLonBox2.north(), expectedNorthernTileEdgeLat, 0.00001); 0481 QCOMPARE(latLonBox2.east(), expectedEasternTileEdgeLon); 0482 QFUZZYCOMPARE(latLonBox2.south(), expectedSouthernTileEdgeLat, 0.00001); 0483 } 0484 0485 } // namespace Marble 0486 0487 QTEST_MAIN(Marble::TileProjectionTest) 0488 0489 #include "TestTileProjection.moc"