aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-24 15:27:58 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-29 09:44:39 +0000
commit0ea3c24cfe7d1057964fe864924a7ee083764084 (patch)
tree681b7df0a201641203c936e748afd7d6a7ec39b5 /tests/auto/qml/qqmllanguage
parentbb87365ffabcba3a70dd49a4c3232a12b5b224a3 (diff)
tests/qml: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I8cc97fd9b48fc789a849e9527c292c4e05accd97 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/qml/qqmllanguage')
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 08da779d90..f8cb053e6c 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -328,7 +328,7 @@ void tst_qqmllanguage::insertedSemicolon()
if(create) {
QObject *object = component.create();
- QVERIFY(object == 0);
+ QVERIFY(!object);
}
VERIFY_ERRORS(errorFile.toLatin1().constData());
@@ -550,7 +550,7 @@ void tst_qqmllanguage::errors()
if (create) {
QObject *object = component.create();
- QVERIFY(object == 0);
+ QVERIFY(!object);
}
VERIFY_ERRORS(errorFile.toLatin1().constData());
@@ -580,7 +580,7 @@ void tst_qqmllanguage::interfaceProperty()
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
QVERIFY(object->interface());
- QVERIFY(object->interface()->id == 913);
+ QCOMPARE(object->interface()->id, 913);
}
void tst_qqmllanguage::interfaceQList()
@@ -589,9 +589,9 @@ void tst_qqmllanguage::interfaceQList()
VERIFY_ERRORS(0);
MyContainer *container= qobject_cast<MyContainer*>(component.create());
QVERIFY(container != 0);
- QVERIFY(container->getQListInterfaces()->count() == 2);
+ QCOMPARE(container->getQListInterfaces()->count(), 2);
for(int ii = 0; ii < 2; ++ii)
- QVERIFY(container->getQListInterfaces()->at(ii)->id == 913);
+ QCOMPARE(container->getQListInterfaces()->at(ii)->id, 913);
}
void tst_qqmllanguage::assignObjectToSignal()
@@ -630,7 +630,7 @@ void tst_qqmllanguage::assignQmlComponent()
VERIFY_ERRORS(0);
MyContainer *object = qobject_cast<MyContainer *>(component.create());
QVERIFY(object != 0);
- QVERIFY(object->getChildren()->count() == 1);
+ QCOMPARE(object->getChildren()->count(), 1);
QObject *child = object->getChildren()->at(0);
QCOMPARE(child->property("x"), QVariant(10));
QCOMPARE(child->property("y"), QVariant(11));
@@ -722,17 +722,17 @@ void tst_qqmllanguage::assignLiteralToVariant()
QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool);
QCOMPARE(object->property("test12").userType(), (int)QVariant::Vector4D);
- QVERIFY(object->property("test1") == QVariant(1));
- QVERIFY(object->property("test2") == QVariant((double)1.7));
+ QCOMPARE(object->property("test1"), QVariant(1));
+ QCOMPARE(object->property("test2"), QVariant((double)1.7));
QVERIFY(object->property("test3") == QVariant(QString(QLatin1String("Hello world!"))));
- QVERIFY(object->property("test4") == QVariant(QColor::fromRgb(0xFF008800)));
+ QCOMPARE(object->property("test4"), QVariant(QColor::fromRgb(0xFF008800)));
QVERIFY(object->property("test5") == QVariant(QRectF(10, 10, 10, 10)));
QVERIFY(object->property("test6") == QVariant(QPointF(10, 10)));
QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10)));
QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100)));
- QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800"))));
- QVERIFY(object->property("test10") == QVariant(bool(true)));
- QVERIFY(object->property("test11") == QVariant(bool(false)));
+ QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800"))));
+ QCOMPARE(object->property("test10"), QVariant(bool(true)));
+ QCOMPARE(object->property("test11"), QVariant(bool(false)));
QVERIFY(object->property("test12") == QVariant(QVector4D(100, 100, 100, 100)));
delete object;
@@ -1170,7 +1170,7 @@ void tst_qqmllanguage::customParserTypes()
VERIFY_ERRORS(0);
QObject *object = component.create();
QVERIFY(object != 0);
- QVERIFY(object->property("count") == QVariant(2));
+ QCOMPARE(object->property("count"), QVariant(2));
}
// Tests that the root item can be a custom component
@@ -1352,7 +1352,7 @@ void tst_qqmllanguage::dynamicObjectProperties()
QObject *object = component.create();
QVERIFY(object != 0);
- QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0));
+ QCOMPARE(object->property("objectProperty"), qVariantFromValue((QObject*)0));
QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0));
}
{
@@ -1661,7 +1661,7 @@ void tst_qqmllanguage::aliasProperties()
v = object->property("otherAlias");
QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
o = qvariant_cast<MyQmlObject*>(v);
- QVERIFY(o == 0);
+ QVERIFY(!o);
delete object;
}
@@ -1691,7 +1691,7 @@ void tst_qqmllanguage::aliasProperties()
QVERIFY(object2 != 0);
QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject"));
- QVERIFY(alias == object2);
+ QCOMPARE(alias, object2);
delete object1;
@@ -1700,7 +1700,7 @@ void tst_qqmllanguage::aliasProperties()
void *a[] = { &alias2, 0, &status };
QMetaObject::metacall(object, QMetaObject::ReadProperty,
object->metaObject()->indexOfProperty("aliasedObject"), a);
- QVERIFY(alias2 == 0);
+ QVERIFY(!alias2);
}
// Simple composite type
@@ -2106,50 +2106,50 @@ void tst_qqmllanguage::scriptStringComparison()
const qreal n = 12.345;
bool ok;
- QVERIFY(object2->scriptProperty().stringLiteral() == s);
+ QCOMPARE(object2->scriptProperty().stringLiteral(), s);
QVERIFY(object3->scriptProperty().numberLiteral(&ok) == n && ok);
- QVERIFY(object1->scriptProperty() == object1->scriptProperty());
- QVERIFY(object2->scriptProperty() == object2->scriptProperty());
- QVERIFY(object3->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object1->scriptProperty(), object1->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object2->scriptProperty());
+ QCOMPARE(object3->scriptProperty(), object3->scriptProperty());
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
QVERIFY(object1->scriptProperty() != object2->scriptProperty());
QVERIFY(object1->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << n);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << s);
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << s);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << QJSValue::UndefinedValue);
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << QJSValue::UndefinedValue);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << QJSValue::NullValue);
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << QJSValue::NullValue);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << false);
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << false);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
func.callWithInstance(inst2, QJSValueList() << true);
QVERIFY(object2->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << true);
- QVERIFY(object2->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object2->scriptProperty(), object3->scriptProperty());
QVERIFY(object1->scriptProperty() != object2->scriptProperty());
object2->setScriptProperty(object1->scriptProperty());
- QVERIFY(object1->scriptProperty() == object2->scriptProperty());
+ QCOMPARE(object1->scriptProperty(), object2->scriptProperty());
QVERIFY(object1->scriptProperty() != object3->scriptProperty());
func.callWithInstance(inst3, QJSValueList() << engine.toScriptValue(object1->scriptProperty()));
- QVERIFY(object1->scriptProperty() == object3->scriptProperty());
+ QCOMPARE(object1->scriptProperty(), object3->scriptProperty());
// While this are two instances of the same object they are still considered different
// because the (none literal) script string may access variables which have different
@@ -3250,7 +3250,7 @@ void tst_qqmllanguage::registrationOrder()
QObject *o = component.create();
QVERIFY(o != 0);
- QVERIFY(o->metaObject() == &MyVersion2Class::staticMetaObject);
+ QCOMPARE(o->metaObject(), &MyVersion2Class::staticMetaObject);
delete o;
}
@@ -3644,7 +3644,7 @@ void tst_qqmllanguage::compositeSingletonSameEngine()
QVERIFY(s2 != 0);
QCOMPARE(s2->property("testProp2"), QVariant(13));
- QVERIFY(s1 == s2);
+ QCOMPARE(s1, s2);
}
// Checks that the addresses of the composite singletons used in different
@@ -3693,7 +3693,7 @@ void tst_qqmllanguage::compositeSingletonQualifiedNamespace()
getSingletonInstance(engine, "singletonTest5a.qml", "singletonInstance", &s2);
QVERIFY(s2 != 0);
- QVERIFY(s1 == s2);
+ QCOMPARE(s1, s2);
}
// Loads a singleton from a module
@@ -3719,7 +3719,7 @@ void tst_qqmllanguage::compositeSingletonModule()
getSingletonInstance(engine, "singletonTest6a.qml", "singletonInstance", &s2);
QVERIFY(s2 != 0);
- QVERIFY(s1 == s2);
+ QCOMPARE(s1, s2);
}
// Loads a singleton from a module with a higher version
@@ -3745,7 +3745,7 @@ void tst_qqmllanguage::compositeSingletonModuleVersioned()
getSingletonInstance(engine, "singletonTest7a.qml", "singletonInstance", &s2);
QVERIFY(s2 != 0);
- QVERIFY(s1 == s2);
+ QCOMPARE(s1, s2);
}
// Loads a singleton from a module with a qualified namespace
@@ -3771,7 +3771,7 @@ void tst_qqmllanguage::compositeSingletonModuleQualified()
getSingletonInstance(engine, "singletonTest8a.qml", "singletonInstance", &s2);
QVERIFY(s2 != 0);
- QVERIFY(s1 == s2);
+ QCOMPARE(s1, s2);
}
// Tries to instantiate a type with a pragma Singleton and fails
@@ -3995,7 +3995,7 @@ void tst_qqmllanguage::propertyCacheInSync()
QVERIFY(ddata);
QVERIFY(ddata->propertyCache);
// Those always have to be in sync and correct.
- QVERIFY(ddata->propertyCache == vmemoCache);
+ QCOMPARE(ddata->propertyCache, vmemoCache);
QCOMPARE(anchors->property("margins").toInt(), 50);
}