File indexing completed on 2024-09-08 12:12:10
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Calin Cruceru <crucerucalincristian@gmail.com> 0004 // SPDX-FileCopyrightText: 2014 Sanjiban Bairagya <sanjiban22393@gmail.com> 0005 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com> 0006 // 0007 0008 #include <QObject> 0009 0010 #include <MarbleDebug.h> 0011 #include <GeoDataAlias.h> 0012 #include <GeoDataAccuracy.h> 0013 #include <GeoDataSimpleArrayData.h> 0014 #include <GeoDataData.h> 0015 #include <GeoDataExtendedData.h> 0016 #include <GeoDataBalloonStyle.h> 0017 #include <GeoDataCamera.h> 0018 #include <GeoDataColorStyle.h> 0019 #include <GeoDataFlyTo.h> 0020 #include <GeoDataHotSpot.h> 0021 #include <GeoDataImagePyramid.h> 0022 #include <GeoDataItemIcon.h> 0023 #include <GeoDataLink.h> 0024 #include <GeoDataAnimatedUpdate.h> 0025 #include <GeoDataSoundCue.h> 0026 #include "GeoDataPlaylist.h" 0027 #include <GeoDataTourControl.h> 0028 #include <GeoDataWait.h> 0029 #include <GeoDataTour.h> 0030 #include <GeoDataPoint.h> 0031 #include <GeoDataLinearRing.h> 0032 #include <GeoDataLineString.h> 0033 #include <GeoDataPolygon.h> 0034 #include <GeoDataLatLonQuad.h> 0035 #include <GeoDataLatLonAltBox.h> 0036 #include <GeoDataLatLonBox.h> 0037 #include <GeoDataLod.h> 0038 #include <GeoDataRegion.h> 0039 #include <GeoDataIconStyle.h> 0040 #include <GeoDataLabelStyle.h> 0041 #include <GeoDataLineStyle.h> 0042 #include <GeoDataListStyle.h> 0043 #include <GeoDataPolyStyle.h> 0044 #include <GeoDataStyle.h> 0045 #include <GeoDataStyleMap.h> 0046 #include <GeoDataTimeSpan.h> 0047 #include <GeoDataTimeStamp.h> 0048 #include <GeoDataViewVolume.h> 0049 #include <GeoDataVec2.h> 0050 #include <GeoDataScreenOverlay.h> 0051 #include <GeoDataPhotoOverlay.h> 0052 #include <GeoDataGroundOverlay.h> 0053 #include <GeoDataSchema.h> 0054 #include <GeoDataSimpleField.h> 0055 #include <GeoDataScale.h> 0056 #include <GeoDataOrientation.h> 0057 #include <GeoDataLocation.h> 0058 #include <GeoDataResourceMap.h> 0059 #include <GeoDataModel.h> 0060 #include <GeoDataTrack.h> 0061 #include <GeoDataMultiTrack.h> 0062 #include <GeoDataSnippet.h> 0063 #include <GeoDataLookAt.h> 0064 #include <GeoDataNetworkLink.h> 0065 #include <GeoDataNetworkLinkControl.h> 0066 #include <GeoDataFolder.h> 0067 #include <GeoDataSchemaData.h> 0068 #include <GeoDataSimpleData.h> 0069 #include <GeoDataUpdate.h> 0070 #include "TestUtils.h" 0071 0072 using namespace Marble; 0073 0074 class TestEquality : public QObject 0075 { 0076 Q_OBJECT 0077 private Q_SLOTS: 0078 void initTestCase(); 0079 void aliasTest(); 0080 void accuracyTest(); 0081 void simpleArrayDataTest(); 0082 void dataTest(); 0083 void extendedDataTest(); 0084 void balloonTest(); 0085 void colorTest(); 0086 void cameraTest(); 0087 void flyToTest(); 0088 void hotSpotTest(); 0089 void imagePyramidTest(); 0090 void itemIconTest(); 0091 void linkTest(); 0092 void tourTest(); 0093 void pointTest(); 0094 void linearRingTest(); 0095 void lineStringTest(); 0096 void polygonTest(); 0097 void latLonQuadTest(); 0098 void latLonBoxTest(); 0099 void latLonAltBoxTest(); 0100 void lodTest(); 0101 void regionTest(); 0102 void iconStyleTest(); 0103 void lineStyleTest(); 0104 void listStyleTest(); 0105 void polyStyleTest(); 0106 void labelStyleTest(); 0107 void styleTest(); 0108 void styleMapTest(); 0109 void timeSpanTest(); 0110 void timeStampTest(); 0111 void viewVolumeTest(); 0112 void vecTest(); 0113 void screenOverlayTest(); 0114 void photoOverlayTest(); 0115 void groundOverlayTest(); 0116 void simpleFieldTest(); 0117 void schemaTest(); 0118 void scaleTest(); 0119 void orientationTest(); 0120 void locationTest(); 0121 void resourceMapTest(); 0122 void modelTest(); 0123 void trackTest(); 0124 void multiTrackTest(); 0125 void snippetTest(); 0126 void lookAtTest(); 0127 void networkLinkTest(); 0128 void networkLinkControlTest(); 0129 void folderTest(); 0130 void simpleDataTest(); 0131 void schemaDataTest(); 0132 }; 0133 0134 0135 void TestEquality::initTestCase() 0136 { 0137 MarbleDebug::setEnabled( true ); 0138 } 0139 0140 void TestEquality::aliasTest() 0141 { 0142 GeoDataAlias alias; 0143 alias.setSourceHref("test1"); 0144 alias.setTargetHref("test1"); 0145 0146 GeoDataAlias alias2; 0147 alias2.setSourceHref("test1"); 0148 alias2.setTargetHref("test1"); 0149 0150 QCOMPARE( alias, alias ); 0151 QCOMPARE( alias2, alias2 ); 0152 QCOMPARE( alias, alias2 ); 0153 0154 alias.setSourceHref("test2"); 0155 alias2.setSourceHref("Test2"); 0156 QCOMPARE( alias == alias2, false ); 0157 QVERIFY( alias != alias2 ); 0158 0159 alias.setSourceHref("test3"); 0160 alias.setTargetHref("test3"); 0161 alias2.setSourceHref("test3"); 0162 alias2.setTargetHref("test2"); 0163 QCOMPARE( alias == alias2, false ); 0164 0165 alias2.setSourceHref("Test3"); 0166 QVERIFY( alias != alias2 ); 0167 0168 alias.setSourceHref("Test3"); 0169 alias.setTargetHref("test2"); 0170 QCOMPARE( alias, alias2 ); 0171 } 0172 0173 void TestEquality::accuracyTest() 0174 { 0175 GeoDataAccuracy accuracy1, accuracy2; 0176 0177 accuracy1.level = GeoDataAccuracy::Country; 0178 accuracy1.vertical = 2; 0179 accuracy1.horizontal = 3; 0180 accuracy2.level = GeoDataAccuracy::Country; 0181 accuracy2.vertical = 2; 0182 accuracy2.horizontal = 3; 0183 QCOMPARE( accuracy1, accuracy1 ); 0184 QCOMPARE( accuracy2, accuracy2 ); 0185 QCOMPARE( accuracy1, accuracy2 ); 0186 0187 accuracy1.vertical = 1; 0188 QVERIFY( accuracy1 != accuracy2 ); 0189 0190 accuracy1.horizontal = 1; 0191 accuracy2.horizontal = 1; 0192 0193 QCOMPARE( accuracy1 == accuracy2, false ); 0194 } 0195 0196 void TestEquality::simpleArrayDataTest() 0197 { 0198 GeoDataSimpleArrayData simpleArray1, simpleArray2; 0199 0200 simpleArray1.append("Marble"); 0201 simpleArray1.append(2014); 0202 simpleArray1.append("Globe"); 0203 0204 simpleArray2.append("Globe"); 0205 simpleArray2.append(2014); 0206 simpleArray2.append("Marble"); 0207 0208 QCOMPARE( simpleArray1, simpleArray1 ); 0209 QCOMPARE( simpleArray2, simpleArray2 ); 0210 QCOMPARE( simpleArray1 == simpleArray2, false ); 0211 QVERIFY( simpleArray1 != simpleArray2 ); 0212 } 0213 0214 void TestEquality::dataTest() 0215 { 0216 GeoDataData data1, data2; 0217 0218 data1.setName("Something"); 0219 data1.setValue(QVariant(23.56)); 0220 data1.setDisplayName("Marble"); 0221 0222 data2.setName("Something"); 0223 data2.setValue(QVariant(23.56)); 0224 data2.setDisplayName("Marble"); 0225 0226 QCOMPARE( data1, data1 ); 0227 QCOMPARE( data2, data2 ); 0228 QCOMPARE( data1, data2 ); 0229 QCOMPARE( data1 != data2, false ); 0230 0231 data1.setName("Marble"); 0232 data1.setDisplayName("Something"); 0233 0234 QCOMPARE( data1 == data2, false ); 0235 QVERIFY( data1 != data2 ); 0236 } 0237 0238 void TestEquality::extendedDataTest() 0239 { 0240 GeoDataExtendedData extendedData1, extendedData2; 0241 GeoDataData data1, data2; 0242 0243 data1.setName("Something"); 0244 data1.setValue(QVariant(23.56)); 0245 data1.setDisplayName("Marble"); 0246 0247 data2.setName("Marble"); 0248 data2.setValue(QVariant(23.56)); 0249 data2.setDisplayName("Globe"); 0250 0251 extendedData1.addValue(data1); 0252 extendedData2.addValue(data2); 0253 0254 QCOMPARE( extendedData1, extendedData1 ); 0255 QCOMPARE( extendedData2, extendedData2 ); 0256 QCOMPARE( extendedData1 == extendedData2, false ); 0257 QVERIFY( extendedData1 != extendedData2 ); 0258 } 0259 0260 void TestEquality::balloonTest() 0261 { 0262 GeoDataBalloonStyle balloon1, balloon2; 0263 0264 balloon1.setBackgroundColor(Qt::white); 0265 balloon1.setTextColor(Qt::black); 0266 balloon1.setText("Text1"); 0267 balloon1.setDisplayMode(GeoDataBalloonStyle::Hide); 0268 0269 balloon2.setBackgroundColor(Qt::white); 0270 balloon2.setTextColor(Qt::black); 0271 balloon2.setText("Text1"); 0272 balloon2.setDisplayMode(GeoDataBalloonStyle::Hide); 0273 0274 QCOMPARE( balloon1, balloon1 ); 0275 QCOMPARE( balloon2, balloon2 ); 0276 QCOMPARE( balloon1, balloon2 ); 0277 0278 balloon2.setDisplayMode(GeoDataBalloonStyle::Default); 0279 QCOMPARE( balloon1 != balloon2, true ); 0280 0281 balloon1.setDisplayMode(GeoDataBalloonStyle::Default); 0282 balloon1.setText("Text2"); 0283 QCOMPARE( balloon1 == balloon2, false); 0284 0285 QVERIFY( balloon1 != balloon2 ); 0286 } 0287 0288 void TestEquality::colorTest() 0289 { 0290 GeoDataColorStyle color1, color2; 0291 0292 color1.setColor(Qt::white); 0293 color2.setColor(Qt::white); 0294 0295 QCOMPARE( color1, color1 ); 0296 QCOMPARE( color2, color2 ); 0297 QCOMPARE( color1, color2 ); 0298 0299 color1.setId("foo"); 0300 QVERIFY( color1 != color2 ); 0301 color2.setId("foo"); 0302 QCOMPARE( color1, color2 ); 0303 0304 color1.setColorMode(GeoDataColorStyle::Random); 0305 QCOMPARE( color1, color1 ); 0306 QCOMPARE( color2, color2 ); 0307 // Different color mode, so not equal 0308 QVERIFY( color1 != color2 ); 0309 0310 color2.setColorMode(GeoDataColorStyle::Random); 0311 QCOMPARE( color1, color1 ); 0312 QCOMPARE( color2, color2 ); 0313 // Paint colors are now likely different, but we still consider them equal 0314 QCOMPARE( color1, color2 ); 0315 0316 color2.setColor( Qt::yellow ); 0317 QCOMPARE( color1, color1 ); 0318 QCOMPARE( color2, color2 ); 0319 QVERIFY( color1 != color2 ); 0320 } 0321 0322 void TestEquality::cameraTest() 0323 { 0324 GeoDataCamera camera1, camera2; 0325 0326 camera1.setAltitudeMode(Marble::Absolute); 0327 camera1.setAltitude(100); 0328 camera1.setLatitude(100); 0329 camera1.setLongitude(100); 0330 camera1.setHeading(200); 0331 camera1.setRoll(300); 0332 camera1.setTilt(400); 0333 0334 camera2.setAltitudeMode(Marble::ClampToGround); 0335 camera2.setAltitude(100); 0336 camera2.setLatitude(100); 0337 camera2.setLongitude(100); 0338 camera2.setHeading(200); 0339 camera2.setRoll(300); 0340 camera2.setTilt(400); 0341 0342 QCOMPARE( camera1, camera1 ); 0343 QCOMPARE( camera2, camera2 ); 0344 QCOMPARE( camera1 == camera2, false ); 0345 QVERIFY( camera1 != camera2 ); 0346 0347 0348 GeoDataTimeStamp timeStampBegin, timeStampEnd; 0349 QDateTime date1( QDate(2014, 4, 7) ); 0350 0351 timeStampBegin.setWhen( date1 ); 0352 timeStampEnd.setWhen( date1 ); 0353 timeStampBegin.setResolution( GeoDataTimeStamp::YearResolution ); 0354 timeStampEnd.setResolution( GeoDataTimeStamp::YearResolution ); 0355 0356 GeoDataTimeSpan timeSpan1, timeSpan2; 0357 timeSpan1.setBegin( timeStampBegin ); 0358 timeSpan1.setEnd( timeStampEnd ); 0359 timeSpan2.setBegin( timeStampBegin ); 0360 timeSpan2.setEnd( timeStampEnd ); 0361 0362 GeoDataTimeStamp timeStamp1, timeStamp2; 0363 QDateTime date2( QDate(2014, 4, 8) ); 0364 timeStamp1.setWhen( date2 ); 0365 timeStamp2.setWhen( date2 ); 0366 timeStamp1.setResolution( GeoDataTimeStamp::SecondResolution ); 0367 timeStamp2.setResolution( GeoDataTimeStamp::SecondResolution ); 0368 0369 camera1.setTimeSpan( timeSpan1 ); 0370 camera2.setTimeSpan( timeSpan2 ); 0371 camera1.setTimeStamp( timeStamp1 ); 0372 camera2.setTimeStamp( timeStamp2 ); 0373 0374 camera2.setAltitudeMode( Marble::Absolute ); 0375 0376 QCOMPARE( camera1, camera2 ); 0377 QCOMPARE( camera2, camera2 ); 0378 QVERIFY( camera1 == camera2 ); 0379 0380 camera1.setId("camera1"); 0381 camera2.setId("camera2"); 0382 QVERIFY( camera1 != camera2 ); 0383 0384 camera1.setId("camera2"); 0385 QVERIFY( camera1 == camera2 ); 0386 0387 timeStamp1.setResolution( GeoDataTimeStamp::YearResolution ); 0388 camera2.setTimeStamp( timeStamp1 ); 0389 QVERIFY( camera1 != camera2 ); 0390 } 0391 0392 void TestEquality::flyToTest() 0393 { 0394 GeoDataFlyTo flyTo1, flyTo2; 0395 0396 flyTo1.setDuration(7.6); 0397 flyTo1.setFlyToMode(GeoDataFlyTo::Bounce); 0398 0399 flyTo2.setDuration( 5.8 ); 0400 flyTo1.setFlyToMode( GeoDataFlyTo::Smooth ); 0401 0402 QCOMPARE( flyTo1, flyTo1 ); 0403 QCOMPARE( flyTo2, flyTo2 ); 0404 QCOMPARE( flyTo1 == flyTo2, false ); 0405 QVERIFY( flyTo1 != flyTo2 ); 0406 } 0407 0408 void TestEquality::hotSpotTest() 0409 { 0410 QPointF point1, point2; 0411 point1.setX( 5 ); 0412 point1.setY( 4 ); 0413 point2.setX( 6 ); 0414 point2.setY( 2 ); 0415 0416 GeoDataHotSpot hotSpot1, hotSpot2; 0417 hotSpot1.setHotSpot( point1, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction ); 0418 hotSpot2.setHotSpot( point2, GeoDataHotSpot::Pixels, GeoDataHotSpot::Pixels ); 0419 0420 QCOMPARE( &hotSpot1, &hotSpot1 ); 0421 QCOMPARE( &hotSpot2, &hotSpot2 ); 0422 QCOMPARE( hotSpot1 == hotSpot2, false ); 0423 QVERIFY( hotSpot1 != hotSpot2 ); 0424 } 0425 0426 void TestEquality::imagePyramidTest() 0427 { 0428 GeoDataImagePyramid pyramid1, pyramid2; 0429 pyramid1.setGridOrigin( GeoDataImagePyramid::LowerLeft ); 0430 pyramid1.setMaxHeight( 40 ); 0431 pyramid1.setMaxWidth( 30 ); 0432 pyramid1.setTileSize( 20 ); 0433 0434 pyramid2.setGridOrigin( GeoDataImagePyramid::UpperLeft ); 0435 pyramid2.setMaxHeight( 50 ); 0436 pyramid2.setMaxWidth( 80 ); 0437 pyramid2.setTileSize( 30 ); 0438 0439 QCOMPARE( &pyramid1, &pyramid1 ); 0440 QCOMPARE( &pyramid2, &pyramid2 ); 0441 QCOMPARE( pyramid1 == pyramid2, false ); 0442 QVERIFY( pyramid1 != pyramid2 ); 0443 } 0444 0445 void TestEquality::itemIconTest() 0446 { 0447 GeoDataItemIcon icon1, icon2; 0448 QImage img1( 10, 20, QImage::Format_Mono ); 0449 QImage img2( 30, 50, QImage::Format_Mono ); 0450 img1.fill( Qt::green ); 0451 img2.fill( Qt::green ); 0452 0453 icon1.setIcon( img1 ); 0454 icon1.setIconPath( "some/path" ); 0455 icon1.setState( GeoDataItemIcon::Open ); 0456 0457 icon2.setIcon( img2 ); 0458 icon2.setIconPath( "some/other/path" ); 0459 icon2.setState( GeoDataItemIcon::Closed ); 0460 0461 QCOMPARE( &icon1, &icon1 ); 0462 QCOMPARE( &icon2, &icon2 ); 0463 QCOMPARE( &icon1 == &icon2, false ); 0464 QVERIFY( &icon1 != &icon2 ); 0465 0466 } 0467 0468 void TestEquality::linkTest() 0469 { 0470 GeoDataLink link1, link2; 0471 0472 link1.setHref("some/example/href.something"); 0473 link1.setRefreshInterval( 23 ); 0474 link1.setRefreshMode( GeoDataLink::OnChange ); 0475 link1.setViewBoundScale( 50 ); 0476 link1.setViewRefreshTime( 30 ); 0477 0478 link2.setHref("some/other/example/href.something"); 0479 link1.setRefreshInterval( 32 ); 0480 link1.setRefreshMode(GeoDataLink::OnChange); 0481 link1.setViewBoundScale( 60 ); 0482 link1.setViewRefreshTime( 40 ); 0483 0484 QCOMPARE( &link1, &link1 ); 0485 QCOMPARE( &link2, &link2 ); 0486 QCOMPARE( &link1 == &link2, false ); 0487 QVERIFY( &link1 != &link2 ); 0488 } 0489 0490 void TestEquality::tourTest() 0491 { 0492 GeoDataTour tour1; 0493 GeoDataTour tour2; 0494 GeoDataPlaylist* playlist1 = new GeoDataPlaylist; 0495 GeoDataPlaylist* playlist2 = new GeoDataPlaylist; 0496 0497 GeoDataAnimatedUpdate* animatedUpdate1 = new GeoDataAnimatedUpdate; 0498 GeoDataAnimatedUpdate* animatedUpdate2 = new GeoDataAnimatedUpdate; 0499 GeoDataSoundCue* cue1 = new GeoDataSoundCue; 0500 GeoDataSoundCue* cue2 = new GeoDataSoundCue; 0501 GeoDataTourControl* control1 = new GeoDataTourControl; 0502 GeoDataTourControl* control2 = new GeoDataTourControl; 0503 GeoDataWait* wait1 = new GeoDataWait; 0504 GeoDataWait* wait2 = new GeoDataWait; 0505 GeoDataFlyTo* flyTo1 = new GeoDataFlyTo; 0506 GeoDataFlyTo* flyTo2 = new GeoDataFlyTo; 0507 0508 playlist1->addPrimitive( animatedUpdate1 ); 0509 playlist1->addPrimitive( cue1 ); 0510 playlist1->addPrimitive( control1 ); 0511 playlist1->addPrimitive( wait1 ); 0512 playlist1->addPrimitive( flyTo1 ); 0513 0514 playlist2->addPrimitive( animatedUpdate2 ); 0515 playlist2->addPrimitive( cue2 ); 0516 playlist2->addPrimitive( control2 ); 0517 playlist2->addPrimitive( wait2 ); 0518 playlist2->addPrimitive( flyTo2 ); 0519 0520 tour1.setPlaylist( playlist1 ); 0521 tour2.setPlaylist( playlist2 ); 0522 0523 QCOMPARE( tour1, tour1 ); 0524 QCOMPARE( tour2, tour2 ); 0525 QCOMPARE( tour1 != tour2, false ); 0526 QVERIFY( tour1 == tour2 ); 0527 0528 tour1.playlist()->swapPrimitives( 1, 3 ); 0529 0530 QCOMPARE( tour1, tour1 ); 0531 QCOMPARE( tour2, tour2 ); 0532 QCOMPARE( tour1 == tour2, false ); 0533 QVERIFY( tour1 != tour2 ); 0534 0535 tour1.playlist()->swapPrimitives( 1, 3 ); 0536 QVERIFY( tour1 == tour2 ); 0537 0538 GeoDataSoundCue* cue3 = new GeoDataSoundCue; 0539 tour1.playlist()->addPrimitive( cue3 ); 0540 0541 QCOMPARE( tour1, tour1 ); 0542 QCOMPARE( tour2, tour2 ); 0543 QCOMPARE( tour1 == tour2, false ); 0544 QVERIFY( tour1 != tour2 ); 0545 0546 // Test GeoDataFeature properties 0547 tour1.setName( QString("Tour1") ); 0548 tour1.setSnippet( GeoDataSnippet("Text1", 10) ); 0549 tour1.setDescription( QString("Description1") ); 0550 tour1.setDescriptionCDATA( true ); 0551 tour1.setAddress( QString("Address1") ); 0552 tour1.setPhoneNumber( QString("+40768652156") ); 0553 tour1.setStyleUrl( QString("/link/to/style1") ); 0554 tour1.setPopularity( 66666 ); 0555 tour1.setZoomLevel( 10 ); 0556 tour1.setVisible( true ); 0557 tour1.setRole( QString("Role1") ); 0558 0559 GeoDataStyle::Ptr style1(new GeoDataStyle), style2(new GeoDataStyle); 0560 GeoDataIconStyle iconStyle; 0561 QImage icon( 50, 50, QImage::Format_Mono ); 0562 icon.fill( Qt::black ); 0563 QPointF hotSpot = QPointF( 7.6, 6.4 ); 0564 0565 iconStyle.setScale( 1.0 ); 0566 iconStyle.setIconPath( "path/to/icon" ); 0567 iconStyle.setIcon( icon ); 0568 iconStyle.setHotSpot( hotSpot, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction ); 0569 iconStyle.setHeading( 0 ); 0570 0571 GeoDataLabelStyle labelStyle; 0572 labelStyle.setColor( Qt::blue ); 0573 labelStyle.setScale( 1.0 ); 0574 labelStyle.setAlignment( GeoDataLabelStyle::Center ); 0575 labelStyle.setFont( QFont( QStringLiteral( "Helvetica" ), 10 ) ); 0576 0577 GeoDataLineStyle lineStyle; 0578 QVector< qreal > pattern( 5, 6.2 ); 0579 lineStyle.setWidth( 1.2 ); 0580 lineStyle.setPhysicalWidth( 1.0 ); 0581 lineStyle.setCapStyle( Qt::RoundCap ); 0582 lineStyle.setPenStyle( Qt::SolidLine ); 0583 lineStyle.setBackground( false ); 0584 lineStyle.setDashPattern( pattern ); 0585 0586 GeoDataPolyStyle polyStyle; 0587 polyStyle.setColor( Qt::red ); 0588 polyStyle.setFill( false ); 0589 polyStyle.setOutline( false ); 0590 polyStyle.setBrushStyle( Qt::SolidPattern ); 0591 0592 GeoDataBalloonStyle balloon; 0593 balloon.setBackgroundColor(Qt::white); 0594 balloon.setTextColor(Qt::black); 0595 balloon.setText("SomeText"); 0596 balloon.setDisplayMode(GeoDataBalloonStyle::Hide); 0597 0598 GeoDataListStyle listStyle; 0599 listStyle.setListItemType( GeoDataListStyle::Check ); 0600 listStyle.setBackgroundColor( Qt::gray ); 0601 for( int i = 0; i < 5; ++i ) { 0602 GeoDataItemIcon *icon = new GeoDataItemIcon; 0603 QImage img( 20 * ( i + 1 ), 20 * ( i + 1 ), QImage::Format_Mono ); 0604 img.fill( Qt::black ); 0605 icon->setIcon( img ); 0606 icon->setIconPath( QString("path/to/icon") ); 0607 icon->setState( GeoDataItemIcon::Open ); 0608 listStyle.append( icon ); 0609 } 0610 0611 style1->setIconStyle( iconStyle ); 0612 style1->setLineStyle( lineStyle ); 0613 style1->setLabelStyle( labelStyle ); 0614 style1->setPolyStyle( polyStyle ); 0615 style1->setBalloonStyle( balloon ); 0616 style1->setListStyle( listStyle ); 0617 0618 style2 = style1; 0619 0620 GeoDataStyleMap styleMap1, styleMap2; 0621 styleMap1["germany"] = "gst1"; 0622 styleMap1["germany"] = "gst2"; 0623 styleMap1["germany"] = "gst3"; 0624 styleMap1["poland"] = "pst1"; 0625 styleMap1["poland"] = "pst2"; 0626 styleMap1["poland"] = "pst3"; 0627 styleMap1.setLastKey("poland"); 0628 0629 styleMap2 = styleMap1; 0630 0631 0632 GeoDataRegion region1; 0633 GeoDataRegion region2; 0634 GeoDataLatLonAltBox latLonAltBox1; 0635 GeoDataLod lod1; 0636 0637 latLonAltBox1.setEast( 40 ); 0638 latLonAltBox1.setWest( 50 ); 0639 latLonAltBox1.setNorth( 60 ); 0640 latLonAltBox1.setSouth( 70 ); 0641 latLonAltBox1.setRotation( 20 ); 0642 latLonAltBox1.setBoundaries( 70, 80, 50, 60 ); 0643 latLonAltBox1.setMaxAltitude( 100 ); 0644 latLonAltBox1.setMinAltitude( 20 ); 0645 latLonAltBox1.setAltitudeMode( Marble::Absolute ); 0646 0647 region1.setLatLonAltBox( latLonAltBox1 ); 0648 region2.setLatLonAltBox( latLonAltBox1 ); 0649 0650 lod1.setMaxFadeExtent( 20 ); 0651 lod1.setMinFadeExtent( 10 ); 0652 lod1.setMaxLodPixels( 30 ); 0653 lod1.setMinLodPixels( 5 ); 0654 0655 region1.setLod( lod1 ); 0656 region2.setLod( lod1 ); 0657 0658 0659 GeoDataExtendedData extendedData1, extendedData2; 0660 GeoDataData data1; 0661 0662 data1.setName( "Something" ); 0663 data1.setValue( QVariant(23.56) ); 0664 data1.setDisplayName( "Marble" ); 0665 0666 extendedData1.addValue(data1); 0667 extendedData2.addValue(data1); 0668 0669 0670 GeoDataTimeStamp timeStamp1, timeStamp2; 0671 QDateTime date1( QDate(1994, 10, 4) ); 0672 0673 timeStamp1.setWhen( date1 ); 0674 timeStamp1.setResolution( GeoDataTimeStamp::YearResolution ); 0675 timeStamp2 = timeStamp1; 0676 0677 0678 GeoDataCamera camera1, camera2; 0679 0680 camera1.setAltitudeMode(Marble::Absolute); 0681 camera1.setAltitude(100); 0682 camera1.setLatitude(100); 0683 camera1.setLongitude(100); 0684 camera1.setHeading(200); 0685 camera1.setRoll(300); 0686 camera1.setTilt(400); 0687 camera2 = camera1; 0688 0689 tour1.setAbstractView( &camera1 ); 0690 tour1.setTimeStamp( timeStamp1 ); 0691 tour1.setExtendedData( extendedData1 ); 0692 tour1.setRegion( region1 ); 0693 tour1.setStyle( style1 ); 0694 tour1.setStyleMap( &styleMap1 ); 0695 tour2 = tour1; 0696 0697 QCOMPARE( tour1, tour1 ); 0698 QCOMPARE( tour2, tour2 ); 0699 QCOMPARE( tour1 != tour2, false ); 0700 QVERIFY( tour1 == tour2 ); 0701 0702 0703 GeoDataLookAt lookAt; 0704 0705 lookAt.setLatitude( 1.1113 ); 0706 lookAt.setLongitude( 2.33 ); 0707 lookAt.setAltitude( 1500 ); 0708 lookAt.setRange( 500 ); 0709 0710 tour2.setAbstractView( &lookAt ); 0711 QVERIFY( tour1 != tour2 ); 0712 0713 tour1.setAbstractView( &lookAt ); 0714 tour1.setStyleMap( nullptr ); 0715 QVERIFY(tour1 != tour2 ); 0716 0717 tour1.setStyleMap( &styleMap1 ); 0718 QVERIFY( tour1 == tour2 ); 0719 0720 camera2.setRoll(400); 0721 tour1.setAbstractView( &camera2 ); 0722 QVERIFY( tour1 != tour2 ); 0723 } 0724 0725 void TestEquality::pointTest() 0726 { 0727 GeoDataPoint point1, point2; 0728 GeoDataCoordinates coord1, coord2; 0729 0730 coord1.set(100,100,100); 0731 coord2.set(200,200,200); 0732 point1.setCoordinates(coord1); 0733 point2.setCoordinates(coord2); 0734 0735 QVERIFY( point1 != point2 ); 0736 QCOMPARE( point1 != point2, true ); 0737 0738 coord1.set(100,150); 0739 coord2.set(100,150); 0740 point1.setCoordinates(coord1); 0741 point2.setCoordinates(coord2); 0742 0743 QVERIFY( point1 == point2 ); 0744 QCOMPARE( point1, point2 ); 0745 QCOMPARE( point1 == point2, true ); 0746 0747 QVERIFY( point1 == point1 ); 0748 QCOMPARE( point1, point2 ); 0749 } 0750 0751 void TestEquality::linearRingTest() 0752 { 0753 GeoDataLinearRing linearRing1, linearRing2; 0754 GeoDataCoordinates coord1, coord2, coord3, coord4, coord5, coord6; 0755 0756 coord1.set(123,100); 0757 coord2.set(124,101); 0758 coord3.set(123,100); 0759 coord4.set(123,100); 0760 coord5.set(124,101); 0761 coord6.set(123,100); 0762 0763 linearRing1.append(coord1); 0764 linearRing1.append(coord2); 0765 linearRing1.append(coord3); 0766 linearRing2.append(coord4); 0767 linearRing2.append(coord5); 0768 linearRing2.append(coord6); 0769 linearRing1.setTessellate(false); 0770 linearRing2.setTessellate(false); 0771 0772 QVERIFY( linearRing1 == linearRing2 ); 0773 QCOMPARE( linearRing1 != linearRing2, false ); 0774 0775 linearRing2.clear(); 0776 linearRing2.append(coord1); 0777 linearRing2.append(coord3); 0778 linearRing2.append(coord4); 0779 0780 QVERIFY( linearRing1 != linearRing2 ); 0781 QCOMPARE( linearRing1 == linearRing2, false ); 0782 } 0783 0784 void TestEquality::lineStringTest() 0785 { 0786 GeoDataLineString lineString1, lineString2; 0787 GeoDataCoordinates coord1, coord2, coord3, coord4, coord5, coord6; 0788 0789 coord1.set(100,100,100); 0790 coord2.set(-100,-100,-100); 0791 coord3.set(50,50,50); 0792 coord4.set(150,150,150); 0793 coord5.set(-150,-150,-150); 0794 coord6.set(-50,-50,-50); 0795 0796 lineString1.append(coord1); 0797 lineString1.append(coord3); 0798 lineString1.append(coord4); 0799 lineString2.append(coord2); 0800 lineString2.append(coord5); 0801 lineString2.append(coord6); 0802 lineString1.setTessellate(false); 0803 lineString2.setTessellate(false); 0804 0805 QVERIFY( lineString1 != lineString2 ); 0806 QCOMPARE( lineString1 == lineString2, false ); 0807 0808 lineString2.clear(); 0809 lineString2.append(coord1); 0810 lineString2.append(coord3); 0811 lineString2.append(coord4); 0812 0813 QVERIFY( lineString1 == lineString2 ); 0814 QCOMPARE( lineString1 != lineString2, false ); 0815 } 0816 0817 void TestEquality::polygonTest() 0818 { 0819 GeoDataPolygon polygon1, polygon2; 0820 0821 GeoDataLinearRing outerBoundary1, outerBoundary2; 0822 GeoDataCoordinates coord1, coord2, coord3, coord4, coord5, coord6; 0823 0824 coord1.set(623,600); 0825 coord2.set(624,601); 0826 coord3.set(623,600); 0827 coord4.set(623,600); 0828 coord5.set(624,601); 0829 coord6.set(623,600); 0830 0831 outerBoundary1.append(coord1); 0832 outerBoundary1.append(coord2); 0833 outerBoundary1.append(coord3); 0834 outerBoundary2.append(coord4); 0835 outerBoundary2.append(coord5); 0836 outerBoundary2.append(coord6); 0837 outerBoundary1.setTessellate(true); 0838 outerBoundary2.setTessellate(true); 0839 polygon1.setOuterBoundary(outerBoundary1); 0840 polygon2.setOuterBoundary(outerBoundary2); 0841 0842 0843 GeoDataLinearRing innerBoundary11, innerBoundary12, innerBoundary21, innerBoundary22; 0844 GeoDataCoordinates coord111, coord112, coord113, coord121, coord122, coord123; 0845 GeoDataCoordinates coord211, coord212, coord213, coord221, coord222, coord223; 0846 0847 coord111.set(100,100); 0848 coord112.set(200,200); 0849 coord113.set(100,100); 0850 coord121.set(400,400); 0851 coord122.set(500,500); 0852 coord123.set(400,400); 0853 coord211.set(100,100); 0854 coord212.set(200,200); 0855 coord213.set(100,100); 0856 coord221.set(400,400); 0857 coord222.set(500,500); 0858 coord223.set(400,400); 0859 0860 innerBoundary11.append(coord111); 0861 innerBoundary11.append(coord112); 0862 innerBoundary11.append(coord113); 0863 innerBoundary12.append(coord121); 0864 innerBoundary12.append(coord122); 0865 innerBoundary12.append(coord123); 0866 innerBoundary21.append(coord211); 0867 innerBoundary21.append(coord212); 0868 innerBoundary21.append(coord213); 0869 innerBoundary22.append(coord221); 0870 innerBoundary22.append(coord222); 0871 innerBoundary22.append(coord223); 0872 innerBoundary11.setTessellate(true); 0873 innerBoundary12.setTessellate(true); 0874 innerBoundary21.setTessellate(true); 0875 innerBoundary22.setTessellate(true); 0876 0877 polygon1.appendInnerBoundary(innerBoundary11); 0878 polygon1.appendInnerBoundary(innerBoundary12); 0879 polygon2.appendInnerBoundary(innerBoundary21); 0880 polygon2.appendInnerBoundary(innerBoundary22); 0881 polygon1.setTessellate(true); 0882 polygon2.setTessellate(true); 0883 0884 QVERIFY( polygon1 == polygon2 ); 0885 QCOMPARE( polygon1 != polygon2, false ); 0886 0887 polygon1.setTessellate(false); 0888 QVERIFY( polygon1 != polygon2 ); 0889 0890 polygon1.setTessellate(true); 0891 polygon1.appendInnerBoundary(innerBoundary11); 0892 QVERIFY( polygon1 != polygon2 ); 0893 0894 QCOMPARE( polygon1 == polygon2, false ); 0895 0896 /* Prepare for inequality test */ 0897 polygon2.appendInnerBoundary(innerBoundary11); 0898 QVERIFY( polygon1 == polygon2 ); 0899 0900 /* Test for inequality: make sure polygon's coordinates are not equal */ 0901 polygon2.appendInnerBoundary(innerBoundary11); 0902 coord111.set(100,1); 0903 innerBoundary11.clear(); 0904 innerBoundary11.append(coord111); 0905 innerBoundary11.append(coord112); 0906 innerBoundary11.append(coord113); 0907 innerBoundary11.setTessellate(true); 0908 polygon1.appendInnerBoundary(innerBoundary11); 0909 0910 QVERIFY( polygon1 != polygon2 ); 0911 QCOMPARE( polygon1 == polygon2, false ); 0912 } 0913 0914 void TestEquality::latLonQuadTest() 0915 { 0916 GeoDataLatLonQuad quad1, quad2; 0917 quad1.setBottomLeftLatitude( 55, GeoDataCoordinates::Degree ); 0918 quad1.setBottomLeftLongitude( 60, GeoDataCoordinates::Degree ); 0919 quad1.setBottomRightLatitude( 45, GeoDataCoordinates::Degree ); 0920 quad1.setBottomRightLongitude( 50, GeoDataCoordinates::Degree ); 0921 0922 quad1.setTopLeftLatitude( 55, GeoDataCoordinates::Degree ); 0923 quad1.setTopLeftLongitude( 60, GeoDataCoordinates::Degree ); 0924 quad1.setTopRightLatitude( 45, GeoDataCoordinates::Degree ); 0925 quad1.setTopRightLongitude( 50, GeoDataCoordinates::Degree ); 0926 0927 quad2.setBottomLeftLatitude( 55, GeoDataCoordinates::Degree ); 0928 quad2.setBottomLeftLongitude( 60, GeoDataCoordinates::Degree ); 0929 quad2.setBottomRightLatitude( 45, GeoDataCoordinates::Degree ); 0930 quad2.setBottomRightLongitude( 50, GeoDataCoordinates::Degree ); 0931 0932 quad2.setTopLeftLatitude( 55, GeoDataCoordinates::Degree ); 0933 quad2.setTopLeftLongitude( 60, GeoDataCoordinates::Degree ); 0934 quad2.setTopRightLatitude( 45, GeoDataCoordinates::Degree ); 0935 quad2.setTopRightLongitude( 50, GeoDataCoordinates::Degree ); 0936 0937 QCOMPARE( quad1, quad1 ); 0938 QCOMPARE( quad2, quad2 ); 0939 QCOMPARE( quad1 != quad2, false ); 0940 QVERIFY( quad1 == quad2 ); 0941 0942 quad1.setTopLeftLatitude( 65, GeoDataCoordinates::Degree ); 0943 0944 QCOMPARE( quad1, quad1 ); 0945 QCOMPARE( quad2, quad2 ); 0946 QCOMPARE( quad1 == quad2, false ); 0947 QVERIFY( quad1 != quad2 ); 0948 } 0949 0950 void TestEquality::latLonBoxTest() 0951 { 0952 GeoDataLatLonBox latLonBox1, latLonBox2; 0953 0954 latLonBox1.setEast( 40 ); 0955 latLonBox1.setWest( 50 ); 0956 latLonBox1.setNorth( 60 ); 0957 latLonBox1.setSouth( 70 ); 0958 latLonBox1.setRotation( 20 ); 0959 latLonBox1.setBoundaries( 70, 80, 50, 60 ); 0960 0961 latLonBox2.setEast( 40 ); 0962 latLonBox2.setWest( 50 ); 0963 latLonBox2.setNorth( 60 ); 0964 latLonBox2.setSouth( 70 ); 0965 latLonBox2.setRotation( 20 ); 0966 latLonBox2.setBoundaries( 70, 80, 50, 60 ); 0967 0968 QCOMPARE( latLonBox1, latLonBox1 ); 0969 QCOMPARE( latLonBox2, latLonBox2 ); 0970 QCOMPARE( latLonBox1 != latLonBox2, false ); 0971 QVERIFY( latLonBox1 == latLonBox2 ); 0972 0973 latLonBox2.setWest( 55 ); 0974 0975 QCOMPARE( latLonBox1, latLonBox1 ); 0976 QCOMPARE( latLonBox2, latLonBox2 ); 0977 QCOMPARE( latLonBox1 == latLonBox2, false ); 0978 QVERIFY( latLonBox1 != latLonBox2 ); 0979 } 0980 0981 void TestEquality::latLonAltBoxTest() 0982 { 0983 GeoDataLatLonAltBox latLonAltBox1, latLonAltBox2; 0984 0985 latLonAltBox1.setEast( 40 ); 0986 latLonAltBox1.setWest( 50 ); 0987 latLonAltBox1.setNorth( 60 ); 0988 latLonAltBox1.setSouth( 70 ); 0989 latLonAltBox1.setRotation( 20 ); 0990 latLonAltBox1.setBoundaries( 70, 80, 50, 60 ); 0991 latLonAltBox1.setMaxAltitude( 100 ); 0992 latLonAltBox1.setMinAltitude( 20 ); 0993 latLonAltBox1.setAltitudeMode( Marble::Absolute ); 0994 0995 latLonAltBox2.setEast( 40 ); 0996 latLonAltBox2.setWest( 50 ); 0997 latLonAltBox2.setNorth( 60 ); 0998 latLonAltBox2.setSouth( 70 ); 0999 latLonAltBox2.setRotation( 20 ); 1000 latLonAltBox2.setBoundaries( 70, 80, 50, 60 ); 1001 latLonAltBox2.setMaxAltitude( 100 ); 1002 latLonAltBox2.setMinAltitude( 20 ); 1003 latLonAltBox2.setAltitudeMode( Marble::Absolute ); 1004 1005 QCOMPARE( latLonAltBox1, latLonAltBox1 ); 1006 QCOMPARE( latLonAltBox2, latLonAltBox2 ); 1007 QCOMPARE( latLonAltBox1 != latLonAltBox2, false ); 1008 QVERIFY( latLonAltBox1 == latLonAltBox2 ); 1009 1010 latLonAltBox2.setEast( 30 ); 1011 1012 QCOMPARE( latLonAltBox1, latLonAltBox1 ); 1013 QCOMPARE( latLonAltBox2, latLonAltBox2 ); 1014 QCOMPARE( latLonAltBox1 == latLonAltBox2, false ); 1015 QVERIFY( latLonAltBox1 != latLonAltBox2 ); 1016 } 1017 1018 void TestEquality::lodTest() 1019 { 1020 GeoDataLod lod1, lod2; 1021 lod1.setMaxFadeExtent( 20 ); 1022 lod1.setMinFadeExtent( 10 ); 1023 lod1.setMaxLodPixels( 30 ); 1024 lod1.setMinLodPixels( 5 ); 1025 1026 lod2.setMaxFadeExtent( 20 ); 1027 lod2.setMinFadeExtent( 10 ); 1028 lod2.setMaxLodPixels( 30 ); 1029 lod2.setMinLodPixels( 5 ); 1030 1031 QCOMPARE( lod1, lod1 ); 1032 QCOMPARE( lod2, lod2 ); 1033 QCOMPARE( lod1 != lod2, false ); 1034 QVERIFY( lod1 == lod2 ); 1035 1036 lod2.setMaxFadeExtent( 30 ); 1037 1038 QCOMPARE( lod1, lod1 ); 1039 QCOMPARE( lod2, lod2 ); 1040 QCOMPARE( lod1 == lod2, false ); 1041 QVERIFY( lod1 != lod2 ); 1042 } 1043 1044 void TestEquality::regionTest() 1045 { 1046 GeoDataRegion region1; 1047 GeoDataRegion region2; 1048 1049 GeoDataLatLonAltBox latLonAltBox1; 1050 GeoDataLatLonAltBox latLonAltBox2; 1051 1052 latLonAltBox1.setEast( 40 ); 1053 latLonAltBox1.setWest( 50 ); 1054 latLonAltBox1.setNorth( 60 ); 1055 latLonAltBox1.setSouth( 70 ); 1056 latLonAltBox1.setRotation( 20 ); 1057 latLonAltBox1.setBoundaries( 70, 80, 50, 60 ); 1058 latLonAltBox1.setMaxAltitude( 100 ); 1059 latLonAltBox1.setMinAltitude( 20 ); 1060 latLonAltBox1.setAltitudeMode( Marble::Absolute ); 1061 1062 latLonAltBox2.setEast( 40 ); 1063 latLonAltBox2.setWest( 50 ); 1064 latLonAltBox2.setNorth( 60 ); 1065 latLonAltBox2.setSouth( 70 ); 1066 latLonAltBox2.setRotation( 20 ); 1067 latLonAltBox2.setBoundaries( 70, 80, 50, 60 ); 1068 latLonAltBox2.setMaxAltitude( 100 ); 1069 latLonAltBox2.setMinAltitude( 20 ); 1070 latLonAltBox2.setAltitudeMode( Marble::Absolute ); 1071 1072 region1.setLatLonAltBox( latLonAltBox1 ); 1073 region2.setLatLonAltBox( latLonAltBox2 ); 1074 1075 GeoDataLod lod1; 1076 GeoDataLod lod2; 1077 lod1.setMaxFadeExtent( 20 ); 1078 lod1.setMinFadeExtent( 10 ); 1079 lod1.setMaxLodPixels( 30 ); 1080 lod1.setMinLodPixels( 5 ); 1081 1082 lod2.setMaxFadeExtent( 20 ); 1083 lod2.setMinFadeExtent( 10 ); 1084 lod2.setMaxLodPixels( 30 ); 1085 lod2.setMinLodPixels( 5 ); 1086 1087 region1.setLod( lod1 ); 1088 region2.setLod( lod2 ); 1089 1090 QCOMPARE( region1, region1 ); 1091 QCOMPARE( region2, region2 ); 1092 QCOMPARE( region1 != region2, false ); 1093 QVERIFY( region1 == region2 ); 1094 1095 region2.lod().setMaxFadeExtent( 30 ); 1096 1097 QCOMPARE( region1, region1 ); 1098 QCOMPARE( region2, region2 ); 1099 QCOMPARE( region1 == region2, false ); 1100 QVERIFY( region1 != region2 ); 1101 } 1102 1103 void TestEquality::timeSpanTest() 1104 { 1105 GeoDataTimeSpan timeSpan1, timeSpan2; 1106 GeoDataTimeStamp timeStampBegin, timeStampEnd; 1107 1108 QDateTime date1( QDate(2014, 1, 10) ), date2( QDate(2014, 4, 21) ); 1109 1110 timeStampBegin.setWhen( date1 ); 1111 timeStampEnd.setWhen( date2 ); 1112 timeStampBegin.setResolution( GeoDataTimeStamp::DayResolution ); 1113 timeStampEnd.setResolution( GeoDataTimeStamp::DayResolution ); 1114 1115 timeSpan1.setBegin( timeStampBegin ); 1116 timeSpan1.setEnd( timeStampEnd ); 1117 timeSpan2.setBegin( timeStampBegin ); 1118 timeSpan2.setEnd( timeStampBegin ); 1119 1120 QCOMPARE( timeSpan1, timeSpan1 ); 1121 QCOMPARE( timeSpan2, timeSpan2 ); 1122 QCOMPARE( timeSpan1 == timeSpan2, false ); 1123 QVERIFY( timeSpan1 != timeSpan2 ); 1124 1125 timeSpan2.setEnd( timeStampEnd ); 1126 1127 timeSpan1.setTargetId("timeSpan2"); 1128 timeSpan2.setTargetId("timeSpan1"); 1129 QVERIFY( timeSpan1 != timeSpan2 ); 1130 1131 timeSpan1.setTargetId("timeSpan1"); 1132 QVERIFY( timeSpan1 == timeSpan2 ); 1133 } 1134 1135 void TestEquality::timeStampTest() 1136 { 1137 GeoDataTimeStamp timeStamp1, timeStamp2; 1138 QDateTime date1( QDate(1994, 10, 4) ), date2( QDate(2070, 10, 4) ); 1139 1140 timeStamp1.setWhen( date1 ); 1141 timeStamp2.setWhen( date2 ); 1142 timeStamp1.setResolution( GeoDataTimeStamp::YearResolution ); 1143 timeStamp2.setResolution( GeoDataTimeStamp::DayResolution ); 1144 1145 QCOMPARE( timeStamp1, timeStamp1 ); 1146 QCOMPARE( timeStamp2, timeStamp2 ); 1147 QCOMPARE( timeStamp1 == timeStamp2, false ); 1148 QVERIFY( timeStamp1 != timeStamp2 ); 1149 1150 timeStamp2.setWhen( date1 ); 1151 timeStamp1.setResolution( GeoDataTimeStamp::DayResolution ); 1152 1153 timeStamp1.setId("timeStamp1"); 1154 timeStamp2.setId("timeStamp2"); 1155 QVERIFY( timeStamp1 != timeStamp2 ); 1156 1157 timeStamp1.setId("timeStamp2"); 1158 QVERIFY( timeStamp1 == timeStamp2 ); 1159 } 1160 1161 void TestEquality::iconStyleTest() 1162 { 1163 GeoDataIconStyle iconStyle1, iconStyle2; 1164 QImage icon( 50, 50, QImage::Format_Mono ); 1165 icon.fill( Qt::black ); 1166 QPointF hotSpot = QPointF( 6.7, 4.6 ); 1167 1168 iconStyle1.setScale( 1.0 ); 1169 iconStyle1.setIconPath( "path/to/icon" ); 1170 iconStyle1.setIcon( icon ); 1171 iconStyle1.setHotSpot( hotSpot, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction ); 1172 iconStyle1.setHeading( 0 ); 1173 1174 iconStyle2.setScale( 1.0 ); 1175 iconStyle2.setIconPath( "path/to/icon" ); 1176 iconStyle2.setIcon( icon ); 1177 iconStyle2.setHotSpot( hotSpot, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction ); 1178 iconStyle2.setHeading( 0 ); 1179 1180 QCOMPARE( iconStyle1, iconStyle1 ); 1181 QCOMPARE( iconStyle2, iconStyle2 ); 1182 QCOMPARE( iconStyle1 != iconStyle2, false ); 1183 QVERIFY( iconStyle1 == iconStyle2 ); 1184 1185 iconStyle2.setHeading( 1 ); 1186 iconStyle2.setScale( 2.0 ); 1187 1188 QCOMPARE( iconStyle1, iconStyle1 ); 1189 QCOMPARE( iconStyle2, iconStyle2 ); 1190 QCOMPARE( iconStyle1 == iconStyle2, false ); 1191 QVERIFY( iconStyle1 != iconStyle2 ); 1192 1193 } 1194 1195 void TestEquality::lineStyleTest() 1196 { 1197 GeoDataLineStyle lineStyle1, lineStyle2; 1198 QVector< qreal > pattern( 7, 7.8 ); 1199 1200 lineStyle1.setWidth( 1.3 ); 1201 lineStyle1.setPhysicalWidth( 1.0 ); 1202 lineStyle1.setCapStyle( Qt::RoundCap ); 1203 lineStyle1.setPenStyle( Qt::SolidLine ); 1204 lineStyle1.setBackground( false ); 1205 lineStyle1.setDashPattern( pattern ); 1206 1207 lineStyle2.setWidth( 1.3 ); 1208 lineStyle2.setPhysicalWidth( 1.0 ); 1209 lineStyle2.setCapStyle( Qt::RoundCap ); 1210 lineStyle2.setPenStyle( Qt::SolidLine ); 1211 lineStyle2.setBackground( false ); 1212 lineStyle2.setDashPattern( pattern ); 1213 1214 QCOMPARE( lineStyle1, lineStyle2 ); 1215 QCOMPARE( lineStyle2, lineStyle2 ); 1216 QCOMPARE( lineStyle1 != lineStyle2, false ); 1217 QVERIFY( lineStyle1 == lineStyle2 ); 1218 1219 lineStyle2.setCapStyle( Qt::FlatCap ); 1220 lineStyle2.setBackground( true ); 1221 1222 QCOMPARE( lineStyle1, lineStyle1 ); 1223 QCOMPARE( lineStyle2, lineStyle2 ); 1224 QCOMPARE( lineStyle1 == lineStyle2, false ); 1225 QVERIFY( lineStyle1 != lineStyle2 ); 1226 } 1227 1228 void TestEquality::listStyleTest() 1229 { 1230 GeoDataListStyle listStyle1, listStyle2; 1231 1232 listStyle1.setListItemType( GeoDataListStyle::Check ); 1233 listStyle1.setBackgroundColor( Qt::gray ); 1234 for( int i = 0; i < 5; ++i ) { 1235 GeoDataItemIcon *icon = new GeoDataItemIcon; 1236 QImage img( 10 * ( i + 1 ), 10 * ( i + 1 ), QImage::Format_Mono ); 1237 img.fill( Qt::black ); 1238 icon->setIcon( img ); 1239 icon->setIconPath( QString("path/to/icon") ); 1240 icon->setState( GeoDataItemIcon::Open ); 1241 listStyle1.append( icon ); 1242 } 1243 1244 listStyle2.setListItemType( GeoDataListStyle::Check ); 1245 listStyle2.setBackgroundColor( Qt::gray ); 1246 for( int i = 0; i < 5; ++i ) { 1247 GeoDataItemIcon *icon = new GeoDataItemIcon; 1248 QImage img( 10 * ( i + 1 ), 10 * ( i + 1 ), QImage::Format_Mono ); 1249 img.fill( Qt::black ); 1250 icon->setIcon( img ); 1251 icon->setIconPath( QString("path/to/icon") ); 1252 icon->setState( GeoDataItemIcon::Open ); 1253 listStyle2.append( icon ); 1254 } 1255 1256 QCOMPARE( listStyle1, listStyle1 ); 1257 QCOMPARE( listStyle2, listStyle2 ); 1258 QCOMPARE( listStyle1 != listStyle2, false ); 1259 QVERIFY( listStyle1 == listStyle2 ); 1260 1261 listStyle2.setBackgroundColor( Qt::green ); 1262 listStyle2.setListItemType( GeoDataListStyle::RadioFolder ); 1263 1264 QCOMPARE( listStyle1, listStyle1 ); 1265 QCOMPARE( listStyle2, listStyle2 ); 1266 QCOMPARE( listStyle1 == listStyle2, false ); 1267 QVERIFY( listStyle1 != listStyle2 ); 1268 } 1269 1270 void TestEquality::polyStyleTest() 1271 { 1272 GeoDataPolyStyle polyStyle1, polyStyle2; 1273 1274 polyStyle1.setColor( Qt::red ); 1275 polyStyle1.setFill( false ); 1276 polyStyle1.setOutline( false ); 1277 polyStyle1.setBrushStyle( Qt::SolidPattern ); 1278 1279 polyStyle2.setColor( Qt::red ); 1280 polyStyle2.setFill( false ); 1281 polyStyle2.setOutline( false ); 1282 polyStyle2.setBrushStyle( Qt::SolidPattern ); 1283 1284 QCOMPARE( polyStyle1, polyStyle1 ); 1285 QCOMPARE( polyStyle2, polyStyle2 ); 1286 QCOMPARE( polyStyle1 != polyStyle2, false ); 1287 QVERIFY( polyStyle1 == polyStyle2 ); 1288 1289 polyStyle2.setOutline( true ); 1290 polyStyle2.setBrushStyle( Qt::CrossPattern ); 1291 1292 QCOMPARE( polyStyle1, polyStyle1 ); 1293 QCOMPARE( polyStyle2, polyStyle2 ); 1294 QCOMPARE( polyStyle1 == polyStyle2, false ); 1295 QVERIFY( polyStyle1 != polyStyle2 ); 1296 } 1297 1298 void TestEquality::labelStyleTest() 1299 { 1300 GeoDataLabelStyle labelStyle1, labelStyle2; 1301 1302 labelStyle1.setColor( Qt::blue ); 1303 labelStyle1.setScale( 1.0 ); 1304 labelStyle1.setAlignment( GeoDataLabelStyle::Center ); 1305 labelStyle1.setFont( QFont( QStringLiteral( "Helvetica" ), 10 ) ); 1306 1307 labelStyle2.setColor( Qt::blue ); 1308 labelStyle2.setScale( 1.0 ); 1309 labelStyle2.setAlignment( GeoDataLabelStyle::Center ); 1310 labelStyle2.setFont( QFont( QStringLiteral( "Helvetica" ), 10 ) ); 1311 1312 QCOMPARE( labelStyle1, labelStyle1 ); 1313 QCOMPARE( labelStyle2, labelStyle2 ); 1314 QCOMPARE( labelStyle1 != labelStyle2, false ); 1315 QVERIFY( labelStyle1 == labelStyle2); 1316 1317 labelStyle2.setAlignment( GeoDataLabelStyle::Corner ); 1318 labelStyle2.setFont( QFont( QStringLiteral( "Helvetica [Cronyx]" ), 12 ) ); 1319 1320 QCOMPARE( labelStyle1, labelStyle1 ); 1321 QCOMPARE( labelStyle2, labelStyle2 ); 1322 QCOMPARE( labelStyle1 == labelStyle2, false); 1323 QVERIFY( labelStyle1 != labelStyle2 ); 1324 } 1325 1326 void TestEquality::styleTest() 1327 { 1328 GeoDataStyle style1, style2; 1329 GeoDataIconStyle iconStyle; 1330 QImage icon( 50, 50, QImage::Format_Mono ); 1331 icon.fill( Qt::black ); 1332 QPointF hotSpot = QPointF( 7.6, 6.4 ); 1333 1334 iconStyle.setScale( 1.0 ); 1335 iconStyle.setIconPath( "path/to/icon" ); 1336 iconStyle.setIcon( icon ); 1337 iconStyle.setHotSpot( hotSpot, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction ); 1338 iconStyle.setHeading( 0 ); 1339 1340 GeoDataLabelStyle labelStyle; 1341 labelStyle.setColor( Qt::blue ); 1342 labelStyle.setScale( 1.0 ); 1343 labelStyle.setAlignment( GeoDataLabelStyle::Center ); 1344 labelStyle.setFont( QFont( QStringLiteral( "Helvetica" ), 10 ) ); 1345 1346 GeoDataLineStyle lineStyle; 1347 QVector< qreal > pattern( 5, 6.2 ); 1348 lineStyle.setWidth( 1.2 ); 1349 lineStyle.setPhysicalWidth( 1.0 ); 1350 lineStyle.setCapStyle( Qt::RoundCap ); 1351 lineStyle.setPenStyle( Qt::SolidLine ); 1352 lineStyle.setBackground( false ); 1353 lineStyle.setDashPattern( pattern ); 1354 1355 GeoDataPolyStyle polyStyle; 1356 polyStyle.setColor( Qt::red ); 1357 polyStyle.setFill( false ); 1358 polyStyle.setOutline( false ); 1359 polyStyle.setBrushStyle( Qt::SolidPattern ); 1360 1361 GeoDataBalloonStyle balloon; 1362 balloon.setBackgroundColor(Qt::white); 1363 balloon.setTextColor(Qt::black); 1364 balloon.setText("SomeText"); 1365 balloon.setDisplayMode(GeoDataBalloonStyle::Hide); 1366 1367 GeoDataListStyle listStyle; 1368 listStyle.setListItemType( GeoDataListStyle::Check ); 1369 listStyle.setBackgroundColor( Qt::gray ); 1370 for( int i = 0; i < 5; ++i ) { 1371 GeoDataItemIcon *icon = new GeoDataItemIcon; 1372 QImage img( 20 * ( i + 1 ), 20 * ( i + 1 ), QImage::Format_Mono ); 1373 img.fill( Qt::black ); 1374 icon->setIcon( img ); 1375 icon->setIconPath( QString("path/to/icon") ); 1376 icon->setState( GeoDataItemIcon::Open ); 1377 listStyle.append( icon ); 1378 } 1379 1380 style1.setIconStyle( iconStyle ); 1381 style1.setLineStyle( lineStyle ); 1382 style1.setLabelStyle( labelStyle ); 1383 style1.setPolyStyle( polyStyle ); 1384 style1.setBalloonStyle( balloon ); 1385 style1.setListStyle( listStyle ); 1386 1387 style2.setIconStyle( iconStyle ); 1388 style2.setLineStyle( lineStyle ); 1389 style2.setLabelStyle( labelStyle ); 1390 style2.setPolyStyle( polyStyle ); 1391 style2.setBalloonStyle( balloon ); 1392 style2.setListStyle( listStyle ); 1393 1394 QCOMPARE( style1, style1 ); 1395 QCOMPARE( style2, style2 ); 1396 QCOMPARE( style1 != style2, false ); 1397 QVERIFY( style1 == style2 ); 1398 1399 iconStyle.setScale( 2.0 ); 1400 labelStyle.setAlignment( GeoDataLabelStyle::Corner ); 1401 lineStyle.setBackground( true ); 1402 polyStyle.setOutline( true ); 1403 1404 style2.setIconStyle( iconStyle ); 1405 style2.setLabelStyle( labelStyle ); 1406 style2.setLineStyle( lineStyle ); 1407 style2.setPolyStyle( polyStyle ); 1408 1409 QCOMPARE( style1, style1 ); 1410 QCOMPARE( style2, style2 ); 1411 QCOMPARE( style1 == style2, false ); 1412 QVERIFY( style1 != style2 ); 1413 } 1414 1415 void TestEquality::styleMapTest() 1416 { 1417 GeoDataStyleMap styleMap1, styleMap2; 1418 styleMap1["germany"] = "gst1"; 1419 styleMap1["germany"] = "gst2"; 1420 styleMap1["germany"] = "gst3"; 1421 styleMap1["poland"] = "pst1"; 1422 styleMap1["poland"] = "pst2"; 1423 styleMap1["poland"] = "pst3"; 1424 styleMap1.setLastKey("poland"); 1425 1426 styleMap2["germany"] = "gst1"; 1427 styleMap2["germany"] = "gst2"; 1428 styleMap2["germany"] = "gst3"; 1429 styleMap2["poland"] = "pst1"; 1430 styleMap2["poland"] = "pst2"; 1431 styleMap2["poland"] = "pst3"; 1432 styleMap2.setLastKey("poland"); 1433 1434 QCOMPARE( styleMap1, styleMap1 ); 1435 QCOMPARE( styleMap2, styleMap2 ); 1436 QCOMPARE( styleMap1 != styleMap2, false ); 1437 1438 styleMap2.insert("Romania", "rst1"); 1439 styleMap2.insert("Romania", "rst2"); 1440 styleMap2.insert("Romania", "rst3"); 1441 styleMap2.setLastKey("Romania"); 1442 1443 QCOMPARE( styleMap1, styleMap1 ); 1444 QCOMPARE( styleMap2, styleMap2 ); 1445 QCOMPARE( styleMap1 == styleMap2, false ); 1446 QVERIFY( styleMap1 != styleMap2 ); 1447 } 1448 1449 void TestEquality::viewVolumeTest() 1450 { 1451 GeoDataViewVolume volume1, volume2; 1452 1453 volume1.setLeftFov( 5.6 ); 1454 volume1.setRightFov( 6.5 ); 1455 volume1.setTopFov( 2.3 ); 1456 volume1.setBottomFov( 9.2 ); 1457 volume1.setNear( 8.6 ); 1458 1459 volume2.setLeftFov( 5.6 ); 1460 volume2.setRightFov( 6.5 ); 1461 volume2.setTopFov( 2.3 ); 1462 volume2.setBottomFov( 9.2 ); 1463 volume2.setNear( 8.6 ); 1464 1465 QCOMPARE( volume1, volume1 ); 1466 QCOMPARE( volume2, volume2 ); 1467 QCOMPARE( volume1 != volume2, false ); 1468 QVERIFY( volume1 == volume2 ); 1469 1470 volume2.setRightFov( 7.3 ); 1471 1472 QCOMPARE( volume1, volume1 ); 1473 QCOMPARE( volume2, volume2 ); 1474 QCOMPARE( volume1 == volume2, false ); 1475 QVERIFY( volume1 != volume2 ); 1476 } 1477 1478 void TestEquality::vecTest() 1479 { 1480 GeoDataVec2 vec1, vec2; 1481 1482 vec1.setXunits( GeoDataVec2::Fraction ); 1483 vec1.setYunits( GeoDataVec2::Pixels ); 1484 1485 vec2.setXunits( GeoDataVec2::Fraction ); 1486 vec2.setYunits( GeoDataVec2::Pixels ); 1487 1488 QCOMPARE( vec1, vec1 ); 1489 QCOMPARE( vec2, vec2 ); 1490 QCOMPARE( vec1 != vec2, false ); 1491 QVERIFY( vec1 == vec2 ); 1492 1493 vec2.setYunits( GeoDataVec2::Fraction ); 1494 1495 QCOMPARE( vec1, vec1 ); 1496 QCOMPARE( vec2, vec2 ); 1497 QCOMPARE( vec1 == vec2, false ); 1498 QVERIFY( vec1 != vec2 ); 1499 } 1500 1501 void TestEquality::screenOverlayTest() 1502 { 1503 GeoDataVec2 vec1, vec2, vec3, vec4; 1504 1505 vec1.setXunits( GeoDataVec2::Fraction ); 1506 vec1.setYunits( GeoDataVec2::Pixels ); 1507 1508 vec2.setXunits( GeoDataVec2::Fraction ); 1509 vec2.setYunits( GeoDataVec2::InsetPixels ); 1510 1511 vec3.setXunits( GeoDataVec2::Pixels ); 1512 vec3.setYunits( GeoDataVec2::Pixels ); 1513 1514 vec4.setXunits( GeoDataVec2::Fraction ); 1515 vec4.setYunits( GeoDataVec2::Fraction ); 1516 1517 GeoDataScreenOverlay overlay1, overlay2; 1518 1519 overlay1.setOverlayXY( vec1 ); 1520 overlay1.setRotationXY( vec2 ); 1521 overlay1.setScreenXY( vec3 ); 1522 overlay1.setSize( vec4 ); 1523 overlay1.setRotation( 3.4 ); 1524 1525 overlay2.setOverlayXY( vec1 ); 1526 overlay2.setRotationXY( vec2 ); 1527 overlay2.setScreenXY( vec3 ); 1528 overlay2.setSize( vec4 ); 1529 overlay2.setRotation( 3.4 ); 1530 1531 QCOMPARE( overlay1, overlay1 ); 1532 QCOMPARE( overlay2, overlay2 ); 1533 QCOMPARE( overlay1 != overlay2, false ); 1534 QVERIFY( overlay1 == overlay2 ); 1535 1536 overlay2.setRotation( 7.3 ); 1537 1538 QCOMPARE( overlay1, overlay1 ); 1539 QCOMPARE( overlay2, overlay2 ); 1540 QCOMPARE( overlay1 == overlay2, false ); 1541 QVERIFY( overlay1 != overlay2 ); 1542 } 1543 1544 void TestEquality::photoOverlayTest() 1545 { 1546 GeoDataPhotoOverlay overlay1, overlay2; 1547 GeoDataViewVolume volume1, volume2; 1548 1549 volume1.setLeftFov( 5.6 ); 1550 volume1.setRightFov( 6.5 ); 1551 volume1.setTopFov( 2.3 ); 1552 volume1.setBottomFov( 9.2 ); 1553 volume1.setNear( 8.6 ); 1554 1555 volume2.setLeftFov( 5.6 ); 1556 volume2.setRightFov( 6.5 ); 1557 volume2.setTopFov( 2.3 ); 1558 volume2.setBottomFov( 9.2 ); 1559 volume2.setNear( 8.6 ); 1560 1561 overlay1.setViewVolume( volume1 ); 1562 overlay2.setViewVolume( volume2 ); 1563 1564 GeoDataImagePyramid pyramid1, pyramid2; 1565 1566 pyramid1.setTileSize( 3 ); 1567 pyramid1.setMaxWidth( 5 ); 1568 pyramid1.setMaxHeight( 8 ); 1569 pyramid1.setGridOrigin( GeoDataImagePyramid::UpperLeft ); 1570 1571 pyramid2.setTileSize( 3 ); 1572 pyramid2.setMaxWidth( 5 ); 1573 pyramid2.setMaxHeight( 8 ); 1574 pyramid2.setGridOrigin( GeoDataImagePyramid::UpperLeft ); 1575 1576 overlay1.setImagePyramid( pyramid1 ); 1577 overlay2.setImagePyramid( pyramid2 ); 1578 1579 GeoDataPoint point1, point2; 1580 GeoDataCoordinates coord1, coord2; 1581 1582 coord1.set(100,100,100); 1583 coord2.set(100,100,100); 1584 point1.setCoordinates(coord1); 1585 point2.setCoordinates(coord2); 1586 overlay1.setPoint( point1 ); 1587 overlay2.setPoint( point2 ); 1588 1589 overlay1.setShape( GeoDataPhotoOverlay::Cylinder ); 1590 overlay2.setShape( GeoDataPhotoOverlay::Cylinder ); 1591 1592 overlay1.setRotation( 2.5 ); 1593 overlay2.setRotation( 2.5 ); 1594 1595 QCOMPARE( overlay1, overlay1 ); 1596 QCOMPARE( overlay2, overlay2 ); 1597 QCOMPARE( overlay1 != overlay2, false ); 1598 QVERIFY( overlay1 == overlay2 ); 1599 1600 overlay2.setRotation( 4.3 ); 1601 1602 QCOMPARE( overlay1, overlay1 ); 1603 QCOMPARE( overlay2, overlay2 ); 1604 QCOMPARE( overlay1 == overlay2, false ); 1605 QVERIFY( overlay1 != overlay2 ); 1606 } 1607 1608 void TestEquality::groundOverlayTest() 1609 { 1610 GeoDataGroundOverlay overlay1, overlay2; 1611 GeoDataLatLonBox latLonBox1, latLonBox2; 1612 1613 latLonBox1.setEast( 40 ); 1614 latLonBox1.setWest( 50 ); 1615 latLonBox1.setNorth( 60 ); 1616 latLonBox1.setSouth( 70 ); 1617 latLonBox1.setRotation( 20 ); 1618 latLonBox1.setBoundaries( 70, 80, 50, 60 ); 1619 1620 latLonBox2.setEast( 40 ); 1621 latLonBox2.setWest( 50 ); 1622 latLonBox2.setNorth( 60 ); 1623 latLonBox2.setSouth( 70 ); 1624 latLonBox2.setRotation( 20 ); 1625 latLonBox2.setBoundaries( 70, 80, 50, 60 ); 1626 1627 overlay1.setLatLonBox( latLonBox1 ); 1628 overlay2.setLatLonBox( latLonBox2 ); 1629 1630 GeoDataLatLonQuad quad1, quad2; 1631 quad1.setBottomLeftLatitude( 55, GeoDataCoordinates::Degree ); 1632 quad1.setBottomLeftLongitude( 60, GeoDataCoordinates::Degree ); 1633 quad1.setBottomRightLatitude( 45, GeoDataCoordinates::Degree ); 1634 quad1.setBottomRightLongitude( 50, GeoDataCoordinates::Degree ); 1635 1636 quad1.setTopLeftLatitude( 55, GeoDataCoordinates::Degree ); 1637 quad1.setTopLeftLongitude( 60, GeoDataCoordinates::Degree ); 1638 quad1.setTopRightLatitude( 45, GeoDataCoordinates::Degree ); 1639 quad1.setTopRightLongitude( 50, GeoDataCoordinates::Degree ); 1640 1641 quad2.setBottomLeftLatitude( 55, GeoDataCoordinates::Degree ); 1642 quad2.setBottomLeftLongitude( 60, GeoDataCoordinates::Degree ); 1643 quad2.setBottomRightLatitude( 45, GeoDataCoordinates::Degree ); 1644 quad2.setBottomRightLongitude( 50, GeoDataCoordinates::Degree ); 1645 1646 quad2.setTopLeftLatitude( 55, GeoDataCoordinates::Degree ); 1647 quad2.setTopLeftLongitude( 60, GeoDataCoordinates::Degree ); 1648 quad2.setTopRightLatitude( 45, GeoDataCoordinates::Degree ); 1649 quad2.setTopRightLongitude( 50, GeoDataCoordinates::Degree ); 1650 1651 overlay1.setLatLonQuad( quad1 ); 1652 overlay2.setLatLonQuad( quad2 ); 1653 1654 overlay1.setAltitude( 23.5 ); 1655 overlay2.setAltitude( 23.5 ); 1656 1657 overlay1.setAltitudeMode( Marble::Absolute ); 1658 overlay2.setAltitudeMode( Marble::Absolute ); 1659 1660 QCOMPARE( overlay1, overlay1 ); 1661 QCOMPARE( overlay2, overlay2 ); 1662 QCOMPARE( overlay1 != overlay2, false ); 1663 QVERIFY( overlay1 == overlay2 ); 1664 1665 overlay2.setAltitude( 42.3 ); 1666 1667 QCOMPARE( overlay1, overlay1 ); 1668 QCOMPARE( overlay2, overlay2 ); 1669 QCOMPARE( overlay1 == overlay2, false ); 1670 QVERIFY( overlay1 != overlay2 ); 1671 } 1672 1673 void TestEquality::simpleFieldTest() 1674 { 1675 GeoDataSimpleField field1, field2; 1676 field1.setDisplayName("Simple Field"); 1677 field1.setName("Field Name"); 1678 field1.setType(GeoDataSimpleField::Int); 1679 1680 field2.setDisplayName("Simple Field"); 1681 field2.setName("Field Name"); 1682 field2.setType(GeoDataSimpleField::Int); 1683 1684 QCOMPARE( field1, field1 ); 1685 QCOMPARE( field2, field2 ); 1686 QCOMPARE( field1 != field2, false ); 1687 QVERIFY( field1 == field2 ); 1688 1689 field2.setType( GeoDataSimpleField::Double ); 1690 1691 QCOMPARE( field1, field1 ); 1692 QCOMPARE( field2, field2 ); 1693 QCOMPARE( field1 == field2, false ); 1694 QVERIFY( field1 != field2 ); 1695 } 1696 1697 void TestEquality::schemaTest() 1698 { 1699 GeoDataSimpleField field1, field2; 1700 field1.setDisplayName("Simple Field 1"); 1701 field1.setName("Field Name 1"); 1702 field1.setType(GeoDataSimpleField::Int); 1703 1704 field2.setDisplayName("Simple Field 2"); 1705 field2.setName("Field Name 2"); 1706 field2.setType(GeoDataSimpleField::Double); 1707 1708 GeoDataSchema schema1, schema2; 1709 schema1.setId( "Some ID" ); 1710 schema1.setSchemaName( "Some Name" ); 1711 schema1.addSimpleField( field1 ); 1712 schema1.addSimpleField( field2 ); 1713 1714 schema2.setId( "Some ID" ); 1715 schema2.setSchemaName( "Some Name" ); 1716 schema2.addSimpleField( field1 ); 1717 schema2.addSimpleField( field2 ); 1718 1719 QCOMPARE( schema1, schema1 ); 1720 QCOMPARE( schema2, schema2 ); 1721 QCOMPARE( schema1 != schema2, false ); 1722 QVERIFY( schema1 == schema2 ); 1723 1724 schema2.setSchemaName( "Changed Name" ); 1725 1726 QCOMPARE( schema1, schema1 ); 1727 QCOMPARE( schema2, schema2 ); 1728 QCOMPARE( schema1 == schema2, false ); 1729 QVERIFY( schema1 != schema2 ); 1730 } 1731 1732 void TestEquality::scaleTest() 1733 { 1734 GeoDataScale scale1, scale2; 1735 1736 scale1.setX( 1.0 ); 1737 scale1.setY( 2.0 ); 1738 scale1.setZ( 3.0 ); 1739 1740 scale2 = scale1; 1741 scale2.setZ( 3.5 ); 1742 1743 QCOMPARE( scale1, scale1 ); 1744 QCOMPARE( scale2, scale2 ); 1745 QCOMPARE( scale1 == scale2, false ); 1746 QVERIFY( scale1 != scale2 ); 1747 1748 scale2.setZ( 3.0 ); 1749 QVERIFY( scale1 == scale2 ); 1750 } 1751 1752 void TestEquality::orientationTest() 1753 { 1754 GeoDataOrientation obj1, obj2; 1755 1756 obj1.setHeading( 90 ); 1757 obj1.setTilt( 45 ); 1758 obj1.setRoll( -90 ); 1759 1760 obj2 = obj1; 1761 obj2.setRoll( -45 ); 1762 1763 QCOMPARE( obj1, obj1 ); 1764 QCOMPARE( obj2, obj2 ); 1765 QCOMPARE( obj1 == obj2, false ); 1766 QVERIFY( obj1 != obj2 ); 1767 1768 obj2.setRoll( - 90 ); 1769 QVERIFY( obj1 == obj2 ); 1770 } 1771 1772 void TestEquality::locationTest() 1773 { 1774 GeoDataLocation loc1, loc2; 1775 1776 loc1.setLatitude( M_PI_4, GeoDataCoordinates::Degree ); 1777 loc1.setLongitude( M_PI_4, GeoDataCoordinates::Degree ); 1778 loc1.setAltitude( 2500.0 ); 1779 1780 loc2 = loc1; 1781 loc2.setAltitude( 2000.0 ); 1782 1783 QCOMPARE( loc1, loc1 ); 1784 QCOMPARE( loc2, loc2 ); 1785 QCOMPARE( loc1 == loc2, false ); 1786 QVERIFY( loc1 != loc2 ); 1787 1788 loc2.setAltitude( 2500.0 ); 1789 QVERIFY( loc1 == loc2 ); 1790 } 1791 1792 void TestEquality::resourceMapTest() 1793 { 1794 GeoDataResourceMap rMap1, rMap2; 1795 1796 rMap1.setSourceHref( "/path/to/source/href" ); 1797 rMap1.setTargetHref( "/path/to/target/href" ); 1798 1799 rMap2 = rMap1; 1800 rMap2.setTargetHref( "/path/to/target/href2" ); 1801 1802 QCOMPARE( rMap1, rMap1 ); 1803 QCOMPARE( rMap2, rMap2 ); 1804 QCOMPARE( rMap1 == rMap2, false ); 1805 QVERIFY( rMap1 != rMap2 ); 1806 1807 rMap2.setTargetHref( "/path/to/target/href" ); 1808 QVERIFY( rMap1 == rMap2 ); 1809 } 1810 1811 void TestEquality::modelTest() 1812 { 1813 GeoDataModel model1, model2; 1814 1815 1816 GeoDataLink link1, link2; 1817 link1.setHref("some/example/href.something"); 1818 link1.setRefreshInterval( 23 ); 1819 link1.setRefreshMode( GeoDataLink::OnChange ); 1820 link1.setViewBoundScale( 50 ); 1821 link1.setViewRefreshTime( 30 ); 1822 1823 link2 = link1; 1824 link2.setRefreshMode( GeoDataLink::OnExpire ); 1825 1826 model1.setLink( link1 ); 1827 model1.setLink( link2 ); 1828 1829 1830 GeoDataCoordinates coord1, coord2; 1831 coord1.set(100, 200, 300); 1832 coord2.set(100, 200, 200); 1833 1834 model1.setCoordinates( coord1 ); 1835 model2.setCoordinates( coord2 ); 1836 1837 1838 GeoDataScale scale1, scale2; 1839 1840 scale1.setX( 1.0 ); 1841 scale1.setY( 2.0 ); 1842 scale1.setZ( 3.0 ); 1843 1844 scale2 = scale1; 1845 scale2.setZ( 3.5 ); 1846 1847 model1.setScale( scale1 ); 1848 model2.setScale( scale2 ); 1849 1850 1851 GeoDataOrientation obj1, obj2; 1852 1853 obj1.setHeading( 90 ); 1854 obj1.setTilt( 45 ); 1855 obj1.setRoll( -90 ); 1856 1857 obj2 = obj1; 1858 obj2.setRoll( -45 ); 1859 1860 model1.setOrientation( obj1 ); 1861 model2.setOrientation( obj2 ); 1862 1863 1864 GeoDataLocation loc1, loc2; 1865 1866 loc1.setLatitude( M_PI_4, GeoDataCoordinates::Degree ); 1867 loc1.setLongitude( M_PI_4, GeoDataCoordinates::Degree ); 1868 loc1.setAltitude( 2500.0 ); 1869 1870 loc2 = loc1; 1871 loc2.setAltitude( 2000.0 ); 1872 1873 model1.setLocation( loc1 ); 1874 model2.setLocation( loc2 ); 1875 1876 1877 GeoDataResourceMap rMap1, rMap2; 1878 1879 rMap1.setSourceHref( "/path/to/source/href" ); 1880 rMap1.setTargetHref( "/path/to/target/href" ); 1881 1882 rMap2 = rMap1; 1883 rMap2.setTargetHref( "/path/to/target/href2" ); 1884 1885 model1.setResourceMap( rMap1 ); 1886 model2.setResourceMap( rMap2 ); 1887 1888 1889 QCOMPARE( model1, model1 ); 1890 QCOMPARE( model2, model2 ); 1891 QCOMPARE( model1 == model2, false ); 1892 QVERIFY( model1 != model2 ); 1893 1894 1895 link2.setRefreshMode( GeoDataLink::OnExpire ); 1896 model2.setLink( link2 ); 1897 1898 coord2.setAltitude( 300 ); 1899 model2.setCoordinates( coord2 ); 1900 1901 scale2.setZ( 3.0 ); 1902 model2.setScale( scale2 ); 1903 1904 obj2.setRoll( -90 ); 1905 model2.setOrientation( obj2 ); 1906 1907 loc2.setAltitude( 2500.0 ); 1908 model2.setLocation( loc2 ); 1909 1910 rMap2.setTargetHref( "/path/to/target/href" ); 1911 model2.setResourceMap( rMap2 ); 1912 1913 QVERIFY( model1 == model2 ); 1914 } 1915 1916 void TestEquality::trackTest() 1917 { 1918 GeoDataTrack track1, track2; 1919 QDateTime date11( QDate(2000, 10, 4) ), date12( QDate(2001, 10, 4) ); 1920 QDateTime date21( QDate(2002, 10, 4) ), date22( QDate(2003, 10, 4) ); 1921 GeoDataCoordinates coord1(100, 100), coord2(200, 300), coord3(300, 300), coord4(400, 400); 1922 GeoDataExtendedData extendedData1, extendedData2; 1923 GeoDataData data1, data2; 1924 1925 data1.setName("Something"); 1926 data1.setValue(QVariant(23.56)); 1927 data1.setDisplayName("Marble"); 1928 1929 data2.setName("Marble"); 1930 data2.setValue(QVariant(23.56)); 1931 data2.setDisplayName("Globe"); 1932 1933 extendedData1.addValue(data1); 1934 extendedData2.addValue(data2); 1935 1936 track1.addPoint(date11, coord1); 1937 track1.addPoint(date12, coord2); 1938 track2.addPoint(date21, coord3); 1939 track2.addPoint(date22, coord4); 1940 1941 track1.setExtendedData(extendedData1); 1942 track2.setExtendedData(extendedData2); 1943 1944 track1.setInterpolate( true ); 1945 track2.setInterpolate( true ); 1946 1947 QCOMPARE(track1, track1); 1948 QCOMPARE(track2, track2); 1949 QCOMPARE(track1 == track2, false); 1950 QVERIFY(track1 != track2); 1951 1952 track1.clear(); 1953 track1.addPoint(date21, coord3); 1954 track1.addPoint(date22, coord4); 1955 track1.setExtendedData(extendedData2); 1956 QVERIFY(track1 == track2); 1957 } 1958 1959 void TestEquality::multiTrackTest() 1960 { 1961 GeoDataMultiTrack multiTrack1, multiTrack2; 1962 GeoDataTrack *track1, *track2, *track3, *track4; 1963 QDateTime date11( QDate(2000, 10, 4) ), date12( QDate(2001, 10, 4) ); 1964 QDateTime date21( QDate(2002, 10, 4) ), date22( QDate(2003, 10, 4) ); 1965 GeoDataCoordinates coord1(100, 100), coord2(200, 300), coord3(300, 300), coord4(400, 400); 1966 GeoDataExtendedData extendedData1, extendedData2; 1967 GeoDataData data1, data2; 1968 1969 data1.setName("Something"); 1970 data1.setValue(QVariant(23.56)); 1971 data1.setDisplayName("Marble"); 1972 1973 data2.setName("Marble"); 1974 data2.setValue(QVariant(23.56)); 1975 data2.setDisplayName("Globe"); 1976 1977 extendedData1.addValue(data1); 1978 extendedData2.addValue(data2); 1979 1980 track1 = new GeoDataTrack(); 1981 track2 = new GeoDataTrack(); 1982 track1->addPoint(date11, coord1); 1983 track1->addPoint(date12, coord2); 1984 track2->addPoint(date11, coord1); 1985 track2->addPoint(date12, coord2); 1986 track1->setExtendedData(extendedData1); 1987 track2->setExtendedData(extendedData1); 1988 track1->setInterpolate( true ); 1989 track2->setInterpolate( true ); 1990 1991 track3 = new GeoDataTrack(); 1992 track4 = new GeoDataTrack(); 1993 track3->addPoint(date21, coord3); 1994 track3->addPoint(date22, coord4); 1995 track4->addPoint(date21, coord3); 1996 track4->addPoint(date22, coord4); 1997 track3->setExtendedData(extendedData2); 1998 track4->setExtendedData(extendedData2); 1999 track3->setInterpolate( false ); 2000 track4->setInterpolate( false ); 2001 2002 multiTrack1.append(track1); 2003 multiTrack2.append(track2); 2004 multiTrack1.append(track3); 2005 multiTrack2.append(track4); 2006 2007 QCOMPARE(*track1, *track2); 2008 QCOMPARE(*track3, *track4); 2009 2010 QCOMPARE(multiTrack1, multiTrack1); 2011 QCOMPARE(multiTrack2, multiTrack2); 2012 QCOMPARE(multiTrack1 != multiTrack2, false); 2013 QVERIFY(multiTrack1 == multiTrack2); 2014 } 2015 2016 void TestEquality::snippetTest() 2017 { 2018 GeoDataSnippet snipp1, snipp2; 2019 2020 snipp1.setText( QString("Text1") ); 2021 snipp2.setText( QString("Text2") ); 2022 2023 snipp1.setMaxLines( 10 ); 2024 snipp2.setMaxLines( 666013 ); 2025 2026 QCOMPARE( snipp1, snipp1 ); 2027 QCOMPARE( snipp2, snipp2 ); 2028 QCOMPARE( snipp1 == snipp2, false ); 2029 QVERIFY( snipp1 != snipp2 ); 2030 2031 snipp1.setText( QString("Text2") ); 2032 snipp2.setMaxLines( 10 ); 2033 QVERIFY( snipp1 == snipp2 ); 2034 } 2035 2036 void TestEquality::lookAtTest() 2037 { 2038 GeoDataLookAt lookAt1, lookAt2; 2039 2040 lookAt1.setLatitude(1.112); 2041 lookAt1.setLongitude(2.33); 2042 lookAt1.setAltitude(1500); 2043 lookAt2 = lookAt1; 2044 2045 GeoDataTimeStamp timeStampBegin, timeStampEnd; 2046 QDateTime date1( QDate(2014, 4, 7) ); 2047 2048 timeStampBegin.setWhen( date1 ); 2049 timeStampEnd.setWhen( date1 ); 2050 timeStampBegin.setResolution( GeoDataTimeStamp::YearResolution ); 2051 timeStampEnd.setResolution( GeoDataTimeStamp::YearResolution ); 2052 2053 GeoDataTimeSpan timeSpan1, timeSpan2; 2054 timeSpan1.setBegin( timeStampBegin ); 2055 timeSpan1.setEnd( timeStampEnd ); 2056 timeSpan2 = timeSpan1; 2057 2058 GeoDataTimeStamp timeStamp1, timeStamp2; 2059 QDateTime date2( QDate(2014, 4, 8) ); 2060 timeStamp1.setWhen( date2 ); 2061 timeStamp2.setWhen( date2 ); 2062 timeStamp1.setResolution( GeoDataTimeStamp::SecondResolution ); 2063 timeStamp2.setResolution( GeoDataTimeStamp::SecondResolution ); 2064 2065 lookAt1.setTimeSpan( timeSpan1 ); 2066 lookAt2.setTimeSpan( timeSpan2 ); 2067 lookAt1.setTimeStamp( timeStamp1 ); 2068 lookAt2.setTimeStamp( timeStamp2 ); 2069 2070 lookAt1.setRange( 500 ); 2071 lookAt2.setRange( 300 ); 2072 2073 QCOMPARE( lookAt1, lookAt1 ); 2074 QCOMPARE( lookAt2, lookAt2 ); 2075 QCOMPARE( lookAt1 == lookAt2, false ); 2076 QVERIFY( lookAt1 != lookAt2 ); 2077 2078 lookAt2.setRange( 500 ); 2079 QVERIFY( lookAt1 == lookAt2 ); 2080 2081 timeStamp1.setResolution( GeoDataTimeStamp::YearResolution ); 2082 lookAt1.setTimeStamp( timeStamp1 ); 2083 QVERIFY( lookAt1 != lookAt2 ); 2084 2085 lookAt2.setTimeStamp( timeStamp1 ); 2086 QVERIFY( lookAt1 == lookAt2 ); 2087 2088 lookAt2.setAltitude( 2000 ); 2089 QVERIFY( lookAt1 != lookAt2 ); 2090 } 2091 2092 void TestEquality::networkLinkTest() 2093 { 2094 GeoDataNetworkLink netL1, netL2; 2095 2096 netL1.setRefreshVisibility( true ); 2097 netL2.setRefreshVisibility( false ); 2098 netL1.setFlyToView( true ); 2099 netL2.setFlyToView( false ); 2100 2101 GeoDataLink link; 2102 link.setHref(QString("/link/to/something")); 2103 link.setRefreshMode( GeoDataLink::OnExpire ); 2104 link.setRefreshInterval( 20.22 ); 2105 link.setViewRefreshMode( GeoDataLink::OnRequest ); 2106 link.setViewRefreshTime( 3.22 ); 2107 link.setViewBoundScale( 1.132 ); 2108 link.setViewFormat( QString("Format 1") ); 2109 link.setHttpQuery( QString("HttpQueryy1") ); 2110 2111 netL1.setLink( link ); 2112 netL2.setLink( link ); 2113 2114 QCOMPARE( netL1, netL1 ); 2115 QCOMPARE( netL2, netL2 ); 2116 QCOMPARE( netL1 == netL2, false ); 2117 QVERIFY( netL1 != netL2 ); 2118 2119 netL1.setName( QString("NetL1") ); 2120 netL1.setSnippet( GeoDataSnippet("Textttt", 10) ); 2121 netL1.setDescription( QString("Descr1") ); 2122 netL1.setDescriptionCDATA( false ); 2123 netL1.setAddress( QString("Some address") ); 2124 netL1.setPhoneNumber( QString("Some phone number") ); 2125 netL1.setStyleUrl( QString("/link/to/style1") ); 2126 netL1.setPopularity( 66666 ); 2127 netL1.setZoomLevel( 10 ); 2128 netL1.setVisible( true ); 2129 netL1.setRole( QString("Role1") ); 2130 netL2.setName( QString("NetL1") ); 2131 netL2.setSnippet( GeoDataSnippet("Textttt", 10) ); 2132 netL2.setDescription( QString("Descr1") ); 2133 netL2.setDescriptionCDATA( false ); 2134 netL2.setAddress( QString("Some address") ); 2135 netL2.setPhoneNumber( QString("Some phone number") ); 2136 netL2.setStyleUrl( QString("/link/to/style1") ); 2137 netL2.setPopularity( 66666 ); 2138 netL2.setZoomLevel( 10 ); 2139 netL2.setVisible( true ); 2140 netL2.setRole( QString("Role1") ); 2141 2142 GeoDataLookAt lookAt1, lookAt2; 2143 2144 lookAt1.setAltitudeMode( Marble::ClampToGround ); 2145 lookAt1.setAltitude( 100 ); 2146 lookAt1.setLatitude( 100 ); 2147 lookAt1.setLongitude( 100 ); 2148 lookAt1.setRange( 500 ); 2149 lookAt2 = lookAt1; 2150 2151 netL1.setAbstractView( &lookAt1 ); 2152 netL2.setAbstractView( &lookAt2 ); 2153 netL1.setFlyToView( false ); 2154 netL2.setRefreshVisibility( true ); 2155 2156 QVERIFY( netL1 == netL2 ); 2157 } 2158 2159 void TestEquality::networkLinkControlTest() 2160 { 2161 GeoDataNetworkLinkControl netLC1, netLC2; 2162 2163 netLC1.setMinRefreshPeriod( 25 ); 2164 netLC1.setMaxSessionLength( 100 ); 2165 netLC1.setCookie( QString("Coookiiee") ); 2166 netLC1.setMessage( QString("Some message here") ); 2167 netLC1.setLinkName( QString("Link name") ); 2168 netLC1.setLinkDescription( QString("Some link description here") ); 2169 netLC1.setLinkSnippet( QString("Link snippet") ); 2170 netLC1.setMaxLines( 100 ); 2171 netLC1.setExpires( QDateTime(QDate(2014, 5, 4)) ); 2172 netLC2.setMinRefreshPeriod( 25 ); 2173 netLC2.setMaxSessionLength( 100 ); 2174 netLC2.setCookie( QString("Coookiiee") ); 2175 netLC2.setMessage( QString("Some message here") ); 2176 netLC2.setLinkName( QString("Link name") ); 2177 netLC2.setLinkDescription( QString("Some link description here") ); 2178 netLC2.setLinkSnippet( QString("Link snippet") ); 2179 netLC2.setMaxLines( 100 ); 2180 netLC2.setExpires( QDateTime(QDate(2014, 5, 4)) ); 2181 2182 GeoDataUpdate update; 2183 update.setTargetHref( QString("Target href") ); 2184 2185 netLC1.setUpdate( update ); 2186 netLC2.setUpdate( update ); 2187 2188 2189 GeoDataCamera *camera1 = new GeoDataCamera; 2190 GeoDataCamera *camera2 = new GeoDataCamera; 2191 2192 camera1->setAltitudeMode( Marble::ClampToGround ); 2193 camera1->setAltitude( 2000 ); 2194 camera1->setLatitude( 2.555 ); 2195 camera1->setLongitude( 1.32 ); 2196 camera1->setHeading( 200 ); 2197 camera1->setRoll( 300 ); 2198 camera1->setTilt( 400 ); 2199 *camera2 = *camera1; 2200 2201 2202 netLC1.setAbstractView( camera1 ); 2203 netLC2.setAbstractView( camera2 ); 2204 QVERIFY( netLC1 == netLC2 ); 2205 2206 camera2->setAltitudeMode( Marble::Absolute ); 2207 QVERIFY( netLC1 != netLC2 ); 2208 2209 camera1->setAltitudeMode( Marble::Absolute ); 2210 QVERIFY( netLC1 == netLC2 ); 2211 2212 netLC1.setMaxLines( 50 ); 2213 QVERIFY( netLC1 != netLC2 ); 2214 2215 netLC1.setStyleMap(nullptr); 2216 netLC2.setStyleMap(nullptr); 2217 2218 GeoDataStyleMap styleMap1, styleMap2; 2219 styleMap1["germany"] = "gst1"; 2220 styleMap1["germany"] = "gst2"; 2221 styleMap1["germany"] = "gst3"; 2222 styleMap1["poland"] = "pst1"; 2223 styleMap1["poland"] = "pst2"; 2224 styleMap1["poland"] = "pst3"; 2225 styleMap1.setLastKey("poland"); 2226 styleMap2["germany"] = "gst1"; 2227 styleMap2["germany"] = "gst2"; 2228 styleMap2["germany"] = "gst3"; 2229 styleMap2["poland"] = "pst1"; 2230 styleMap2["poland"] = "pst2"; 2231 styleMap2["poland"] = "pst3"; 2232 styleMap2.setLastKey("romania"); 2233 2234 2235 netLC2.setMaxLines( 50 ); 2236 netLC1.setStyleMap( &styleMap1 ); 2237 netLC2.setStyleMap( &styleMap2 ); 2238 QVERIFY( netLC1 != netLC2 ); 2239 2240 styleMap1.setLastKey("romania"); 2241 QVERIFY( netLC1 == netLC2 ); 2242 } 2243 2244 void TestEquality::folderTest() 2245 { 2246 GeoDataFolder folder1, folder2; 2247 2248 GeoDataGroundOverlay *overlay11, *overlay12, *overlay21, *overlay22; 2249 GeoDataLatLonBox latLonBox1, latLonBox2; 2250 2251 overlay11 = new GeoDataGroundOverlay; 2252 overlay12 = new GeoDataGroundOverlay; 2253 overlay21 = new GeoDataGroundOverlay; 2254 overlay22 = new GeoDataGroundOverlay; 2255 2256 latLonBox1.setEast( 33 ); 2257 latLonBox1.setWest( 52 ); 2258 latLonBox1.setNorth( 61 ); 2259 latLonBox1.setSouth( 72 ); 2260 latLonBox1.setRotation( 51 ); 2261 latLonBox1.setBoundaries( 23, 54, 33, 21 ); 2262 2263 latLonBox2.setEast( 40 ); 2264 latLonBox2.setWest( 50 ); 2265 latLonBox2.setNorth( 60 ); 2266 latLonBox2.setSouth( 70 ); 2267 latLonBox2.setRotation( 20 ); 2268 latLonBox2.setBoundaries( 70, 80, 50, 60 ); 2269 2270 overlay11->setLatLonBox( latLonBox1 ); 2271 overlay12->setLatLonBox( latLonBox2 ); 2272 2273 GeoDataLatLonQuad quad1, quad2; 2274 quad1.setBottomLeftLatitude( 1.23, GeoDataCoordinates::Radian ); 2275 quad1.setBottomLeftLongitude( 2.60, GeoDataCoordinates::Radian ); 2276 quad1.setBottomRightLatitude( 0.45, GeoDataCoordinates::Radian ); 2277 quad1.setBottomRightLongitude( 1.260, GeoDataCoordinates::Radian ); 2278 2279 quad1.setTopLeftLatitude( 2.55, GeoDataCoordinates::Radian ); 2280 quad1.setTopLeftLongitude( 1.65, GeoDataCoordinates::Radian ); 2281 quad1.setTopRightLatitude( 1.245, GeoDataCoordinates::Radian ); 2282 quad1.setTopRightLongitude( 1.350, GeoDataCoordinates::Radian ); 2283 2284 quad2.setBottomLeftLatitude( 55, GeoDataCoordinates::Degree ); 2285 quad2.setBottomLeftLongitude( 60, GeoDataCoordinates::Degree ); 2286 quad2.setBottomRightLatitude( 45, GeoDataCoordinates::Degree ); 2287 quad2.setBottomRightLongitude( 50, GeoDataCoordinates::Degree ); 2288 2289 quad2.setTopLeftLatitude( 55, GeoDataCoordinates::Degree ); 2290 quad2.setTopLeftLongitude( 60, GeoDataCoordinates::Degree ); 2291 quad2.setTopRightLatitude( 45, GeoDataCoordinates::Degree ); 2292 quad2.setTopRightLongitude( 50, GeoDataCoordinates::Degree ); 2293 2294 overlay11->setLatLonQuad( quad1 ); 2295 overlay12->setLatLonQuad( quad2 ); 2296 2297 overlay11->setAltitude( 23.5 ); 2298 overlay12->setAltitude( 23.5 ); 2299 2300 overlay11->setAltitudeMode( Marble::Absolute ); 2301 overlay12->setAltitudeMode( Marble::Absolute ); 2302 2303 *overlay21 = *overlay11; 2304 *overlay22 = *overlay12; 2305 2306 folder1.append( overlay11 ); 2307 folder1.append( overlay12 ); 2308 folder2.append( overlay21 ); 2309 folder2.append( overlay22 ); 2310 2311 QCOMPARE( folder1, folder1 ); 2312 QCOMPARE( folder2, folder2 ); 2313 QCOMPARE( folder1 != folder2, false ); 2314 QVERIFY( folder1 == folder2 ); 2315 } 2316 2317 void TestEquality::simpleDataTest() 2318 { 2319 GeoDataSimpleData simpleData1, simpleData2; 2320 simpleData1.setName( "height" ); 2321 simpleData1.setData( "4.65" ); 2322 2323 simpleData2.setName( "height" ); 2324 simpleData2.setData( "4.65" ); 2325 2326 QCOMPARE( simpleData1, simpleData1 ); 2327 QCOMPARE( simpleData2, simpleData2 ); 2328 QCOMPARE( simpleData1 != simpleData2, false ); 2329 QVERIFY( simpleData1 == simpleData2 ); 2330 2331 simpleData2.setData( "7.45" ); 2332 2333 QCOMPARE( simpleData1, simpleData1 ); 2334 QCOMPARE( simpleData2, simpleData2 ); 2335 QCOMPARE( simpleData1 == simpleData2, false ); 2336 QVERIFY( simpleData1 != simpleData2 ); 2337 } 2338 2339 void TestEquality::schemaDataTest() 2340 { 2341 GeoDataSimpleData simpleData1, simpleData2; 2342 simpleData1.setName( "width" ); 2343 simpleData1.setData( "6.24" ); 2344 2345 simpleData2.setName( "width" ); 2346 simpleData2.setData( "6.24" ); 2347 2348 GeoDataSchemaData schemaData1, schemaData2; 2349 schemaData1.setSchemaUrl( "dimensions" ); 2350 schemaData1.addSimpleData( simpleData1 ); 2351 schemaData1.addSimpleData( simpleData2 ); 2352 schemaData2.setSchemaUrl( "dimensions" ); 2353 schemaData2.addSimpleData( simpleData1 ); 2354 schemaData2.addSimpleData( simpleData2 ); 2355 2356 QCOMPARE( schemaData1, schemaData1 ); 2357 QCOMPARE( schemaData2, schemaData2 ); 2358 QCOMPARE( schemaData1 != schemaData2, false ); 2359 QVERIFY( schemaData1 == schemaData2 ); 2360 2361 schemaData2.setSchemaUrl( "some other id" ); 2362 2363 QCOMPARE( schemaData1, schemaData1 ); 2364 QCOMPARE( schemaData2, schemaData2 ); 2365 QCOMPARE( schemaData1 == schemaData2, false ); 2366 QVERIFY( schemaData1 != schemaData2 ); 2367 } 2368 2369 QTEST_MAIN( TestEquality ) 2370 2371 #include "TestEquality.moc"