File indexing completed on 2022-10-04 14:00:18

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0004 //
0005 
0006 #include "GeoPainter.h"
0007 #include "MarbleMap.h"
0008 #include "MarbleModel.h"
0009 #include "TestUtils.h"
0010 
0011 #include <QThreadPool>
0012 
0013 namespace Marble
0014 {
0015 
0016 class MarbleMapTest : public QObject
0017 {
0018     Q_OBJECT
0019 
0020  private Q_SLOTS:
0021     void centerOnSpherical_data();
0022     void centerOnSpherical();
0023 
0024     void centerOnEquirectangular_data();
0025     void centerOnEquirectangular();
0026 
0027     void centerOnMercator_data();
0028     void centerOnMercator();
0029 
0030     void centerOnSphericalMinLat_data();
0031     void centerOnSphericalMinLat();
0032 
0033     void centerOnSphericalMaxLat_data();
0034     void centerOnSphericalMaxLat();
0035 
0036     void centerOnEquirectangularMinLat_data();
0037     void centerOnEquirectangularMinLat();
0038 
0039     void centerOnEquirectangularMaxLat_data();
0040     void centerOnEquirectangularMaxLat();
0041 
0042     void centerOnMercatorMinLat_data();
0043     void centerOnMercatorMinLat();
0044 
0045     void centerOnMercatorMaxLat_data();
0046     void centerOnMercatorMaxLat();
0047 
0048     void rotateBySpherical_data();
0049     void rotateBySpherical();
0050 
0051     void setMapTheme_data();
0052     void setMapTheme();
0053 
0054     void switchMapThemes();
0055 
0056     void setMapThemeIdTwoMaps_data();
0057     void setMapThemeIdTwoMaps();
0058 
0059     void switchMapThemesTwoMaps();
0060 
0061     void paint_data();
0062     void paint();
0063 
0064  private:
0065     MarbleModel m_model;
0066 };
0067 
0068 void MarbleMapTest::centerOnSpherical_data()
0069 {
0070     QTest::addColumn<qreal>( "lon" );
0071     QTest::addColumn<qreal>( "lat" );
0072 
0073     addRow() << qreal(0.0) << qreal(0.0);
0074 
0075     addRow() << qreal(-180.0) << qreal(0.0);
0076     addRow() <<  qreal(-90.0) << qreal(0.0);
0077     addRow() <<   qreal(90.0) << qreal(0.0);
0078     addRow() <<  qreal(180.0) << qreal(0.0);
0079 
0080     addRow() << qreal(-180.0) << qreal(90.0);
0081     addRow() <<  qreal(-90.0) << qreal(90.0);
0082     addRow() <<    qreal(0.0) << qreal(90.0);
0083     addRow() <<   qreal(90.0) << qreal(90.0);
0084     addRow() <<  qreal(180.0) << qreal(90.0);
0085 
0086     addRow() << qreal(-180.0) << qreal(-90.0);
0087     addRow() <<  qreal(-90.0) << qreal(-90.0);
0088     addRow() <<    qreal(0.0) << qreal(-90.0);
0089     addRow() <<   qreal(90.0) << qreal(-90.0);
0090     addRow() <<  qreal(180.0) << qreal(-90.0);
0091 
0092     addRow() << qreal(-180.0) << qreal(180.0);
0093     addRow() <<  qreal(-90.0) << qreal(180.0);
0094     addRow() <<    qreal(0.0) << qreal(180.0);
0095     addRow() <<   qreal(90.0) << qreal(180.0);
0096     addRow() <<  qreal(180.0) << qreal(180.0);
0097 
0098     addRow() << qreal(-180.0) << qreal(-180.0);
0099     addRow() <<  qreal(-90.0) << qreal(-180.0);
0100     addRow() <<    qreal(0.0) << qreal(-180.0);
0101     addRow() <<   qreal(90.0) << qreal(-180.0);
0102     addRow() <<  qreal(180.0) << qreal(-180.0);
0103 }
0104 
0105 void MarbleMapTest::centerOnSpherical()
0106 {
0107     QFETCH( qreal, lon );
0108     QFETCH( qreal, lat );
0109 
0110     MarbleMap map( &m_model );
0111     map.setProjection( Spherical );
0112 
0113     map.centerOn( lon, lat );
0114     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0115     QFUZZYCOMPARE( map.centerLatitude(), lat, 0.0001 );
0116 }
0117 
0118 void MarbleMapTest::centerOnEquirectangular_data()
0119 {
0120     QTest::addColumn<qreal>( "lon" );
0121     QTest::addColumn<qreal>( "lat" );
0122 
0123     addRow() << qreal(0.0) << qreal(0.0);
0124 
0125     addRow() << qreal(-180.0) << qreal(0.0);
0126     addRow() <<  qreal(-90.0) << qreal(0.0);
0127     addRow() <<   qreal(90.0) << qreal(0.0);
0128     addRow() <<  qreal(180.0) << qreal(0.0);
0129 
0130     addRow() << qreal(-180.0) << qreal(90.0);
0131     addRow() <<  qreal(-90.0) << qreal(90.0);
0132     addRow() <<    qreal(0.0) << qreal(90.0);
0133     addRow() <<   qreal(90.0) << qreal(90.0);
0134     addRow() <<  qreal(180.0) << qreal(90.0);
0135 
0136     addRow() << qreal(-180.0) << qreal(-90.0);
0137     addRow() <<  qreal(-90.0) << qreal(-90.0);
0138     addRow() <<    qreal(0.0) << qreal(-90.0);
0139     addRow() <<   qreal(90.0) << qreal(-90.0);
0140     addRow() <<  qreal(180.0) << qreal(-90.0);
0141 }
0142 
0143 void MarbleMapTest::centerOnEquirectangular()
0144 {
0145     QFETCH( qreal, lon );
0146     QFETCH( qreal, lat );
0147 
0148     MarbleMap map( &m_model );
0149     map.setProjection( Equirectangular );
0150 
0151     map.centerOn( lon, lat );
0152     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0153     QFUZZYCOMPARE( map.centerLatitude(), lat, 0.0001 );
0154 }
0155 
0156 void MarbleMapTest::centerOnMercator_data()
0157 {
0158     QTest::addColumn<qreal>( "lon" );
0159     QTest::addColumn<qreal>( "lat" );
0160 
0161     addRow() << qreal(0.0) << qreal(0.0);
0162 
0163     addRow() << qreal(-180.0) << qreal(0.0);
0164     addRow() <<  qreal(-90.0) << qreal(0.0);
0165     addRow() <<   qreal(90.0) << qreal(0.0);
0166     addRow() <<  qreal(180.0) << qreal(0.0);
0167 
0168     addRow() << qreal(-180.0) << qreal(-85.0511);
0169     addRow() <<  qreal(-90.0) << qreal(-85.0511);
0170     addRow() <<    qreal(0.0) << qreal(-85.0511);
0171     addRow() <<   qreal(90.0) << qreal(-85.0511);
0172     addRow() <<  qreal(180.0) << qreal(-85.0511);
0173 
0174     addRow() << qreal(-180.0) << qreal(85.0511);
0175     addRow() <<  qreal(-90.0) << qreal(85.0511);
0176     addRow() <<    qreal(0.0) << qreal(85.0511);
0177     addRow() <<   qreal(90.0) << qreal(85.0511);
0178     addRow() <<  qreal(180.0) << qreal(85.0511);
0179 }
0180 
0181 void MarbleMapTest::centerOnMercator()
0182 {
0183     MarbleMap map( &m_model );
0184 
0185     map.setProjection( Mercator );
0186 
0187     QFETCH( qreal, lon );
0188     QFETCH( qreal, lat );
0189 
0190     map.centerOn( lon, lat );
0191 
0192     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0193     QFUZZYCOMPARE( map.centerLatitude(), lat, 0.0001 );
0194 }
0195 
0196 void MarbleMapTest::centerOnSphericalMinLat_data()
0197 {
0198     QTest::addColumn<qreal>( "lon" );
0199     QTest::addColumn<qreal>( "lat" );
0200 
0201     addRow() << qreal(-180.0) << qreal(-180.001);
0202     addRow() <<  qreal(-90.0) << qreal(-180.001);
0203     addRow() <<    qreal(0.0) << qreal(-180.001);
0204     addRow() <<   qreal(90.0) << qreal(-180.001);
0205     addRow() <<  qreal(180.0) << qreal(-180.001);
0206 }
0207 
0208 void MarbleMapTest::centerOnSphericalMinLat()
0209 {
0210     MarbleMap map( &m_model );
0211 
0212     map.setProjection( Spherical );
0213 
0214     QFETCH( qreal, lon );
0215     QFETCH( qreal, lat );
0216 
0217     map.centerOn( lon, lat );
0218 
0219     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0220     QFUZZYCOMPARE( map.centerLatitude(), 179.999, 0.0001 );
0221 }
0222 
0223 void MarbleMapTest::centerOnSphericalMaxLat_data()
0224 {
0225     QTest::addColumn<qreal>( "lon" );
0226     QTest::addColumn<qreal>( "lat" );
0227 
0228     addRow() << qreal(-180.0) << qreal(180.001);
0229     addRow() <<  qreal(-90.0) << qreal(180.001);
0230     addRow() <<    qreal(0.0) << qreal(180.001);
0231     addRow() <<   qreal(90.0) << qreal(180.001);
0232     addRow() <<  qreal(180.0) << qreal(180.001);
0233 }
0234 
0235 void MarbleMapTest::centerOnSphericalMaxLat()
0236 {
0237     MarbleMap map( &m_model );
0238 
0239     map.setProjection( Spherical );
0240 
0241     QFETCH( qreal, lon );
0242     QFETCH( qreal, lat );
0243 
0244     map.centerOn( lon, lat );
0245 
0246     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0247     QFUZZYCOMPARE( map.centerLatitude(), -179.999, 0.0001 );
0248 }
0249 
0250 void MarbleMapTest::centerOnEquirectangularMinLat_data()
0251 {
0252     QTest::addColumn<qreal>( "lon" );
0253     QTest::addColumn<qreal>( "lat" );
0254 
0255     addRow() << qreal(-180.0) << qreal(-90.001);
0256     addRow() <<  qreal(-90.0) << qreal(-90.001);
0257     addRow() <<    qreal(0.0) << qreal(-90.001);
0258     addRow() <<   qreal(90.0) << qreal(-90.001);
0259     addRow() <<  qreal(180.0) << qreal(-90.001);
0260 }
0261 
0262 void MarbleMapTest::centerOnEquirectangularMinLat()
0263 {
0264     MarbleMap map( &m_model );
0265 
0266     map.setProjection( Equirectangular );
0267 
0268     QFETCH( qreal, lon );
0269     QFETCH( qreal, lat );
0270 
0271     map.centerOn( lon, lat );
0272 
0273     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0274     QFUZZYCOMPARE( map.centerLatitude(), -90.0, 0.0001 );
0275 }
0276 
0277 void MarbleMapTest::centerOnEquirectangularMaxLat_data()
0278 {
0279     QTest::addColumn<qreal>( "lon" );
0280     QTest::addColumn<qreal>( "lat" );
0281 
0282     addRow() << qreal(-180.0) << qreal(90.001);
0283     addRow() <<  qreal(-90.0) << qreal(90.001);
0284     addRow() <<    qreal(0.0) << qreal(90.001);
0285     addRow() <<   qreal(90.0) << qreal(90.001);
0286     addRow() <<  qreal(180.0) << qreal(90.001);
0287 }
0288 
0289 void MarbleMapTest::centerOnEquirectangularMaxLat()
0290 {
0291     MarbleMap map( &m_model );
0292 
0293     map.setProjection( Equirectangular );
0294 
0295     QFETCH( qreal, lon );
0296     QFETCH( qreal, lat );
0297 
0298     map.centerOn( lon, lat );
0299 
0300     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0301     QFUZZYCOMPARE( map.centerLatitude(), 90.0, 0.0001 );
0302 }
0303 
0304 void MarbleMapTest::centerOnMercatorMinLat_data()
0305 {
0306     QTest::addColumn<qreal>( "lon" );
0307     QTest::addColumn<qreal>( "lat" );
0308 
0309     addRow() << qreal(-180.0) << qreal(-87.0);
0310     addRow() <<  qreal(-90.0) << qreal(-87.0);
0311     addRow() <<    qreal(0.0) << qreal(-87.0);
0312     addRow() <<   qreal(90.0) << qreal(-87.0);
0313     addRow() <<  qreal(180.0) << qreal(-87.0);
0314 
0315     addRow() << qreal(-180.0) << qreal(-90.0);
0316     addRow() <<  qreal(-90.0) << qreal(-90.0);
0317     addRow() <<    qreal(0.0) << qreal(-90.0);
0318     addRow() <<   qreal(90.0) << qreal(-90.0);
0319     addRow() <<  qreal(180.0) << qreal(-90.0);
0320 }
0321 
0322 void MarbleMapTest::centerOnMercatorMinLat()
0323 {
0324     MarbleMap map( &m_model );
0325 
0326     map.setProjection( Mercator );
0327 
0328     QFETCH( qreal, lon );
0329     QFETCH( qreal, lat );
0330 
0331     map.centerOn( lon, lat );
0332 
0333     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0334     QFUZZYCOMPARE( map.centerLatitude(), -85.0511, 0.0001 ); // clip to minLat
0335 }
0336 
0337 void MarbleMapTest::centerOnMercatorMaxLat_data()
0338 {
0339     QTest::addColumn<qreal>( "lon" );
0340     QTest::addColumn<qreal>( "lat" );
0341 
0342     addRow() << qreal(-180.0) << qreal(87.0);
0343     addRow() <<  qreal(-90.0) << qreal(87.0);
0344     addRow() <<    qreal(0.0) << qreal(87.0);
0345     addRow() <<   qreal(90.0) << qreal(87.0);
0346     addRow() <<  qreal(180.0) << qreal(87.0);
0347 
0348     addRow() << qreal(-180.0) << qreal(90.0);
0349     addRow() <<  qreal(-90.0) << qreal(90.0);
0350     addRow() <<    qreal(0.0) << qreal(90.0);
0351     addRow() <<   qreal(90.0) << qreal(90.0);
0352     addRow() <<  qreal(180.0) << qreal(90.0);
0353 }
0354 
0355 void MarbleMapTest::centerOnMercatorMaxLat()
0356 {
0357     MarbleMap map( &m_model );
0358 
0359     map.setProjection( Mercator );
0360 
0361     QFETCH( qreal, lon );
0362     QFETCH( qreal, lat );
0363 
0364     map.centerOn( lon, lat );
0365 
0366     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0367     QFUZZYCOMPARE( map.centerLatitude(), 85.0511, 0.0001 ); // clip to maxLat
0368 }
0369 
0370 void MarbleMapTest::rotateBySpherical_data()
0371 {
0372     QTest::addColumn<int>( "lon" );
0373     QTest::addColumn<int>( "lat" );
0374     QTest::addColumn<int>( "deltaLon" );
0375     QTest::addColumn<int>( "deltaLat" );
0376 
0377     addRow() << 0 << 0 << 0 << 0;
0378 
0379     addRow() << 0 << 0 << -180 << 0;
0380     addRow() << 0 << 0 <<  -90 << 0;
0381     addRow() << 0 << 0 <<   -5 << 0;
0382     addRow() << 0 << 0 <<    5 << 0;
0383     addRow() << 0 << 0 <<   90 << 0;
0384     addRow() << 0 << 0 <<  180 << 0;
0385 
0386     addRow() << 0 << 0 << 0 << -180;
0387     addRow() << 0 << 0 << 0 <<  -90;
0388     addRow() << 0 << 0 << 0 <<   -5;
0389     addRow() << 0 << 0 << 0 <<    5;
0390     addRow() << 0 << 0 << 0 <<   90;
0391     addRow() << 0 << 0 << 0 <<  180;
0392 
0393     addRow() << 0 << 0 << -180 << -180;
0394     addRow() << 0 << 0 <<  -90 <<  -90;
0395     addRow() << 0 << 0 <<   -5 <<   -5;
0396     addRow() << 0 << 0 <<    5 <<    5;
0397     addRow() << 0 << 0 <<   90 <<   90;
0398     addRow() << 0 << 0 <<  180 <<  180;
0399 
0400     addRow() << 0 <<  160 << 0 << -20;
0401     addRow() << 0 <<  160 << 0 <<  20;
0402     addRow() << 0 <<   80 << 0 << -20;
0403     addRow() << 0 <<   80 << 0 <<  20;
0404     addRow() << 0 <<  -80 << 0 << -20;
0405     addRow() << 0 <<  -80 << 0 <<  20;
0406     addRow() << 0 << -160 << 0 << -20;
0407     addRow() << 0 << -160 << 0 <<  20;
0408 
0409     addRow() <<  150 << 0 << -30 << 0;
0410     addRow() <<  150 << 0 <<  30 << 0;
0411     addRow() <<   50 << 0 << -30 << 0;
0412     addRow() <<   50 << 0 <<  30 << 0;
0413     addRow() <<  -50 << 0 << -30 << 0;
0414     addRow() <<  -50 << 0 <<  30 << 0;
0415     addRow() << -150 << 0 << -30 << 0;
0416     addRow() << -150 << 0 <<  30 << 0;
0417 
0418     addRow() <<  150 <<  160 << -30 << -20;
0419     addRow() <<  150 <<  160 <<  30 <<  20;
0420     addRow() <<   50 <<   80 << -30 << -20;
0421     addRow() <<   50 <<   80 <<  30 <<  20;
0422     addRow() <<  -50 <<  -80 << -30 << -20;
0423     addRow() <<  -50 <<  -80 <<  30 <<  20;
0424     addRow() << -150 << -160 << -30 << -20;
0425     addRow() << -150 << -160 <<  30 <<  20;
0426 }
0427 
0428 void MarbleMapTest::rotateBySpherical()
0429 {
0430     MarbleMap map( &m_model );
0431 
0432     map.setProjection( Spherical );
0433 
0434     QFETCH( int, lon );
0435     QFETCH( int, lat );
0436 
0437     map.centerOn( lon, lat );
0438 
0439     QFUZZYCOMPARE( map.centerLongitude(), lon, 0.0001 );
0440     QFUZZYCOMPARE( map.centerLatitude(), lat, 0.0001 );
0441 
0442     QFETCH( int, deltaLon );
0443     QFETCH( int, deltaLat );
0444 
0445     map.rotateBy( deltaLon, deltaLat );
0446 
0447     const int expectedLon = lon + deltaLon;
0448     const int expectedLat = lat + deltaLat;
0449 
0450     QFUZZYCOMPARE( map.centerLongitude(), expectedLon, 0.0001 );
0451     QFUZZYCOMPARE( map.centerLatitude(), expectedLat, 0.0001 );
0452 }
0453 
0454 void MarbleMapTest::setMapTheme_data()
0455 {
0456     QTest::addColumn<QString>( "mapThemeId" );
0457 
0458     addRow() << "earth/plain/plain.dgml";
0459     addRow() << "earth/srtm/srtm.dgml";
0460     addRow() << "earth/openstreetmap/openstreetmap.dgml";
0461 }
0462 
0463 void MarbleMapTest::setMapTheme()
0464 {
0465     QFETCH( QString, mapThemeId );
0466 
0467     MarbleMap map;
0468 
0469     map.setMapThemeId( mapThemeId );
0470 
0471     QCOMPARE( map.mapThemeId(), mapThemeId );
0472 
0473     QThreadPool::globalInstance()->waitForDone();  // wait for all runners to terminate
0474 }
0475 
0476 void MarbleMapTest::switchMapThemes()
0477 {
0478     QImage image( QSize( 143, 342 ), QImage::Format_ARGB32_Premultiplied );
0479 
0480     MarbleMap map;
0481     map.setSize( image.size() );
0482     map.setRadius( 114003 );
0483     map.setViewContext( Animation );
0484 
0485     GeoPainter painter( &image, map.viewport() );
0486 
0487     map.setMapThemeId( "earth/plain/plain.dgml" );
0488     QCOMPARE( map.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0489     QCOMPARE( map.preferredRadiusCeil( 1000 ), 1000 );
0490     QCOMPARE( map.preferredRadiusFloor( 1000 ), 1000 );
0491 
0492     map.setMapThemeId( "earth/srtm/srtm.dgml" );
0493     QCOMPARE( map.mapThemeId(), QString( "earth/srtm/srtm.dgml" ) );
0494     QCOMPARE( map.preferredRadiusCeil( 1000 ), 1348 );
0495     QCOMPARE( map.preferredRadiusFloor( 1000 ), 674 );
0496 
0497     map.setMapThemeId( "earth/openstreetmap/openstreetmap.dgml" );
0498     QCOMPARE( map.mapThemeId(), QString( "earth/openstreetmap/openstreetmap.dgml" ) );
0499     QCOMPARE( map.preferredRadiusCeil( 1000 ), 1024 );
0500     QCOMPARE( map.preferredRadiusFloor( 1000 ), 512 );
0501     map.paint( painter, QRect() ); // loads tiles
0502 
0503     map.setMapThemeId( "earth/plain/plain.dgml" );
0504     QCOMPARE( map.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0505     QCOMPARE( map.preferredRadiusCeil( 1000 ), 1000 );
0506     QCOMPARE( map.preferredRadiusFloor( 1000 ), 1000 );
0507     map.reload(); // don't crash, please
0508 
0509     QThreadPool::globalInstance()->waitForDone();  // wait for all runners to terminate
0510 }
0511 
0512 void MarbleMapTest::setMapThemeIdTwoMaps_data()
0513 {
0514     QTest::addColumn<QString>( "mapThemeId" );
0515 
0516     addRow() << "earth/plain/plain.dgml";
0517     addRow() << "earth/srtm/srtm.dgml";
0518     addRow() << "earth/openstreetmap/openstreetmap.dgml";
0519 }
0520 
0521 void MarbleMapTest::setMapThemeIdTwoMaps()
0522 {
0523     QFETCH( QString, mapThemeId );
0524 
0525     MarbleModel model;
0526     MarbleMap map1( &model );
0527     MarbleMap map2( &model );
0528 
0529     map1.setMapThemeId( mapThemeId );
0530 
0531     QCOMPARE( map1.mapThemeId(), mapThemeId );
0532     QCOMPARE( map2.mapThemeId(), mapThemeId );
0533 
0534     QThreadPool::globalInstance()->waitForDone();  // wait for all runners to terminate
0535 }
0536 
0537 void MarbleMapTest::switchMapThemesTwoMaps()
0538 {
0539     MarbleModel model;
0540     MarbleMap map1( &model );
0541     MarbleMap map2( &model );
0542 
0543     map1.setMapThemeId( "earth/plain/plain.dgml" );
0544     QCOMPARE( map1.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0545     QCOMPARE( map2.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0546 
0547     map2.setMapThemeId( "earth/srtm/srtm.dgml" );
0548     QCOMPARE( map1.mapThemeId(), QString( "earth/srtm/srtm.dgml" ) );
0549     QCOMPARE( map2.mapThemeId(), QString( "earth/srtm/srtm.dgml" ) );
0550 
0551     map1.setMapThemeId( "earth/openstreetmap/openstreetmap.dgml" );
0552     QCOMPARE( map1.mapThemeId(), QString( "earth/openstreetmap/openstreetmap.dgml" ) );
0553     QCOMPARE( map2.mapThemeId(), QString( "earth/openstreetmap/openstreetmap.dgml" ) );
0554 
0555     map2.setMapThemeId( "earth/plain/plain.dgml" );
0556     QCOMPARE( map1.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0557     QCOMPARE( map2.mapThemeId(), QString( "earth/plain/plain.dgml" ) );
0558 
0559     QThreadPool::globalInstance()->waitForDone();  // wait for all runners to terminate
0560 }
0561 
0562 void MarbleMapTest::paint_data()
0563 {
0564     QTest::addColumn<QString>( "mapThemeId" );
0565 
0566     addRow() << "earth/plain/plain.dgml";
0567     addRow() << "earth/srtm/srtm.dgml";
0568     addRow() << "earth/openstreetmap/openstreetmap.dgml";
0569 }
0570 
0571 void MarbleMapTest::paint()
0572 {
0573     QFETCH( QString, mapThemeId );
0574 
0575     MarbleMap map;
0576 
0577     map.setMapThemeId( mapThemeId );
0578     map.setSize( 200, 200 );
0579 
0580     QCOMPARE( map.mapThemeId(), mapThemeId );
0581 
0582     QPixmap paintDevice( map.size() );
0583 
0584     QVERIFY( map.projection() == Spherical );
0585 
0586     GeoPainter painter1( &paintDevice, map.viewport(), map.mapQuality() );
0587     map.paint( painter1, QRect() );
0588 
0589     QThreadPool::globalInstance()->waitForDone();  // wait for all runners to terminate
0590 }
0591 
0592 }
0593 
0594 QTEST_MAIN( Marble::MarbleMapTest )
0595 
0596 #include "MarbleMapTest.moc"