summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-07-23 17:44:10 +1000
committerQt by Nokia <qt-info@nokia.com>2012-07-31 06:18:16 +0200
commit173d55eff6f5cc5ae0391a9f26f9ff5f2bad58a4 (patch)
tree0c95ac5ce1b146d64f47e124d4932b52ed214878 /src/location
parent7e064646ff9eb88d387461a01a761f087d307eb6 (diff)
downloadqtlocation-173d55eff6f5cc5ae0391a9f26f9ff5f2bad58a4.tar.gz
Fixes for QPlaceResult + unit tests
-Comparing QPlaceResult objects resulted in a crash due to a comparison function incorrectly calling itself recursively. -Copying a QPlaceResult object did not copy the data fields from QPlaceSearchResult This patch fixes the above issues and also has a comprehensive set of unit tests for QPlaceResult. Task-number: QTBUG-26611 Change-Id: I9b6dcc90e5f061d2e268051c682291adf1b04c7b Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/location')
-rw-r--r--src/location/places/qplaceresult.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/location/places/qplaceresult.cpp b/src/location/places/qplaceresult.cpp
index 4afac20d..7f7c1b3b 100644
--- a/src/location/places/qplaceresult.cpp
+++ b/src/location/places/qplaceresult.cpp
@@ -51,7 +51,7 @@ QPlaceResultPrivate::QPlaceResultPrivate()
}
QPlaceResultPrivate::QPlaceResultPrivate(const QPlaceResultPrivate &other)
-: QPlaceSearchResultPrivate(), distance(other.distance), place(other.place),
+: QPlaceSearchResultPrivate(other), distance(other.distance), place(other.place),
sponsored(other.sponsored)
{
}
@@ -64,7 +64,8 @@ bool QPlaceResultPrivate::compare(const QPlaceSearchResultPrivate *other) const
{
const QPlaceResultPrivate *od = static_cast<const QPlaceResultPrivate *>(other);
return QPlaceSearchResultPrivate::compare(other)
- && distance == od->distance
+ && ((qIsNaN(distance) && qIsNaN(od->distance))
+ || qFuzzyCompare(distance, od->distance))
&& place == od->place
&& sponsored == od->sponsored;
}