aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlinfo
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-01-05 20:19:18 +0100
committerRobin Burchell <robin.burchell@crimson.no>2017-01-11 13:49:04 +0000
commit5a5f140e60a65ae9a976444c1e47e5a8c606ff21 (patch)
tree1f9c5674b61b1ba6d20357826bf0a39cac029050 /tests/auto/qml/qqmlinfo
parent971314dbb56c3761bb38abda8e257fd5f8502d00 (diff)
QQmlInfo: Add qmlDebug & qmlWarning functions alongside qmlInfo
This way, we can correctly write to multiple levels of QDebug with QML context information. A followup change will port all existing callers, and subsequently change qmlInfo's message level to QtInfoMsg. [ChangeLog][QtQml] Introduced qmlDebug & qmlWarning functions to qqmlinfo.h, in addition to the pre-existing qmlInfo function. As a side effect, QQmlError has also gained messageType() and setMessageType(). Change-Id: I04ced5952c5c3c58293a89a6767c7b545c03cc0a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlinfo')
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
index acda06c8d8..ce3004a31c 100644
--- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -49,6 +49,7 @@ private slots:
void nonQmlContextedObject();
void types();
void chaining();
+ void messageTypes();
private:
QQmlEngine engine;
@@ -202,6 +203,19 @@ void tst_qqmlinfo::chaining()
<< QUrl("http://www.qt-project.org");
}
+// Ensure that messages of different types are sent with the correct QtMsgType.
+void tst_qqmlinfo::messageTypes()
+{
+ QTest::ignoreMessage(QtDebugMsg, "<Unknown File>: debug");
+ qmlDebug(0) << QLatin1String("debug");
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: info");
+ qmlInfo(0) << QLatin1String("info");
+
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: warning");
+ qmlWarning(0) << QLatin1String("warning");
+}
+
QTEST_MAIN(tst_qqmlinfo)
#include "tst_qqmlinfo.moc"