aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlinfo
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /tests/auto/qml/qqmlinfo
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff)
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlinfo')
-rw-r--r--tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
index 3f6c200027..ada3f9e37b 100644
--- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
+++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp
@@ -60,14 +60,14 @@ void tst_qqmlinfo::qmlObject()
QQmlComponent component(&engine, testFileUrl("qmlObject.qml"));
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QString message = component.url().toString() + ":3:1: QML QtObject: Test Message";
QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
qmlInfo(object) << "Test Message";
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
- QVERIFY(nested != 0);
+ QVERIFY(nested != nullptr);
message = component.url().toString() + ":6:13: QML QtObject: Second Test Message";
QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
@@ -79,12 +79,12 @@ void tst_qqmlinfo::nestedQmlObject()
QQmlComponent component(&engine, testFileUrl("nestedQmlObject.qml"));
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
- QVERIFY(nested != 0);
+ QVERIFY(nested != nullptr);
QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2"));
- QVERIFY(nested2 != 0);
+ QVERIFY(nested2 != nullptr);
QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object";
QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
@@ -100,12 +100,12 @@ void tst_qqmlinfo::nestedComponent()
QQmlComponent component(&engine, testFileUrl("NestedComponent.qml"));
QObject *object = component.create();
- QVERIFY(object != 0);
+ QVERIFY(object != nullptr);
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
- QVERIFY(nested != 0);
+ QVERIFY(nested != nullptr);
QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2"));
- QVERIFY(nested2 != 0);
+ QVERIFY(nested2 != nullptr);
QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object";
QTest::ignoreMessage(QtInfoMsg, qPrintable(message));
@@ -130,7 +130,7 @@ void tst_qqmlinfo::nonQmlObject()
void tst_qqmlinfo::nullObject()
{
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Null Object Test Message");
- qmlInfo(0) << "Null Object Test Message";
+ qmlInfo(nullptr) << "Null Object Test Message";
}
void tst_qqmlinfo::nonQmlContextedObject()
@@ -145,44 +145,44 @@ void tst_qqmlinfo::nonQmlContextedObject()
void tst_qqmlinfo::types()
{
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false");
- qmlInfo(0) << false;
+ qmlInfo(nullptr) << false;
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.1");
- qmlInfo(0) << 1.1;
+ qmlInfo(nullptr) << 1.1;
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.2");
- qmlInfo(0) << 1.2f;
+ qmlInfo(nullptr) << 1.2f;
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 15");
- qmlInfo(0) << 15;
+ qmlInfo(nullptr) << 15;
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 'b'");
- qmlInfo(0) << QChar('b');
+ qmlInfo(nullptr) << QChar('b');
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: \"Qt\"");
- qmlInfo(0) << QByteArray("Qt");
+ qmlInfo(nullptr) << QByteArray("Qt");
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: true");
- qmlInfo(0) << bool(true);
+ qmlInfo(nullptr) << bool(true);
//### do we actually want QUrl to show up in the output?
//### why the extra space at the end?
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") ");
- qmlInfo(0) << QUrl("http://www.qt-project.org");
+ qmlInfo(nullptr) << QUrl("http://www.qt-project.org");
//### should this be quoted?
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: hello");
- qmlInfo(0) << QLatin1String("hello");
+ qmlInfo(nullptr) << QLatin1String("hello");
//### should this be quoted?
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: World");
QString str("Hello World");
QStringRef ref(&str, 6, 5);
- qmlInfo(0) << ref;
+ qmlInfo(nullptr) << ref;
//### should this be quoted?
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Quick");
- qmlInfo(0) << QString ("Quick");
+ qmlInfo(nullptr) << QString ("Quick");
}
void tst_qqmlinfo::chaining()
@@ -190,7 +190,7 @@ void tst_qqmlinfo::chaining()
QString str("Hello World");
QStringRef ref(&str, 6, 5);
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") ");
- qmlInfo(0) << false << ' '
+ qmlInfo(nullptr) << false << ' '
<< 1.1 << ' '
<< 1.2f << ' '
<< 15 << ' '
@@ -207,13 +207,13 @@ void tst_qqmlinfo::chaining()
void tst_qqmlinfo::messageTypes()
{
QTest::ignoreMessage(QtDebugMsg, "<Unknown File>: debug");
- qmlDebug(0) << QLatin1String("debug");
+ qmlDebug(nullptr) << QLatin1String("debug");
QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: info");
- qmlInfo(0) << QLatin1String("info");
+ qmlInfo(nullptr) << QLatin1String("info");
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: warning");
- qmlWarning(0) << QLatin1String("warning");
+ qmlWarning(nullptr) << QLatin1String("warning");
}
QTEST_MAIN(tst_qqmlinfo)