diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-21 14:25:41 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-01-27 07:23:05 +0100 |
commit | 4f45cb18669af8e11cfab6dc546e275b05ff4ab9 (patch) | |
tree | a2138a9c249315653b9e930a565e2eeef57c3cc5 /tests/auto/qgeoareamonitor | |
parent | d8d9c4fbb6047b59b98108d6e3221206aa926ccd (diff) | |
download | qtlocation-4f45cb18669af8e11cfab6dc546e275b05ff4ab9.tar.gz |
Ensure QtPositioning value types don't change QDebug spacing policy
Change-Id: I1a98df26582957b0df136e98acf5d2754fe45295
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests/auto/qgeoareamonitor')
-rw-r--r-- | tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp index 456a8378..9ae6eac8 100644 --- a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp +++ b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp @@ -60,6 +60,21 @@ QT_USE_NAMESPACE Q_DECLARE_METATYPE(QGeoPositionInfo) Q_DECLARE_METATYPE(QGeoAreaMonitorInfo) +QString tst_qgeoareamonitorinfo_debug; + +void tst_qgeoareamonitorinfo_messageHandler(QtMsgType type, + const QMessageLogContext &, + const QString &msg) +{ + switch (type) { + case QtDebugMsg : + tst_qgeoareamonitorinfo_debug = msg; + break; + default: + break; + } +} + class tst_QGeoAreaMonitorSource : public QObject { Q_OBJECT @@ -693,6 +708,51 @@ private slots: //obj was deleted when setting new source delete obj2; } + + void debug_data() + { + QTest::addColumn<QGeoAreaMonitorInfo>("info"); + QTest::addColumn<int>("nextValue"); + QTest::addColumn<QString>("debugString"); + + QGeoAreaMonitorInfo info; + QTest::newRow("uninitialized") << info << 45 + << QString("QGeoAreaMonitorInfo(\"\", QGeoShape(Unknown), " + "persistent: false, expiry: QDateTime(\" Qt::LocalTime\") ) 45"); + + info.setArea(QGeoRectangle()); + info.setPersistent(true); + info.setName("RectangleAreaMonitor"); + QTest::newRow("Rectangle Test") << info << 45 + << QString("QGeoAreaMonitorInfo(\"RectangleAreaMonitor\", QGeoShape(Rectangle), " + "persistent: true, expiry: QDateTime(\" Qt::LocalTime\") ) 45"); + + info = QGeoAreaMonitorInfo(); + info.setArea(QGeoCircle()); + info.setPersistent(false); + info.setName("CircleAreaMonitor"); + QVariantMap map; + map.insert(QString("foobarKey"), QVariant(45)); //should be ignored + info.setNotificationParameters(map); + QTest::newRow("Circle Test") << info << 45 + << QString("QGeoAreaMonitorInfo(\"CircleAreaMonitor\", QGeoShape(Circle), " + "persistent: false, expiry: QDateTime(\" Qt::LocalTime\") ) 45"); + + // we ignore any further QDateTime related changes to avoid depending on QDateTime related + // failures in case its QDebug string changes + } + + void debug() + { + QFETCH(QGeoAreaMonitorInfo, info); + QFETCH(int, nextValue); + QFETCH(QString, debugString); + + qInstallMessageHandler(tst_qgeoareamonitorinfo_messageHandler); + qDebug() << info << nextValue; + qInstallMessageHandler(0); + QCOMPARE(tst_qgeoareamonitorinfo_debug, debugString); + } }; |