aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Skoland <david.skoland@qt.io>2020-11-03 18:48:13 +0100
committerDavid Skoland <david.skoland@qt.io>2020-11-04 11:12:25 +0100
commit89ee1a33cb373709af9de565902e97c0299d3bee (patch)
tree1f37375d0360cc9032e4825293537b16ccf1457a /tests
parent8ae632bbbc12f9751c8a55692687aff73ca01d77 (diff)
Update MetaType things in tests
Also fix some minute errors. Change-Id: I1815224a6efdd7e619dfe5a5911d8b1166a3b3c8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp10
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp9
-rw-r--r--tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp6
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp2
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp4
5 files changed, 14 insertions, 17 deletions
diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index 9bef2185de..a87a77180f 100644
--- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -283,7 +283,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest(
} else if (pmeta.userType() < QMetaType::User && pmeta.userType() != QMetaType::QVariant) {
const QVariant expected = pmeta.read(o);
QVariant value = p.value;
- auto expectedType = expected.metaType().id();
+ QMetaType expectedType = expected.metaType();
if (value != expected && p.value.canConvert(expectedType))
value.convert(expectedType);
QVERIFY2(value == expected, QString::fromLatin1("%1 != %2. Details: %3/%4/%5/%6")
@@ -778,8 +778,8 @@ 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));
- auto expected = findProperty(rect.properties, "color").value;
- expected.convert(QMetaType::fromType<QColor>().id());
+ QVariant expected = findProperty(rect.properties, "color").value;
+ expected.convert(QMetaType::fromType<QColor>());
QCOMPARE(expected , QVariant::fromValue(QColor("blue")));
} else {
foreach (const QQmlEngineDebugObjectReference &child, obj.children) {
@@ -857,8 +857,8 @@ 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));
- auto expected = findProperty(rect.properties, "color").value;
- auto colorMetatype = QMetaType::fromType<QColor>().id();
+ QVariant expected = findProperty(rect.properties, "color").value;
+ QMetaType colorMetatype = QMetaType::fromType<QColor>();
QVERIFY(expected.canConvert(colorMetatype));
expected.convert(colorMetatype);
QCOMPARE(expected , QVariant::fromValue(QColor("blue")));
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 1be35aef75..d98a5ec51a 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -563,9 +563,9 @@ void tst_QJSEngine::toScriptValue()
QVariant output = engine.fromScriptValue<QVariant>(outputJS);
if (input.metaType().id() == QMetaType::QChar) {
- if (!input.convert(QMetaType::QString))
+ if (!input.convert(QMetaType(QMetaType::QString)))
QFAIL("cannot convert to the original value");
- } else if (!output.convert(input.metaType().id()) && input.isValid())
+ } else if (!output.convert(input.metaType()) && input.isValid())
QFAIL("cannot convert to the original value");
QCOMPARE(input, output);
}
@@ -3758,7 +3758,8 @@ class TranslationScope
public:
TranslationScope(const QString &fileName)
{
- translator.load(fileName);
+ if (!translator.load(fileName))
+ QFAIL("failed to load translation");
QCoreApplication::instance()->installTranslator(&translator);
}
~TranslationScope()
@@ -4947,7 +4948,7 @@ void tst_QJSEngine::interrupt()
Q_UNUSED(threshold);
QJSEngine *engineInThread = nullptr;
- QScopedPointer<QThread> worker(QThread::create([&engineInThread, &code, jitThreshold](){
+ QScopedPointer<QThread> worker(QThread::create([&engineInThread, &code](){
QJSEngine jsEngine;
engineInThread = &jsEngine;
QJSValue result = jsEngine.evaluate(code);
diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
index 7b02415328..41537192d3 100644
--- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
+++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp
@@ -192,11 +192,7 @@ void tst_QQmlMetaObject::property()
QCOMPARE(prop.name(), "test");
QCOMPARE(QByteArray(prop.typeName()), cppTypeName);
- if (prop.userType() < QMetaType::User)
- QCOMPARE(prop.type(), QVariant::Type(cppType));
- else
- QCOMPARE(prop.type(), QVariant::UserType);
- QCOMPARE(prop.userType(), cppType);
+ QCOMPARE(prop.metaType().id(), cppType);
QVERIFY(!prop.isConstant());
QVERIFY(!prop.isDesignable());
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index f00525a37c..a4c8da1da2 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -514,7 +514,7 @@ void tst_qqmlpropertycache::passQGadget()
QVERIFY(before.isNull());
emit emitter.emitGadget(SimpleGadget());
QVariant after = obj->property("result");
- QCOMPARE(QMetaType::Type(after.type()), QMetaType::Bool);
+ QCOMPARE(after.typeId(), QMetaType::Bool);
QVERIFY(after.toBool());
}
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index cde228f6c4..09640dc37d 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -208,10 +208,10 @@ void tst_QQuickAccessible::quickAttachedProperties()
QCOMPARE(p.isNull(), false);
QCOMPARE(p.toInt(), int(QAccessible::PushButton));
p = attachedObject->property("name");
- QCOMPARE(p.type(), QMetaType::QString);
+ QCOMPARE(p.typeId(), QMetaType::QString);
QVERIFY2(p.value<QString>().isEmpty(), QTest::toString(p));
p = attachedObject->property("description");
- QCOMPARE(p.type(), QMetaType::QString);
+ QCOMPARE(p.typeId(), QMetaType::QString);
QVERIFY2(p.value<QString>().isEmpty(), QTest::toString(p));
QCOMPARE(attachedObject->wasNameExplicitlySet(), false);
}