diff options
author | David Laing <david.laing@nokia.com> | 2009-12-31 09:50:28 +1000 |
---|---|---|
committer | David Laing <david.laing@nokia.com> | 2009-12-31 09:50:28 +1000 |
commit | 6d78131a85996eb6f9dceed517677777ff84bca7 (patch) | |
tree | b0b09b609fd2ef79fbcc8cd9b867b04a5113650f | |
parent | 68b00842cdc845fb0eca4a7d9dd8cb9832cadb3f (diff) |
More API changes
-rw-r--r-- | examples/fetchgooglemaps/mapwindow.cpp | 4 | ||||
-rw-r--r-- | src/location/qgeocoordinate.cpp | 16 | ||||
-rw-r--r-- | src/location/qgeopositioninfo.cpp | 58 | ||||
-rw-r--r-- | src/location/qgeopositioninfo.h | 13 | ||||
-rw-r--r-- | src/location/qgeopositioninfosource_s60.cpp | 16 | ||||
-rw-r--r-- | src/location/qgeopositioninfosource_wince.cpp | 6 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfo.cpp | 46 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfo.h | 10 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfosource_s60.cpp | 4 | ||||
-rw-r--r-- | src/location/qgeosatelliteinfosource_wince.cpp | 4 | ||||
-rw-r--r-- | src/location/qlocationutils.cpp | 10 | ||||
-rw-r--r-- | tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp | 52 | ||||
-rw-r--r-- | tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp | 104 | ||||
-rw-r--r-- | tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp | 98 | ||||
-rw-r--r-- | tests/auto/qlocationutils/tst_qlocationutils.cpp | 8 |
15 files changed, 224 insertions, 225 deletions
diff --git a/examples/fetchgooglemaps/mapwindow.cpp b/examples/fetchgooglemaps/mapwindow.cpp index cd25db2e96..0133d02670 100644 --- a/examples/fetchgooglemaps/mapwindow.cpp +++ b/examples/fetchgooglemaps/mapwindow.cpp @@ -89,8 +89,8 @@ void MapWindow::positionUpdated(const QGeoPositionInfo &info) { QString heading = "?"; QString speed = "?"; - if (info.hasProperty(QGeoPositionInfo::Heading)) - heading = QString("%1%2").arg(info.property(QGeoPositionInfo::Heading)).arg(QChar(0x00b0)); + if (info.hasProperty(QGeoPositionInfo::Direction)) + heading = QString("%1%2").arg(info.property(QGeoPositionInfo::Direction)).arg(QChar(0x00b0)); if (info.hasProperty(QGeoPositionInfo::GroundSpeed)) speed = QString::number(info.property(QGeoPositionInfo::GroundSpeed) * 3.6, 'f', 1); posLabel->setText(tr("Position: %1").arg(info.coordinate().toString())); diff --git a/src/location/qgeocoordinate.cpp b/src/location/qgeocoordinate.cpp index 183e31b056..35fedf920d 100644 --- a/src/location/qgeocoordinate.cpp +++ b/src/location/qgeocoordinate.cpp @@ -105,8 +105,8 @@ public: \enum QGeoCoordinate::CoordinateFormat Defines the possible formatting options for toString(). - \value DecimalDegrees Returns a string representation of the coordinates in decimal degrees format. - \value DecimalDegreesWithHemisphere Returns a string representation of the coordinates in decimal degrees format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates. + \value Degrees Returns a string representation of the coordinates in decimal degrees format. + \value DegreesWithHemisphere Returns a string representation of the coordinates in decimal degrees format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates. \value DegreesMinutes Returns a string representation of the coordinates in degrees-minutes format. \value DegreesMinutesWithHemisphere Returns a string representation of the coordinates in degrees-minutes format, using 'N', 'S', 'E' or 'W' to indicate the hemispheres of the coordinates. \value DegreesMinutesSeconds Returns a string representation of the coordinates in degrees-minutes-seconds format. @@ -384,10 +384,10 @@ qreal QGeoCoordinate::azimuthTo(const QGeoCoordinate &other) const \o \a format value \o Returned string \row - \o \l DecimalDegrees + \o \l Degrees \o -27.46758\unicode{0xB0}, 153.02789\unicode{0xB0}, 28.1m \row - \o \l DecimalDegreesWithHemisphere + \o \l DegreesWithHemisphere \o 27.46758\unicode{0xB0} S, 153.02789\unicode{0xB0} E, 28.1m \row \o \l DegreesMinutes @@ -420,8 +420,8 @@ QString QGeoCoordinate::toString(CoordinateFormat format) const QChar symbol(0x00B0); // degrees symbol switch (format) { - case DecimalDegrees: - case DecimalDegreesWithHemisphere: + case Degrees: + case DegreesWithHemisphere: { latStr = QString::number(absLat, 'f', 5) + symbol; longStr = QString::number(absLng, 'f', 5) + symbol; @@ -466,7 +466,7 @@ QString QGeoCoordinate::toString(CoordinateFormat format) const // now add the "-" to the start, or append the hemisphere char switch (format) { - case DecimalDegrees: + case Degrees: case DegreesMinutes: case DegreesMinutesSeconds: { @@ -476,7 +476,7 @@ QString QGeoCoordinate::toString(CoordinateFormat format) const longStr.insert(0, "-"); break; } - case DecimalDegreesWithHemisphere: + case DegreesWithHemisphere: case DegreesMinutesWithHemisphere: case DegreesMinutesSecondsWithHemisphere: { diff --git a/src/location/qgeopositioninfo.cpp b/src/location/qgeopositioninfo.cpp index 10d185f2e9..7e47a6e1b5 100644 --- a/src/location/qgeopositioninfo.cpp +++ b/src/location/qgeopositioninfo.cpp @@ -51,7 +51,7 @@ class QGeoPositionInfoPrivate public: QDateTime dateTime; QGeoCoordinate coord; - QHash<int, qreal> doubleProps; + QHash<int, qreal> doubleAttribs; }; /*! @@ -67,10 +67,10 @@ public: */ /*! - \enum QGeoPositionInfo::Property - Defines the properties for positional information. + \enum QGeoPositionInfo::Attribute + Defines the attributes for positional information. - \value Heading The bearing to true north, in degrees. + \value Direction The bearing to true north, in degrees. \value GroundSpeed The ground speed, in metres/sec. \value VerticalSpeed The vertical speed, in metres/sec. \value MagneticVariation The angle between the horizontal component of the magnetic field and true north, in degrees. Also known as magnetic declination. A positive value indicates a clockwise direction from true north and a negative value indicates a counter-clockwise direction. @@ -125,7 +125,7 @@ QGeoPositionInfo &QGeoPositionInfo::operator=(const QGeoPositionInfo &other) d->dateTime = other.d->dateTime; d->coord = other.d->coord; - d->doubleProps = other.d->doubleProps; + d->doubleAttribs = other.d->doubleAttribs; return *this; } @@ -138,7 +138,7 @@ bool QGeoPositionInfo::operator==(const QGeoPositionInfo &other) const { return d->dateTime == other.d->dateTime && d->coord == other.d->coord - && d->doubleProps == other.d->doubleProps; + && d->doubleAttribs == other.d->doubleAttribs; } /*! @@ -205,44 +205,44 @@ QGeoCoordinate QGeoPositionInfo::coordinate() const } /*! - Sets the value for \a property to \a value. + Sets the value for \a attribute to \a value. - \sa property() + \sa attribute() */ -void QGeoPositionInfo::setProperty(Property property, qreal value) +void QGeoPositionInfo::setAttribute(Attribute attribute, qreal value) { - d->doubleProps[int(property)] = value; + d->doubleAttribs[int(attribute)] = value; } /*! - Returns the value of the specified \a property as a qreal value. + Returns the value of the specified \a attribute as a qreal value. Returns -1 if the value has not been set. - \sa hasProperty(), setProperty() + \sa hasAttribute(), setAttribute() */ -qreal QGeoPositionInfo::property(Property property) const +qreal QGeoPositionInfo::attribute(Attribute attribute) const { - if (d->doubleProps.contains(int(property))) - return d->doubleProps[int(property)]; + if (d->doubleAttribs.contains(int(attribute))) + return d->doubleAttribs[int(attribute)]; return -1; } /*! - Removes the specified \a property and its value. + Removes the specified \a attribute and its value. */ -void QGeoPositionInfo::removeProperty(Property property) +void QGeoPositionInfo::removeAttribute(Attribute attribute) { - d->doubleProps.remove(int(property)); + d->doubleAttribs.remove(int(attribute)); } /*! - Returns true if the specified \a property is present for this + Returns true if the specified \a attribute is present for this QGeoPositionInfo object. */ -bool QGeoPositionInfo::hasProperty(Property property) const +bool QGeoPositionInfo::hasAttribute(Attribute attribute) const { - return d->doubleProps.contains(int(property)); + return d->doubleAttribs.contains(int(attribute)); } #ifndef QT_NO_DEBUG_STREAM @@ -252,12 +252,12 @@ QDebug operator<<(QDebug dbg, const QGeoPositionInfo &update) dbg.nospace() << ", "; dbg.nospace() << update.d->coord; - QList<int> props = update.d->doubleProps.keys(); - for (int i=0; i<props.count(); i++) { + QList<int> attribs = update.d->doubleAttribs.keys(); + for (int i = 0; i < props.count(); i++) { dbg.nospace() << ", "; - switch (props[i]) { - case QGeoPositionInfo::Heading: - dbg.nospace() << "Heading="; + switch (attribs[i]) { + case QGeoPositionInfo::Direction: + dbg.nospace() << "Direction="; break; case QGeoPositionInfo::GroundSpeed: dbg.nospace() << "GroundSpeed="; @@ -275,7 +275,7 @@ QDebug operator<<(QDebug dbg, const QGeoPositionInfo &update) dbg.nospace() << "VerticalAccuracy="; break; } - dbg.nospace() << update.d->doubleProps[props[i]]; + dbg.nospace() << update.d->doubleAttribs[attribs[i]]; } dbg.nospace() << ')'; return dbg; @@ -296,7 +296,7 @@ QDataStream &operator<<(QDataStream &stream, const QGeoPositionInfo &info) { stream << info.d->dateTime; stream << info.d->coord; - stream << info.d->doubleProps; + stream << info.d->doubleAttribs; return stream; } #endif @@ -316,7 +316,7 @@ QDataStream &operator>>(QDataStream &stream, QGeoPositionInfo &info) { stream >> info.d->dateTime; stream >> info.d->coord; - stream >> info.d->doubleProps; + stream >> info.d->doubleAttribs; return stream; } #endif diff --git a/src/location/qgeopositioninfo.h b/src/location/qgeopositioninfo.h index 9078fba295..b393965fe6 100644 --- a/src/location/qgeopositioninfo.h +++ b/src/location/qgeopositioninfo.h @@ -59,8 +59,8 @@ class QGeoPositionInfoPrivate; class Q_LOCATION_EXPORT QGeoPositionInfo { public: - enum Property { - Heading, + enum Attribute { + Direction, GroundSpeed, VerticalSpeed, MagneticVariation, @@ -86,11 +86,10 @@ public: void setCoordinate(const QGeoCoordinate &coordinate); QGeoCoordinate coordinate() const; - void setProperty(Property property, qreal value); - qreal property(Property property) const; - void removeProperty(Property property); - - bool hasProperty(Property property) const; + void setAttribute(Attribute attribute, qreal value); + qreal attribute(Attribute attribute) const; + void removeAttribute(Attribute attribute); + bool hasAttribute(Attribute attribute) const; private: #ifndef QT_NO_DEBUG_STREAM diff --git a/src/location/qgeopositioninfosource_s60.cpp b/src/location/qgeopositioninfosource_s60.cpp index 9d3b72b879..42370c1073 100644 --- a/src/location/qgeopositioninfosource_s60.cpp +++ b/src/location/qgeopositioninfosource_s60.cpp @@ -183,10 +183,10 @@ QGeoPositionInfo CQGeoPositionInfoSourceS60::getLastknownPositionS60(TPositionMo posUpdate.setDateTime(dt); //store the horizontal accuracy - posUpdate.setProperty(QGeoPositionInfo::HorizontalAccuracy,pos.HorizontalAccuracy()); + posUpdate.setAttribute(QGeoPositionInfo::HorizontalAccuracy,pos.HorizontalAccuracy()); //store the vertical accuracy - posUpdate.setProperty(QGeoPositionInfo::VerticalAccuracy,pos.VerticalAccuracy()); + posUpdate.setAttribute(QGeoPositionInfo::VerticalAccuracy,pos.VerticalAccuracy()); } } return posUpdate; @@ -652,33 +652,33 @@ void CQGeoPositionInfoSourceS60::TPositionInfo2QGeoPositionInfo( aPosInfo2.setDateTime(dt); //store the horizontal accuracy - aPosInfo2.setProperty(QGeoPositionInfo::HorizontalAccuracy,pos.HorizontalAccuracy()); + aPosInfo2.setAttribute(QGeoPositionInfo::HorizontalAccuracy,pos.HorizontalAccuracy()); //store the vertical accuracy - aPosInfo2.setProperty(QGeoPositionInfo::VerticalAccuracy,pos.VerticalAccuracy()); + aPosInfo2.setAttribute(QGeoPositionInfo::VerticalAccuracy,pos.VerticalAccuracy()); //check for the horizontal speed if (aPosInfo1->IsFieldAvailable(EPositionFieldHorizontalSpeed)) { aPosInfo1->GetValue(EPositionFieldHorizontalSpeed,val); - aPosInfo2.setProperty(QGeoPositionInfo::GroundSpeed,val); + aPosInfo2.setAttribute(QGeoPositionInfo::GroundSpeed,val); } //check for the vertcal speed if (aPosInfo1->IsFieldAvailable(EPositionFieldVerticalSpeed)) { aPosInfo1->GetValue(EPositionFieldVerticalSpeed,val); - aPosInfo2.setProperty(QGeoPositionInfo::VerticalSpeed,val); + aPosInfo2.setAttribute(QGeoPositionInfo::VerticalSpeed,val); } //check for the magnetic variation if (aPosInfo1->IsFieldAvailable(EPositionFieldMagneticCourseError)) { aPosInfo1->GetValue(EPositionFieldMagneticCourseError,val); - aPosInfo2.setProperty(QGeoPositionInfo::MagneticVariation,val); + aPosInfo2.setAttribute(QGeoPositionInfo::MagneticVariation,val); } //check for the heading if (aPosInfo1->IsFieldAvailable(EPositionFieldHeading)) { aPosInfo1->GetValue(EPositionFieldHeading,val); - aPosInfo2.setProperty(QGeoPositionInfo::Heading,val); + aPosInfo2.setAttribute(QGeoPositionInfo::Direction,val); } } // diff --git a/src/location/qgeopositioninfosource_wince.cpp b/src/location/qgeopositioninfosource_wince.cpp index 387f0c341b..d056f3cafc 100644 --- a/src/location/qgeopositioninfosource_wince.cpp +++ b/src/location/qgeopositioninfosource_wince.cpp @@ -168,13 +168,13 @@ void QGeoPositionInfoSourceWinCE::dataUpdated(GPS_POSITION data) // The following properties are optional, and so are set if the data is present and valid in // the GPS_POSITION structure. if ((data.dwValidFields & GPS_VALID_SPEED) != 0) - pos.setProperty(QGeoPositionInfo::GroundSpeed, data.flSpeed); + pos.setAttribute(QGeoPositionInfo::GroundSpeed, data.flSpeed); if ((data.dwValidFields & GPS_VALID_HEADING) != 0) - pos.setProperty(QGeoPositionInfo::Heading, data.flHeading); + pos.setAttribute(QGeoPositionInfo::Direction, data.flHeading); if ((data.dwValidFields & GPS_VALID_MAGNETIC_VARIATION) != 0) - pos.setProperty(QGeoPositionInfo::MagneticVariation, data.dblMagneticVariation); + pos.setAttribute(QGeoPositionInfo::MagneticVariation, data.dblMagneticVariation); lastPosition = pos; emit positionUpdated(pos); diff --git a/src/location/qgeosatelliteinfo.cpp b/src/location/qgeosatelliteinfo.cpp index 775f86ed55..ad93b55598 100644 --- a/src/location/qgeosatelliteinfo.cpp +++ b/src/location/qgeosatelliteinfo.cpp @@ -50,7 +50,7 @@ class QGeoSatelliteInfoPrivate public: int prn; int signal; - QHash<int, qreal> doubleProps; + QHash<int, qreal> doubleAttribs; }; @@ -63,8 +63,8 @@ public: */ /*! - \enum QGeoSatelliteInfo::Property - Defines the properties for the satellite information. + \enum QGeoSatelliteInfo::Attribute + Defines the attributes for the satellite information. \value Elevation The elevation of the satellite, in degrees. \value Azimuth The azimuth to true north, in degrees. @@ -109,7 +109,7 @@ QGeoSatelliteInfo &QGeoSatelliteInfo::operator=(const QGeoSatelliteInfo &other) d->prn = other.d->prn; d->signal = other.d->signal; - d->doubleProps = other.d->doubleProps; + d->doubleAttribs = other.d->doubleAttribs; return *this; } @@ -121,7 +121,7 @@ bool QGeoSatelliteInfo::operator==(const QGeoSatelliteInfo &other) const { return d->prn == other.d->prn && d->signal == other.d->signal - && d->doubleProps == other.d->doubleProps; + && d->doubleAttribs == other.d->doubleAttribs; } /*! @@ -167,41 +167,41 @@ int QGeoSatelliteInfo::signalStrength() const } /*! - Sets the value for \a property to \a value. + Sets the value for \a attribute to \a value. */ -void QGeoSatelliteInfo::setProperty(Property property, qreal value) +void QGeoSatelliteInfo::setAttribute(Attribute attribute, qreal value) { - d->doubleProps[int(property)] = value; + d->doubleAttribs[int(attribute)] = value; } /*! - Returns the value of the specified \a property as a qreal value. + Returns the value of the specified \a attribute as a qreal value. Returns -1 if the value has not been set. - \sa hasProperty(), setProperty() + \sa hasAttribute(), setAttribute() */ -qreal QGeoSatelliteInfo::property(Property property) const +qreal QGeoSatelliteInfo::attribute(Attribute attribute) const { - if (d->doubleProps.contains(int(property))) - return d->doubleProps[int(property)]; + if (d->doubleAttribs.contains(int(attribute))) + return d->doubleAttribs[int(attribute)]; return -1; } /*! - Removes the specified \a property and its value. + Removes the specified \a attribute and its value. */ -void QGeoSatelliteInfo::removeProperty(Property property) +void QGeoSatelliteInfo::removeAttribute(Attribute attribute) { - d->doubleProps.remove(int(property)); + d->doubleAttribs.remove(int(attribute)); } /*! - Returns true if the specified \a property is present in this update. + Returns true if the specified \a attribute is present in this update. */ -bool QGeoSatelliteInfo::hasProperty(Property property) const +bool QGeoSatelliteInfo::hasAttribute(Attribute attribute) const { - return d->doubleProps.contains(int(property)); + return d->doubleAttribs.contains(int(attribute)); } #ifndef QT_NO_DEBUG_STREAM @@ -211,10 +211,10 @@ QDebug operator<<(QDebug dbg, const QGeoSatelliteInfo &info) dbg.nospace() << ", signal-strength="; dbg.nospace() << info.d->signal; - QList<int> props = info.d->doubleProps.keys(); - for (int i=0; i<props.count(); i++) { + QList<int> attribs = info.d->doubleAttribs.keys(); + for (int i = 0; i < props.count(); i++) { dbg.nospace() << ", "; - switch (props[i]) { + switch (attribs[i]) { case QGeoSatelliteInfo::Elevation: dbg.nospace() << "Elevation="; break; @@ -222,7 +222,7 @@ QDebug operator<<(QDebug dbg, const QGeoSatelliteInfo &info) dbg.nospace() << "Azimuth="; break; } - dbg.nospace() << info.d->doubleProps[props[i]]; + dbg.nospace() << info.d->doubleAttribs[attribs[i]]; } dbg.nospace() << ')'; return dbg; diff --git a/src/location/qgeosatelliteinfo.h b/src/location/qgeosatelliteinfo.h index 8b204b8541..2813ed0e8c 100644 --- a/src/location/qgeosatelliteinfo.h +++ b/src/location/qgeosatelliteinfo.h @@ -55,7 +55,7 @@ class QGeoSatelliteInfoPrivate; class Q_LOCATION_EXPORT QGeoSatelliteInfo { public: - enum Property { + enum Attribute { Elevation, Azimuth }; @@ -75,11 +75,11 @@ public: void setSignalStrength(int signalStrength); int signalStrength() const; - void setProperty(Property property, qreal value); - qreal property(Property property) const; - void removeProperty(Property property); + void setAttribute(Attribute attribute, qreal value); + qreal attribute(Attribute attribute) const; + void removeAttribute(Attribute attribute); - bool hasProperty(Property property) const; + bool hasAttribute(Attribute attribute) const; private: #ifndef QT_NO_DEBUG_STREAM diff --git a/src/location/qgeosatelliteinfosource_s60.cpp b/src/location/qgeosatelliteinfosource_s60.cpp index fbad929c2c..f0667c2778 100644 --- a/src/location/qgeosatelliteinfosource_s60.cpp +++ b/src/location/qgeosatelliteinfosource_s60.cpp @@ -473,8 +473,8 @@ void CQGeoSatelliteInfoSourceS60::TPositionSatelliteInfo2QGeoSatelliteInfo( aSatInfo.GetSatelliteData(i,satData); qInfo.setSignalStrength(satData.SignalStrength()); qInfo.setPrnNumber(satData.SatelliteId()); - qInfo.setProperty(QGeoSatelliteInfo::Elevation,satData.Elevation()); - qInfo.setProperty(QGeoSatelliteInfo::Azimuth,satData.Azimuth()); + qInfo.setAttribute(QGeoSatelliteInfo::Elevation,satData.Elevation()); + qInfo.setAttribute(QGeoSatelliteInfo::Azimuth,satData.Azimuth()); if (satData.IsUsed() == TRUE) { qListSatInUse.append(qInfo); } diff --git a/src/location/qgeosatelliteinfosource_wince.cpp b/src/location/qgeosatelliteinfosource_wince.cpp index 21892ed063..e3847802f9 100644 --- a/src/location/qgeosatelliteinfosource_wince.cpp +++ b/src/location/qgeosatelliteinfosource_wince.cpp @@ -133,12 +133,12 @@ void QGeoSatelliteInfoSourceWinCE::dataUpdated(GPS_POSITION data) // The following properties are optional, and so are set if the data is present and valid // in the GPS_POSITION structure. if ((data.dwValidFields & GPS_VALID_SATELLITES_IN_VIEW_AZIMUTH) != 0) { - satellite.setProperty(QGeoSatelliteInfo::Azimuth, + satellite.setAttribute(QGeoSatelliteInfo::Azimuth, data.rgdwSatellitesInViewAzimuth[i]); } if ((data.dwValidFields & GPS_VALID_SATELLITES_IN_VIEW_ELEVATION) != 0) { - satellite.setProperty(QGeoSatelliteInfo::Elevation, + satellite.setAttribute(QGeoSatelliteInfo::Elevation, data.rgdwSatellitesInViewElevation[i]); } diff --git a/src/location/qlocationutils.cpp b/src/location/qlocationutils.cpp index 9ca0705814..fe61ca4ab1 100644 --- a/src/location/qlocationutils.cpp +++ b/src/location/qlocationutils.cpp @@ -157,12 +157,12 @@ static void qlocationutils_readRmc(const char *data, int size, QGeoPositionInfo if (parts.count() > 7 && parts[7].count() > 0) { value = parts[7].toDouble(&parsed); if (parsed) - info->setProperty(QGeoPositionInfo::GroundSpeed, qreal(value * 1.852 / 3.6)); // knots -> m/s + info->setAttribute(QGeoPositionInfo::GroundSpeed, qreal(value * 1.852 / 3.6)); // knots -> m/s } if (parts.count() > 8 && parts[8].count() > 0) { value = parts[8].toDouble(&parsed); if (parsed) - info->setProperty(QGeoPositionInfo::Heading, qreal(value)); + info->setAttribute(QGeoPositionInfo::Direction, qreal(value)); } if (parts.count() > 11 && parts[11].count() == 1 && (parts[11][0] == 'E' || parts[11][0] == 'W')) { @@ -170,7 +170,7 @@ static void qlocationutils_readRmc(const char *data, int size, QGeoPositionInfo if (parsed) { if (parts[11][0] == 'W') value *= -1; - info->setProperty(QGeoPositionInfo::MagneticVariation, qreal(value)); + info->setAttribute(QGeoPositionInfo::MagneticVariation, qreal(value)); } } @@ -193,12 +193,12 @@ static void qlocationutils_readVtg(const char *data, int size, QGeoPositionInfo if (parts.count() > 1 && parts[1].count() > 0) { value = parts[1].toDouble(&parsed); if (parsed) - info->setProperty(QGeoPositionInfo::Heading, qreal(value)); + info->setAttribute(QGeoPositionInfo::Direction, qreal(value)); } if (parts.count() > 7 && parts[7].count() > 0) { value = parts[7].toDouble(&parsed); if (parsed) - info->setProperty(QGeoPositionInfo::GroundSpeed, qreal(value / 3.6)); // km/h -> m/s + info->setAttribute(QGeoPositionInfo::GroundSpeed, qreal(value / 3.6)); // km/h -> m/s } } diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp index a710dc7fe8..cd9a50207f 100644 --- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp +++ b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp @@ -534,10 +534,10 @@ private slots: QGeoCoordinate allZero(0.0, 0.0, 0.0); QTest::newRow("empty, dd, no hemisphere") - << empty << QGeoCoordinate::DecimalDegrees + << empty << QGeoCoordinate::Degrees << QString(); QTest::newRow("empty, dd, hemisphere") - << empty << QGeoCoordinate::DecimalDegreesWithHemisphere + << empty << QGeoCoordinate::DegreesWithHemisphere << QString(); QTest::newRow("empty, dm, no hemisphere") << empty << QGeoCoordinate::DegreesMinutes @@ -553,10 +553,10 @@ private slots: << QString(); QTest::newRow("too low, dd, no hemisphere") - << toolow << QGeoCoordinate::DecimalDegrees + << toolow << QGeoCoordinate::Degrees << QString(); QTest::newRow("too low, dd, hemisphere") - << toolow << QGeoCoordinate::DecimalDegreesWithHemisphere + << toolow << QGeoCoordinate::DegreesWithHemisphere << QString(); QTest::newRow("too low, dm, no hemisphere") << toolow << QGeoCoordinate::DegreesMinutes @@ -572,10 +572,10 @@ private slots: << QString(); QTest::newRow("too high, dd, no hemisphere") - << toohigh << QGeoCoordinate::DecimalDegrees + << toohigh << QGeoCoordinate::Degrees << QString(); QTest::newRow("too high, dd, hemisphere") - << toohigh << QGeoCoordinate::DecimalDegreesWithHemisphere + << toohigh << QGeoCoordinate::DegreesWithHemisphere << QString(); QTest::newRow("too high, dm, no hemisphere") << toohigh << QGeoCoordinate::DegreesMinutes @@ -591,10 +591,10 @@ private slots: << QString(); QTest::newRow("zeroLatLong, dd, no hemisphere") - << zeroLatLong << QGeoCoordinate::DecimalDegrees + << zeroLatLong << QGeoCoordinate::Degrees << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB); QTest::newRow("zeroLatLong, dd, hemisphere") - << zeroLatLong << QGeoCoordinate::DecimalDegreesWithHemisphere + << zeroLatLong << QGeoCoordinate::DegreesWithHemisphere << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB); QTest::newRow("zeroLatLong, dm, no hemisphere") << zeroLatLong << QGeoCoordinate::DegreesMinutes @@ -610,10 +610,10 @@ private slots: << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB); QTest::newRow("allZero, dd, no hemisphere") - << allZero << QGeoCoordinate::DecimalDegrees + << allZero << QGeoCoordinate::Degrees << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB); QTest::newRow("allZero, dd, hemisphere") - << allZero << QGeoCoordinate::DecimalDegreesWithHemisphere + << allZero << QGeoCoordinate::DegreesWithHemisphere << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB); QTest::newRow("allZero, dm, no hemisphere") << allZero << QGeoCoordinate::DegreesMinutes @@ -629,10 +629,10 @@ private slots: << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB); QTest::newRow("NE, dd, no hemisphere") - << northEast << QGeoCoordinate::DecimalDegrees + << northEast << QGeoCoordinate::Degrees << QString("27.46758%1, 153.02789%1").arg(DEGREES_SYMB); QTest::newRow("NE, dd, hemisphere") - << northEast << QGeoCoordinate::DecimalDegreesWithHemisphere + << northEast << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 N, 153.02789%1 E").arg(DEGREES_SYMB); QTest::newRow("NE, dm, no hemisphere") << northEast << QGeoCoordinate::DegreesMinutes @@ -648,10 +648,10 @@ private slots: << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E").arg(DEGREES_SYMB); QTest::newRow("NE with alt, dd, no hemisphere") - << northEastWithAlt << QGeoCoordinate::DecimalDegrees + << northEastWithAlt << QGeoCoordinate::Degrees << QString("27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("NE with alt, dd, hemisphere") - << northEastWithAlt << QGeoCoordinate::DecimalDegreesWithHemisphere + << northEastWithAlt << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 N, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("NE with alt, dm, no hemisphere") << northEastWithAlt << QGeoCoordinate::DegreesMinutes @@ -667,10 +667,10 @@ private slots: << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SE, dd, no hemisphere") - << southEast << QGeoCoordinate::DecimalDegrees + << southEast << QGeoCoordinate::Degrees << QString("-27.46758%1, 153.02789%1").arg(DEGREES_SYMB); QTest::newRow("SE, dd, hemisphere") - << southEast << QGeoCoordinate::DecimalDegreesWithHemisphere + << southEast << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 S, 153.02789%1 E").arg(DEGREES_SYMB); QTest::newRow("SE, dm, no hemisphere") << southEast << QGeoCoordinate::DegreesMinutes @@ -686,10 +686,10 @@ private slots: << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E").arg(DEGREES_SYMB); QTest::newRow("SE with alt, dd, no hemisphere, 28.2341m") - << southEastWithAlt << QGeoCoordinate::DecimalDegrees + << southEastWithAlt << QGeoCoordinate::Degrees << QString("-27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SE with alt, dd, hemisphere, 28.2341m") - << southEastWithAlt << QGeoCoordinate::DecimalDegreesWithHemisphere + << southEastWithAlt << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 S, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SE with alt, dm, no hemisphere, 28.2341m") << southEastWithAlt << QGeoCoordinate::DegreesMinutes @@ -705,10 +705,10 @@ private slots: << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);; QTest::newRow("NW, dd, no hemisphere") - << northWest << QGeoCoordinate::DecimalDegrees + << northWest << QGeoCoordinate::Degrees << QString("27.46758%1, -153.02789%1").arg(DEGREES_SYMB); QTest::newRow("NW, dd, hemisphere") - << northWest << QGeoCoordinate::DecimalDegreesWithHemisphere + << northWest << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 N, 153.02789%1 W").arg(DEGREES_SYMB); QTest::newRow("NW, dm, no hemisphere") << northWest << QGeoCoordinate::DegreesMinutes @@ -724,10 +724,10 @@ private slots: << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W").arg(DEGREES_SYMB); QTest::newRow("NW with alt, dd, no hemisphere, 28.2341m") - << northWestWithAlt << QGeoCoordinate::DecimalDegrees + << northWestWithAlt << QGeoCoordinate::Degrees << QString("27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("NW with alt, dd, hemisphere, 28.2341m") - << northWestWithAlt << QGeoCoordinate::DecimalDegreesWithHemisphere + << northWestWithAlt << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 N, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("NW with alt, dm, no hemisphere, 28.2341m") << northWestWithAlt << QGeoCoordinate::DegreesMinutes @@ -743,10 +743,10 @@ private slots: << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SW, dd, no hemisphere") - << southWest << QGeoCoordinate::DecimalDegrees + << southWest << QGeoCoordinate::Degrees << QString("-27.46758%1, -153.02789%1").arg(DEGREES_SYMB); QTest::newRow("SW, dd, hemisphere") - << southWest << QGeoCoordinate::DecimalDegreesWithHemisphere + << southWest << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 S, 153.02789%1 W").arg(DEGREES_SYMB); QTest::newRow("SW, dm, no hemisphere") << southWest << QGeoCoordinate::DegreesMinutes @@ -762,10 +762,10 @@ private slots: << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W").arg(DEGREES_SYMB); QTest::newRow("SW with alt, dd, no hemisphere, 28.2341m") - << southWestWithAlt << QGeoCoordinate::DecimalDegrees + << southWestWithAlt << QGeoCoordinate::Degrees << QString("-27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SW with alt, dd, hemisphere, 28.2341m") - << southWestWithAlt << QGeoCoordinate::DecimalDegreesWithHemisphere + << southWestWithAlt << QGeoCoordinate::DegreesWithHemisphere << QString("27.46758%1 S, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB); QTest::newRow("SW with alt, dm, no hemisphere, 28.2341m") << southWestWithAlt << QGeoCoordinate::DegreesMinutes diff --git a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp index a1286fca01..e9228521b4 100644 --- a/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp +++ b/tests/auto/qgeopositioninfo/tst_qgeopositioninfo.cpp @@ -50,7 +50,7 @@ QTM_USE_NAMESPACE Q_DECLARE_METATYPE(QGeoCoordinate) Q_DECLARE_METATYPE(QGeoPositionInfo) -Q_DECLARE_METATYPE(QGeoPositionInfo::Property) +Q_DECLARE_METATYPE(QGeoPositionInfo::Attribute) QByteArray tst_qgeopositioninfo_debug; @@ -88,16 +88,16 @@ QList<qreal> tst_qgeopositioninfo_qrealTestValues() return values; } -QList<QGeoPositionInfo::Property> tst_qgeopositioninfo_getProperties() +QList<QGeoPositionInfo::Attribute> tst_qgeopositioninfo_getAttributes() { - QList<QGeoPositionInfo::Property> properties; - properties << QGeoPositionInfo::Heading + QList<QGeoPositionInfo::Attribute> attributes; + attributes << QGeoPositionInfo::Direction << QGeoPositionInfo::GroundSpeed << QGeoPositionInfo::VerticalSpeed << QGeoPositionInfo::MagneticVariation << QGeoPositionInfo::HorizontalAccuracy << QGeoPositionInfo::VerticalAccuracy; - return properties; + return attributes; } @@ -106,10 +106,10 @@ class tst_QGeoPositionInfo : public QObject Q_OBJECT private: - QGeoPositionInfo infoWithProperty(QGeoPositionInfo::Property property, qreal value) + QGeoPositionInfo infoWithAttribute(QGeoPositionInfo::Attribute attribute, qreal value) { QGeoPositionInfo info; - info.setProperty(property, value); + info.setAttribute(attribute, value); return info; } @@ -122,12 +122,12 @@ private: QTest::newRow("coord") << QGeoPositionInfo(QGeoCoordinate(-27.3422,150.2342), QDateTime()); QTest::newRow("datetime") << QGeoPositionInfo(QGeoCoordinate(), QDateTime::currentDateTime()); - QList<QGeoPositionInfo::Property> properties = tst_qgeopositioninfo_getProperties(); + QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes(); QList<qreal> values = tst_qgeopositioninfo_qrealTestValues(); - for (int i=0; i<properties.count(); i++) { + for (int i=0; i<attributes.count(); i++) { for (int j=0; j<values.count(); j++) { - QTest::newRow(qPrintable(QString("Property %1 = %2").arg(properties[i]).arg(values[j]))) - << infoWithProperty(properties[i], values[j]); + QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j]))) + << infoWithAttribute(attributes[i], values[j]); } } } @@ -262,77 +262,77 @@ private slots: QTest::newRow("valid") << QGeoCoordinate(30,30); } - void property() + void attribute() { - QFETCH(QGeoPositionInfo::Property, property); + QFETCH(QGeoPositionInfo::Attribute, attribute); QFETCH(qreal, value); QGeoPositionInfo info; - QCOMPARE(info.property(property), qreal(-1.0)); + QCOMPARE(info.attribute(attribute), qreal(-1.0)); - info.setProperty(property, value); - QCOMPARE(info.property(property), value); + info.setAttribute(attribute, value); + QCOMPARE(info.attribute(attribute), value); - info.removeProperty(property); - QCOMPARE(info.property(property), qreal(-1.0)); + info.removeAttribute(attribute); + QCOMPARE(info.attribute(attribute), qreal(-1.0)); } - void property_data() + void attribute_data() { - QTest::addColumn<QGeoPositionInfo::Property>("property"); + QTest::addColumn<QGeoPositionInfo::Attribute>("attribute"); QTest::addColumn<qreal>("value"); - QList<QGeoPositionInfo::Property> properties = tst_qgeopositioninfo_getProperties(); + QList<QGeoPositionInfo::Attribute> attributes = tst_qgeopositioninfo_getAttributes(); QList<qreal> values = tst_qgeopositioninfo_qrealTestValues(); - for (int i=0; i<properties.count(); i++) { + for (int i=0; i<attributes.count(); i++) { for (int j=0; j<values.count(); j++) { - QTest::newRow(qPrintable(QString("Property %1 = %2").arg(properties[i]).arg(values[j]))) - << properties[i] << values[j]; + QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(values[j]))) + << attributes[i] << values[j]; } } } - void hasProperty() + void hasAttribute() { - QFETCH(QGeoPositionInfo::Property, property); + QFETCH(QGeoPositionInfo::Attribute, attribute); QFETCH(qreal, value); QGeoPositionInfo info; - QVERIFY(!info.hasProperty(property)); + QVERIFY(!info.hasAttribute(attribute)); - info.setProperty(property, value); - QVERIFY(info.hasProperty(property)); + info.setAttribute(attribute, value); + QVERIFY(info.hasAttribute(attribute)); - info.removeProperty(property); - QVERIFY(!info.hasProperty(property)); + info.removeAttribute(attribute); + QVERIFY(!info.hasAttribute(attribute)); } - void hasProperty_data() + void hasAttribute_data() { - property_data(); + attribute_data(); } - void removeProperty() + void removeAttribute() { - QFETCH(QGeoPositionInfo::Property, property); + QFETCH(QGeoPositionInfo::Attribute, attribute); QFETCH(qreal, value); QGeoPositionInfo info; - QVERIFY(!info.hasProperty(property)); + QVERIFY(!info.hasAttribute(attribute)); - info.setProperty(property, value); - QVERIFY(info.hasProperty(property)); + info.setAttribute(attribute, value); + QVERIFY(info.hasAttribute(attribute)); - info.removeProperty(property); - QVERIFY(!info.hasProperty(property)); + info.removeAttribute(attribute); + QVERIFY(!info.hasAttribute(attribute)); - info.setProperty(property, value); - QVERIFY(info.hasProperty(property)); + info.setAttribute(attribute, value); + QVERIFY(info.hasAttribute(attribute)); } - void removeProperty_data() + void removeAttribute_data() { - property_data(); + attribute_data(); } void datastream() @@ -380,14 +380,14 @@ private slots: << QByteArray("QGeoCoordinate(1, 1))"); QGeoPositionInfo info; - info.setProperty(QGeoPositionInfo::Heading, 1.1); - info.setProperty(QGeoPositionInfo::GroundSpeed, 2.1); - info.setProperty(QGeoPositionInfo::VerticalSpeed, 3.1); - info.setProperty(QGeoPositionInfo::MagneticVariation, 4.1); - info.setProperty(QGeoPositionInfo::HorizontalAccuracy, 5.1); - info.setProperty(QGeoPositionInfo::VerticalAccuracy, 6.1); - QTest::newRow("all properties") << info - << QByteArray("QGeoCoordinate(?, ?), Heading=1.1, GroundSpeed=2.1, VerticalSpeed=3.1, MagneticVariation=4.1, HorizontalAccuracy=5.1, VerticalAccuracy=6.1)"); + info.setAttribute(QGeoPositionInfo::Direction, 1.1); + info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.1); + info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.1); + info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.1); + info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, 5.1); + info.setAttribute(QGeoPositionInfo::VerticalAccuracy, 6.1); + QTest::newRow("all attributes") << info + << QByteArray("QGeoCoordinate(?, ?), Direction=1.1, GroundSpeed=2.1, VerticalSpeed=3.1, MagneticVariation=4.1, HorizontalAccuracy=5.1, VerticalAccuracy=6.1)"); } }; diff --git a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp index 02f1511ca5..00d5b10f02 100644 --- a/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp +++ b/tests/auto/qgeosatelliteinfo/tst_qgeosatelliteinfo.cpp @@ -50,7 +50,7 @@ QTM_USE_NAMESPACE Q_DECLARE_METATYPE(QGeoSatelliteInfo) -Q_DECLARE_METATYPE(QGeoSatelliteInfo::Property) +Q_DECLARE_METATYPE(QGeoSatelliteInfo::Attribute) QByteArray tst_qgeosatelliteinfo_debug; @@ -96,12 +96,12 @@ QList<int> tst_qgeosatelliteinfo_intTestValues() return values; } -QList<QGeoSatelliteInfo::Property> tst_qgeosatelliteinfo_getProperties() +QList<QGeoSatelliteInfo::Attribute> tst_qgeosatelliteinfo_getAttributes() { - QList<QGeoSatelliteInfo::Property> properties; - properties << QGeoSatelliteInfo::Elevation + QList<QGeoSatelliteInfo::Attribute> attributes; + attributes << QGeoSatelliteInfo::Elevation << QGeoSatelliteInfo::Azimuth; - return properties; + return attributes; } @@ -110,10 +110,10 @@ class tst_QGeoSatelliteInfo : public QObject Q_OBJECT private: - QGeoSatelliteInfo updateWithProperty(QGeoSatelliteInfo::Property property, qreal value) + QGeoSatelliteInfo updateWithAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value) { QGeoSatelliteInfo info; - info.setProperty(property, value); + info.setAttribute(attribute, value); return info; } @@ -134,11 +134,11 @@ private: QTest::newRow("signal strength") << info; } - QList<QGeoSatelliteInfo::Property> properties = tst_qgeosatelliteinfo_getProperties(); + QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes(); QList<qreal> qrealValues = tst_qgeosatelliteinfo_qrealTestValues(); - for (int i=0; i<properties.count(); i++) { - QTest::newRow(qPrintable(QString("Property %1 = %2").arg(properties[i]).arg(qrealValues[i]))) - << updateWithProperty(properties[i], qrealValues[i]); + for (int i=0; i<attributes.count(); i++) { + QTest::newRow(qPrintable(QString("Attribute %1 = %2").arg(attributes[i]).arg(qrealValues[i]))) + << updateWithAttribute(attributes[i], qrealValues[i]); } } @@ -148,9 +148,9 @@ private slots: QGeoSatelliteInfo info; QCOMPARE(info.prnNumber(), -1); QCOMPARE(info.signalStrength(), -1); - QList<QGeoSatelliteInfo::Property> properties = tst_qgeosatelliteinfo_getProperties(); - for (int i=0; i<properties.count(); i++) - QCOMPARE(info.property(properties[i]), qreal(-1.0)); + QList<QGeoSatelliteInfo::Attribute> attributes = tst_qgeosatelliteinfo_getAttributes(); + for (int i=0; i<attributes.count(); i++) + QCOMPARE(info.attribute(attributes[i]), qreal(-1.0)); } void constructor_copy() @@ -235,77 +235,77 @@ private slots: QTest::newRow(qPrintable(QString("%1").arg(intValues[i]))) << intValues[i]; } - void property() + void attribute() { - QFETCH(QGeoSatelliteInfo::Property, property); + QFETCH(QGeoSatelliteInfo::Attribute, attribute); QFETCH(qreal, value); QGeoSatelliteInfo u; - QCOMPARE(u.property(property), qreal(-1.0)); + QCOMPARE(u.attribute(attribute), qreal(-1.0)); - u.setProperty(property, value); - QCOMPARE(u.property(property), value); + u.setAttribute(attribute, value); + QCOMPARE(u.attribute(attribute), value); - u.removeProperty(property); - QCOMPARE(u.property(property), qreal(-1.0)); + u.removeAttribute(attribute); + QCOMPARE(u.attribute(attribute), qreal(-1.0)); } - void property_data() + void attribute_data() { - QTest::addColumn<QGeoSatelliteInfo::Property>("property"); + QTest::addColumn<QGeoSatelliteInfo::Attribute>("attribute"); QTest::addColumn<qreal>("value"); - QList<QGeoSatelliteInfo::Property> props; + QList<QGeoSatelliteInfo::Attribute> props; props << QGeoSatelliteInfo::Elevation << QGeoSatelliteInfo::Azimuth; for (int i=0; i<props.count(); i++) { - QTest::newRow(QTest::toString("property " + props[i])) << props[i] << qreal(-1.0); - QTest::newRow(QTest::toString("property " + props[i])) << props[i] << qreal(0.0); - QTest::newRow(QTest::toString("property " + props[i])) << props[i] << qreal(1.0); + QTest::newRow(QTest::toString("attribute " + props[i])) << props[i] << qreal(-1.0); + QTest::newRow(QTest::toString("attribute " + props[i])) << props[i] << qreal(0.0); + QTest::newRow(QTest::toString("attribute " + props[i])) << props[i] << qreal(1.0); } } - void hasProperty() + void hasAttribute() { - QFETCH(QGeoSatelliteInfo::Property, property); + QFETCH(QGeoSatelliteInfo::Attribute, attribute); QFETCH(qreal, value); QGeoSatelliteInfo u; - QVERIFY(!u.hasProperty(property)); + QVERIFY(!u.hasAttribute(attribute)); - u.setProperty(property, value); - QVERIFY(u.hasProperty(property)); + u.setAttribute(attribute, value); + QVERIFY(u.hasAttribute(attribute)); - u.removeProperty(property); - QVERIFY(!u.hasProperty(property)); + u.removeAttribute(attribute); + QVERIFY(!u.hasAttribute(attribute)); } - void hasProperty_data() + void hasAttribute_data() { - property_data(); + attribute_data(); } - void removeProperty() + void removeAttribute() { - QFETCH(QGeoSatelliteInfo::Property, property); + QFETCH(QGeoSatelliteInfo::Attribute, attribute); QFETCH(qreal, value); QGeoSatelliteInfo u; - QVERIFY(!u.hasProperty(property)); + QVERIFY(!u.hasAttribute(attribute)); - u.setProperty(property, value); - QVERIFY(u.hasProperty(property)); + u.setAttribute(attribute, value); + QVERIFY(u.hasAttribute(attribute)); - u.removeProperty(property); - QVERIFY(!u.hasProperty(property)); + u.removeAttribute(attribute); + QVERIFY(!u.hasAttribute(attribute)); - u.setProperty(property, value); - QVERIFY(u.hasProperty(property)); + u.setAttribute(attribute, value); + QVERIFY(u.hasAttribute(attribute)); } - void removeProperty_data() + void removeAttribute_data() { - property_data(); + attribute_data(); } void debug() @@ -340,12 +340,12 @@ private slots: << QByteArray("QGeoSatelliteInfo(PRN=-1, signal-strength=1)"); info = QGeoSatelliteInfo(); - info.setProperty(QGeoSatelliteInfo::Elevation, 1.1); + info.setAttribute(QGeoSatelliteInfo::Elevation, 1.1); QTest::newRow("with Elevation") << info << QByteArray("QGeoSatelliteInfo(PRN=-1, signal-strength=-1, Elevation=1.1)"); info = QGeoSatelliteInfo(); - info.setProperty(QGeoSatelliteInfo::Azimuth, 1.1); + info.setAttribute(QGeoSatelliteInfo::Azimuth, 1.1); QTest::newRow("with Azimuth") << info << QByteArray("QGeoSatelliteInfo(PRN=-1, signal-strength=-1, Azimuth=1.1)"); } diff --git a/tests/auto/qlocationutils/tst_qlocationutils.cpp b/tests/auto/qlocationutils/tst_qlocationutils.cpp index f1790053a4..b326af396b 100644 --- a/tests/auto/qlocationutils/tst_qlocationutils.cpp +++ b/tests/auto/qlocationutils/tst_qlocationutils.cpp @@ -196,7 +196,7 @@ private slots: for (int i=0; i<dblValues.count(); i++) { info = QGeoPositionInfo(); - info.setProperty(QGeoPositionInfo::Heading, dblValues[i]); + info.setProperty(QGeoPositionInfo::Direction, dblValues[i]); QTest::newRow(qPrintable(QString("RMC-heading %1").arg(dblValues[i]))) << addChecksumEtc(QString("$GPRMC,,,,,,,,%1,,,,*").arg(dblValues[i], 0, 'g', 10)) << info << false << true; } @@ -226,7 +226,7 @@ private slots: info = QGeoPositionInfo(QGeoCoordinate(-lat, lng), QDateTime(QDate(2008,4,3), QTime(22,1,25,999), Qt::UTC)); info.setProperty(QGeoPositionInfo::GroundSpeed, 8.9 * 1.852 / 3.6); - info.setProperty(QGeoPositionInfo::Heading, 47.6); + info.setProperty(QGeoPositionInfo::Direction, 47.6); info.setProperty(QGeoPositionInfo::MagneticVariation, -11.2); QTest::newRow("RMC-all") << addChecksumEtc("$GPRMC,220125.999,A,2734.7964,S,15306.0124,E,8.9,47.6,030408,11.2,W,A*") << info @@ -236,7 +236,7 @@ private slots: for (int i=0; i<dblValues.count(); i++) { info = QGeoPositionInfo(); - info.setProperty(QGeoPositionInfo::Heading, dblValues[i]); + info.setProperty(QGeoPositionInfo::Direction, dblValues[i]); QTest::newRow(qPrintable(QString("VTG-heading %1").arg(dblValues[i]))) << addChecksumEtc(QString("$GPVTG,%1,,,,,,,,*").arg(dblValues[i], 0, 'g', 10)) << info << false << true; } @@ -249,7 +249,7 @@ private slots: } info = QGeoPositionInfo(); - info.setProperty(QGeoPositionInfo::Heading, 158.7); + info.setProperty(QGeoPositionInfo::Direction, 158.7); info.setProperty(QGeoPositionInfo::GroundSpeed, 61.5 / 3.6); QTest::newRow("VTG-all") << addChecksumEtc("$GPVTG,158.7,T,169.9,M,33.2,N,61.5,K,A*") << info |