aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-08-21 09:22:49 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-08-22 00:32:08 +0200
commit538f1b7dd65b1aa6133e1adb8b6d893ab366173e (patch)
treeda67c6614f7cbce5e0627e3a9550c5bf78d0d5d4
parentbb1ad6e425bf758ddaa974adb14e9b8389037611 (diff)
tst_qqmlenginedebugservice: Adapt to QVariant comparison change
QVariant::operator== won't do the needed conversions anymore, so we have to apply them manually. In contrast to operator==, convert is not const, so we have to apply it to a copy of the variant. Change-Id: Ic55c2791038dbc9e45dcdcb163828cb7ca93a29e Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 3ae40bf687..9bef2185de 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -282,7 +282,11 @@ void tst_QQmlEngineDebugService::recursiveObjectTest(
}
} else if (pmeta.userType() < QMetaType::User && pmeta.userType() != QMetaType::QVariant) {
const QVariant expected = pmeta.read(o);
- QVERIFY2(p.value == expected, QString::fromLatin1("%1 != %2. Details: %3/%4/%5/%6")
+ QVariant value = p.value;
+ auto expectedType = expected.metaType().id();
+ if (value != expected && p.value.canConvert(expectedType))
+ value.convert(expectedType);
+ QVERIFY2(value == expected, QString::fromLatin1("%1 != %2. Details: %3/%4/%5/%6")
.arg(QTest::toString(p.value)).arg(QTest::toString(expected)).arg(p.name)
.arg(p.valueTypeName).arg(pmeta.userType()).arg(pmeta.userType()).toUtf8());
}
@@ -774,9 +778,9 @@ void tst_QQmlEngineDebugService::queryObject()
// test specific property values
QCOMPARE(findProperty(rect.properties, "width").value, QVariant::fromValue(500));
QCOMPARE(findProperty(rect.properties, "height").value, QVariant::fromValue(600));
- QCOMPARE(findProperty(rect.properties, "color").value, QVariant::fromValue(QColor("blue")));
-
- QCOMPARE(findProperty(text.properties, "color").value, QVariant::fromValue(QColor("blue")));
+ auto expected = findProperty(rect.properties, "color").value;
+ expected.convert(QMetaType::fromType<QColor>().id());
+ QCOMPARE(expected , QVariant::fromValue(QColor("blue")));
} else {
foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());
@@ -853,9 +857,11 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation()
// test specific property values
QCOMPARE(findProperty(rect.properties, "width").value, QVariant::fromValue(500));
QCOMPARE(findProperty(rect.properties, "height").value, QVariant::fromValue(600));
- QCOMPARE(findProperty(rect.properties, "color").value, QVariant::fromValue(QColor("blue")));
-
- QCOMPARE(findProperty(text.properties, "color").value, QVariant::fromValue(QColor("blue")));
+ auto expected = findProperty(rect.properties, "color").value;
+ auto colorMetatype = QMetaType::fromType<QColor>().id();
+ QVERIFY(expected.canConvert(colorMetatype));
+ expected.convert(colorMetatype);
+ QCOMPARE(expected , QVariant::fromValue(QColor("blue")));
} else {
foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
QVERIFY(!child.className.isEmpty());