summaryrefslogtreecommitdiff
path: root/tests/auto/qgeoshape
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2015-01-21 14:25:41 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-01-27 07:23:05 +0100
commit4f45cb18669af8e11cfab6dc546e275b05ff4ab9 (patch)
treea2138a9c249315653b9e930a565e2eeef57c3cc5 /tests/auto/qgeoshape
parentd8d9c4fbb6047b59b98108d6e3221206aa926ccd (diff)
downloadqtlocation-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/qgeoshape')
-rw-r--r--tests/auto/qgeoshape/tst_qgeoshape.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/qgeoshape/tst_qgeoshape.cpp b/tests/auto/qgeoshape/tst_qgeoshape.cpp
index 02d334c2..6c2d5a0a 100644
--- a/tests/auto/qgeoshape/tst_qgeoshape.cpp
+++ b/tests/auto/qgeoshape/tst_qgeoshape.cpp
@@ -33,6 +33,23 @@
#include <QtTest/QtTest>
#include <QtPositioning/QGeoShape>
+#include <QtCore/QDebug>
+#include <QtPositioning/QGeoRectangle>
+#include <QtPositioning/QGeoCircle>
+
+QString tst_qgeoshape_debug;
+
+void tst_qgeoshape_messageHandler(QtMsgType type, const QMessageLogContext&,
+ const QString &msg)
+{
+ switch (type) {
+ case QtDebugMsg :
+ tst_qgeoshape_debug = msg;
+ break;
+ default:
+ break;
+ }
+}
class tst_qgeoshape : public QObject
{
@@ -40,6 +57,8 @@ class tst_qgeoshape : public QObject
private slots:
void testArea();
+ void debug_data();
+ void debug();
};
void tst_qgeoshape::testArea()
@@ -65,5 +84,32 @@ void tst_qgeoshape::testArea()
QCOMPARE(area2, area3);
}
+void tst_qgeoshape::debug_data()
+{
+ QTest::addColumn<QGeoShape>("shape");
+ QTest::addColumn<int>("nextValue");
+ QTest::addColumn<QString>("debugString");
+
+ QTest::newRow("uninitialized") << QGeoShape() << 45
+ << QString("QGeoShape(Unknown) 45");
+ QTest::newRow("uninitialized") << QGeoShape(QGeoRectangle()) << 45
+ << QString("QGeoShape(Rectangle) 45");
+ QTest::newRow("uninitialized") << QGeoShape(QGeoCircle()) << 45
+ << QString("QGeoShape(Circle) 45");
+}
+
+
+void tst_qgeoshape::debug()
+{
+ QFETCH(QGeoShape, shape);
+ QFETCH(int, nextValue);
+ QFETCH(QString, debugString);
+
+ qInstallMessageHandler(tst_qgeoshape_messageHandler);
+ qDebug() << shape << nextValue;
+ qInstallMessageHandler(0);
+ QCOMPARE(tst_qgeoshape_debug, debugString);
+}
+
QTEST_MAIN(tst_qgeoshape)
#include "tst_qgeoshape.moc"