[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble] /: Equality operators for FlyTo, HotSpot, ImagePyramid, ItemIcon, Link.
From: Dennis_Nienhüser <earthwings () gentoo ! org>
Date: 2014-02-28 21:19:56
Message-ID: E1WJUqa-0004uW-GX () scm ! kde ! org
[Download RAW message or body]
Git commit 0c84eb2defc38a04effdc16ee744d70d358752b5 by Dennis Nienhüser, on behalf \
of Sanjiban Bairagya. Committed on 28/02/2014 at 21:18.
Pushed by nienhueser into branch 'master'.
Equality operators for FlyTo, HotSpot, ImagePyramid, ItemIcon, Link.
REVIEW: 116485
BUG: 331587
M +10 -0 src/lib/marble/geodata/data/GeoDataFlyTo.cpp
M +3 -1 src/lib/marble/geodata/data/GeoDataFlyTo.h
M +10 -0 src/lib/marble/geodata/data/GeoDataHotSpot.cpp
M +2 -0 src/lib/marble/geodata/data/GeoDataHotSpot.h
M +10 -0 src/lib/marble/geodata/data/GeoDataImagePyramid.cpp
M +2 -0 src/lib/marble/geodata/data/GeoDataImagePyramid.h
M +10 -0 src/lib/marble/geodata/data/GeoDataItemIcon.cpp
M +2 -0 src/lib/marble/geodata/data/GeoDataItemIcon.h
M +11 -7 src/lib/marble/geodata/data/GeoDataLink.cpp
M +2 -0 src/lib/marble/geodata/data/GeoDataLink.h
M +107 -0 tests/TestEquality.cpp
http://commits.kde.org/marble/0c84eb2defc38a04effdc16ee744d70d358752b5
diff --git a/src/lib/marble/geodata/data/GeoDataFlyTo.cpp \
b/src/lib/marble/geodata/data/GeoDataFlyTo.cpp index a0a5085..245c1d9 100644
--- a/src/lib/marble/geodata/data/GeoDataFlyTo.cpp
+++ b/src/lib/marble/geodata/data/GeoDataFlyTo.cpp
@@ -50,6 +50,16 @@ GeoDataFlyTo &GeoDataFlyTo::operator=( const GeoDataFlyTo &other )
return *this;
}
+bool GeoDataFlyTo::operator==( const GeoDataFlyTo& other ) const
+{
+ return ( d->m_duration == other.d->m_duration ) && ( d->m_flyToMode == \
other.d->m_flyToMode ) && ( d->m_view == other.d->m_view ); +}
+
+bool GeoDataFlyTo::operator!=( const GeoDataFlyTo& other ) const
+{
+ return !this->operator==(other);
+}
+
GeoDataFlyTo::~GeoDataFlyTo()
{
delete d;
diff --git a/src/lib/marble/geodata/data/GeoDataFlyTo.h \
b/src/lib/marble/geodata/data/GeoDataFlyTo.h index 6625524..82dbf60 100644
--- a/src/lib/marble/geodata/data/GeoDataFlyTo.h
+++ b/src/lib/marble/geodata/data/GeoDataFlyTo.h
@@ -20,7 +20,7 @@ namespace Marble {
class GeoDataFlyToPrivate;
-class GeoDataFlyTo: public GeoDataTourPrimitive
+class MARBLE_EXPORT GeoDataFlyTo: public GeoDataTourPrimitive
{
public:
enum FlyToMode {
@@ -33,6 +33,8 @@ public:
GeoDataFlyTo( const GeoDataFlyTo &other );
GeoDataFlyTo& operator=( const GeoDataFlyTo &other );
+ bool operator==( const GeoDataFlyTo& other ) const;
+ bool operator!=( const GeoDataFlyTo& other ) const;
~GeoDataFlyTo();
diff --git a/src/lib/marble/geodata/data/GeoDataHotSpot.cpp \
b/src/lib/marble/geodata/data/GeoDataHotSpot.cpp index 3374548..411aaa7 100644
--- a/src/lib/marble/geodata/data/GeoDataHotSpot.cpp
+++ b/src/lib/marble/geodata/data/GeoDataHotSpot.cpp
@@ -66,6 +66,16 @@ GeoDataHotSpot& GeoDataHotSpot::operator=( const GeoDataHotSpot& \
other ) return *this;
}
+bool GeoDataHotSpot::operator==( const GeoDataHotSpot& other )
+{
+ return ( d->m_hotSpot == other.d->m_hotSpot ) && ( d->m_xunits == \
other.d->m_xunits ) && ( d->m_yunits == other.d->m_yunits ); +}
+
+bool GeoDataHotSpot::operator!=( const GeoDataHotSpot& other )
+{
+ return !this->operator==(other);
+}
+
const QPointF& GeoDataHotSpot::hotSpot( Units& xunits, Units& yunits ) const
{
xunits = d->m_xunits;
diff --git a/src/lib/marble/geodata/data/GeoDataHotSpot.h \
b/src/lib/marble/geodata/data/GeoDataHotSpot.h index 43352c7..8691e16 100644
--- a/src/lib/marble/geodata/data/GeoDataHotSpot.h
+++ b/src/lib/marble/geodata/data/GeoDataHotSpot.h
@@ -35,6 +35,8 @@ class GEODATA_EXPORT GeoDataHotSpot : public GeoDataObject
~GeoDataHotSpot();
GeoDataHotSpot& operator=( const GeoDataHotSpot& other );
+ bool operator==( const GeoDataHotSpot& other );
+ bool operator!=( const GeoDataHotSpot& other );
/// Provides type information for downcasting a GeoData
virtual const char* nodeType() const;
diff --git a/src/lib/marble/geodata/data/GeoDataImagePyramid.cpp \
b/src/lib/marble/geodata/data/GeoDataImagePyramid.cpp index e8ada51..38043b2 100644
--- a/src/lib/marble/geodata/data/GeoDataImagePyramid.cpp
+++ b/src/lib/marble/geodata/data/GeoDataImagePyramid.cpp
@@ -53,6 +53,16 @@ GeoDataImagePyramid &GeoDataImagePyramid::operator=( const \
GeoDataImagePyramid & return *this;
}
+bool GeoDataImagePyramid::operator==( const GeoDataImagePyramid& other )
+{
+ return ( d->m_tileSize == other.d->m_tileSize ) && ( d->m_maxWidth == \
other.d->m_maxWidth ) && ( d->m_maxHeight == other.d->m_maxHeight ) && ( \
d->m_gridOrigin == other.d->m_gridOrigin ); +}
+
+bool GeoDataImagePyramid::operator!=( const GeoDataImagePyramid& other )
+{
+ return !this->operator==(other);
+}
+
GeoDataImagePyramid::~GeoDataImagePyramid()
{
delete d;
diff --git a/src/lib/marble/geodata/data/GeoDataImagePyramid.h \
b/src/lib/marble/geodata/data/GeoDataImagePyramid.h index cd92670..b155f10 100644
--- a/src/lib/marble/geodata/data/GeoDataImagePyramid.h
+++ b/src/lib/marble/geodata/data/GeoDataImagePyramid.h
@@ -27,6 +27,8 @@ public:
GeoDataImagePyramid( const GeoDataImagePyramid &other );
GeoDataImagePyramid& operator=( const GeoDataImagePyramid &other );
+ bool operator==( const GeoDataImagePyramid &other );
+ bool operator!=( const GeoDataImagePyramid &other );
~GeoDataImagePyramid();
diff --git a/src/lib/marble/geodata/data/GeoDataItemIcon.cpp \
b/src/lib/marble/geodata/data/GeoDataItemIcon.cpp index b8280b7..57c23ff 100644
--- a/src/lib/marble/geodata/data/GeoDataItemIcon.cpp
+++ b/src/lib/marble/geodata/data/GeoDataItemIcon.cpp
@@ -48,6 +48,16 @@ GeoDataItemIcon &GeoDataItemIcon::operator=( const GeoDataItemIcon \
&other ) return *this;
}
+bool GeoDataItemIcon::operator==( const GeoDataItemIcon& other )
+{
+ return ( d->m_state == other.d->m_state ) && ( d->m_iconPath == \
other.d->m_iconPath ) && ( d->m_icon == other.d->m_icon ); +}
+
+bool GeoDataItemIcon::operator!=( const GeoDataItemIcon& other )
+{
+ return !this->operator==(other);
+}
+
GeoDataItemIcon::~GeoDataItemIcon()
{
delete d;
diff --git a/src/lib/marble/geodata/data/GeoDataItemIcon.h \
b/src/lib/marble/geodata/data/GeoDataItemIcon.h index 85b50b4..43dae7e 100644
--- a/src/lib/marble/geodata/data/GeoDataItemIcon.h
+++ b/src/lib/marble/geodata/data/GeoDataItemIcon.h
@@ -30,6 +30,8 @@ public:
GeoDataItemIcon( const GeoDataItemIcon &other );
GeoDataItemIcon& operator=( const GeoDataItemIcon &other );
+ bool operator==( const GeoDataItemIcon &other );
+ bool operator!=( const GeoDataItemIcon &other );
~GeoDataItemIcon();
diff --git a/src/lib/marble/geodata/data/GeoDataLink.cpp \
b/src/lib/marble/geodata/data/GeoDataLink.cpp index e6a33b7..57c4502 100644
--- a/src/lib/marble/geodata/data/GeoDataLink.cpp
+++ b/src/lib/marble/geodata/data/GeoDataLink.cpp
@@ -18,19 +18,12 @@ class GeoDataLinkPrivate
{
public:
QString m_href;
-
GeoDataLink::RefreshMode m_refreshMode;
-
qreal m_refreshInterval;
-
GeoDataLink::ViewRefreshMode m_viewRefreshMode;
-
qreal m_viewRefreshTime;
-
qreal m_viewBoundScale;
-
QString m_viewFormat;
-
QString m_httpQuery;
GeoDataLinkPrivate();
@@ -67,6 +60,17 @@ GeoDataLink &GeoDataLink::operator=( const GeoDataLink &other )
return *this;
}
+bool GeoDataLink::operator==( const GeoDataLink& other )
+{
+ return ( d->m_href == other.d->m_href ) && ( d->m_refreshMode == \
other.d->m_refreshMode ) && ( d->m_refreshInterval == other.d->m_refreshInterval ) && \
( d->m_viewRefreshMode == other.d->m_viewRefreshMode ) + && ( \
d->m_viewRefreshTime == other.d->m_viewRefreshTime ) && ( d->m_viewBoundScale == \
other.d->m_viewBoundScale ) && ( d->m_viewFormat == other.d->m_viewFormat ) && ( \
d->m_httpQuery == other.d->m_httpQuery ); +}
+
+bool GeoDataLink::operator!=( const GeoDataLink& other )
+{
+ return !this->operator==(other);
+}
+
GeoDataLink::~GeoDataLink()
{
delete d;
diff --git a/src/lib/marble/geodata/data/GeoDataLink.h \
b/src/lib/marble/geodata/data/GeoDataLink.h index 52c80d2..42db730 100644
--- a/src/lib/marble/geodata/data/GeoDataLink.h
+++ b/src/lib/marble/geodata/data/GeoDataLink.h
@@ -40,6 +40,8 @@ public:
GeoDataLink( const GeoDataLink &other );
GeoDataLink& operator=( const GeoDataLink &other );
+ bool operator==( const GeoDataLink &other );
+ bool operator!=( const GeoDataLink &other );
~GeoDataLink();
diff --git a/tests/TestEquality.cpp b/tests/TestEquality.cpp
index 12f3f03..7a37b02 100644
--- a/tests/TestEquality.cpp
+++ b/tests/TestEquality.cpp
@@ -19,6 +19,11 @@
#include <GeoDataBalloonStyle.h>
#include <GeoDataCamera.h>
#include <GeoDataColorStyle.h>
+#include <GeoDataFlyTo.h>
+#include <GeoDataHotSpot.h>
+#include <GeoDataImagePyramid.h>
+#include <GeoDataItemIcon.h>
+#include <GeoDataLink.h>
#include "TestUtils.h"
using namespace Marble;
@@ -36,6 +41,11 @@ private slots:
void balloonTest();
void colorTest();
void cameraTest();
+ void flyToTest();
+ void hotSpotTest();
+ void imagePyramidTest();
+ void itemIconTest();
+ void linkTest();
};
@@ -247,6 +257,103 @@ void TestEquality::cameraTest()
QVERIFY( camera1 != camera2 );
}
+void TestEquality::flyToTest()
+{
+ GeoDataFlyTo flyTo1, flyTo2;
+
+ flyTo1.setDuration(7.6);
+ flyTo1.setFlyToMode(GeoDataFlyTo::Bounce);
+
+ flyTo2.setDuration( 5.8 );
+ flyTo1.setFlyToMode( GeoDataFlyTo::Smooth );
+
+ QCOMPARE( flyTo1, flyTo1 );
+ QCOMPARE( flyTo2, flyTo2 );
+ QCOMPARE( flyTo1 == flyTo2, false );
+ QVERIFY( flyTo1 != flyTo2 );
+}
+
+void TestEquality::hotSpotTest()
+{
+ QPointF point1, point2;
+ point1.setX( 5 );
+ point1.setY( 4 );
+ point2.setX( 6 );
+ point2.setY( 2 );
+
+ GeoDataHotSpot hotSpot1, hotSpot2;
+ hotSpot1.setHotSpot( point1, GeoDataHotSpot::Fraction, GeoDataHotSpot::Fraction \
); + hotSpot2.setHotSpot( point2, GeoDataHotSpot::Pixels, GeoDataHotSpot::Pixels \
); +
+ QCOMPARE( &hotSpot1, &hotSpot1 );
+ QCOMPARE( &hotSpot2, &hotSpot2 );
+ QCOMPARE( hotSpot1 == hotSpot2, false );
+ QVERIFY( hotSpot1 != hotSpot2 );
+}
+
+void TestEquality::imagePyramidTest()
+{
+ GeoDataImagePyramid pyramid1, pyramid2;
+ pyramid1.setGridOrigin( GeoDataImagePyramid::LowerLeft );
+ pyramid1.setMaxHeight( 40 );
+ pyramid1.setMaxWidth( 30 );
+ pyramid1.setTileSize( 20 );
+
+ pyramid2.setGridOrigin( GeoDataImagePyramid::UpperLeft );
+ pyramid2.setMaxHeight( 50 );
+ pyramid2.setMaxWidth( 80 );
+ pyramid2.setTileSize( 30 );
+
+ QCOMPARE( &pyramid1, &pyramid1 );
+ QCOMPARE( &pyramid2, &pyramid2 );
+ QCOMPARE( pyramid1 == pyramid2, false );
+ QVERIFY( pyramid1 != pyramid2 );
+}
+
+void TestEquality::itemIconTest()
+{
+ GeoDataItemIcon icon1, icon2;
+ QImage img1( 10, 20, QImage::Format_Mono );
+ QImage img2( 30, 50, QImage::Format_Mono );
+
+ icon1.setIcon( img1 );
+ icon1.setIconPath( "some/path" );
+ icon1.setState( GeoDataItemIcon::Open );
+
+ icon2.setIcon( img2 );
+ icon2.setIconPath( "some/other/path" );
+ icon2.setState( GeoDataItemIcon::Closed );
+
+ QCOMPARE( &icon1, &icon1 );
+ QCOMPARE( &icon2, &icon2 );
+ QCOMPARE( &icon1 == &icon2, false );
+ QVERIFY( &icon1 != &icon2 );
+
+}
+
+void TestEquality::linkTest()
+{
+ GeoDataLink link1, link2;
+
+ link1.setHref("some/example/href.something");
+ link1.setRefreshInterval( 23 );
+ link1.setRefreshMode( GeoDataLink::OnChange );
+ link1.setViewBoundScale( 50 );
+ link1.setViewRefreshTime( 30 );
+
+ link2.setHref("some/other/example/href.something");
+ link1.setRefreshInterval( 32 );
+ link1.setRefreshMode(GeoDataLink::OnChange);
+ link1.setViewBoundScale( 60 );
+ link1.setViewRefreshTime( 40 );
+
+ QCOMPARE( &link1, &link1 );
+ QCOMPARE( &link2, &link2 );
+ QCOMPARE( &link1 == &link2, false );
+ QVERIFY( &link1 != &link2 );
+}
+
+
QTEST_MAIN( TestEquality )
#include "TestEquality.moc"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic