aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-01-22 13:12:56 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-02-03 15:22:12 +0100
commit789929f939a60462373beae37ab4373809095cff (patch)
treed3ee9dadb901213940ba61748f303fd34ccab424 /tests
parent8ba73c0134f162afd9aa83b731a8147728642385 (diff)
Use QTypeRevision for all versions and revisions
In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes6
-rw-r--r--tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp8
-rw-r--r--tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp3
-rw-r--r--tests/auto/qml/qqmlimport/tst_qqmlimport.cpp4
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp50
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp5
-rw-r--r--tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp5
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp2
8 files changed, 54 insertions, 29 deletions
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
index d84eb0011a..5c5ae73ca5 100644
--- a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
@@ -27,9 +27,9 @@ Module {
"dumper.ExtendedType/Type 1.0",
"dumper.ExtendedType/Type 1.1"
]
- exportMetaObjectRevisions: [0, 101]
+ exportMetaObjectRevisions: [0, 257]
Property { name: "baseProperty"; type: "int" }
- Property { name: "extendedProperty"; revision: 101; type: "int" }
- Property { name: "data"; revision: 101; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "extendedProperty"; revision: 257; type: "int" }
+ Property { name: "data"; revision: 257; type: "QObject"; isList: true; isReadonly: true }
}
}
diff --git a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
index bc4ba9437c..db79adac6c 100644
--- a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
+++ b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
@@ -94,7 +94,8 @@ namespace {
QString toString(const QQmlDirParser::Component &c)
{
return c.typeName + QLatin1Char('|') + c.fileName + QLatin1Char('|')
- + QString::number(c.majorVersion) + QLatin1Char('|') + QString::number(c.minorVersion)
+ + QString::number(c.version.majorVersion()) + QLatin1Char('|')
+ + QString::number(c.version.minorVersion())
+ QLatin1Char('|') + (c.internal ? "true" : "false");
}
@@ -112,7 +113,8 @@ namespace {
QString toString(const QQmlDirParser::Script &s)
{
return s.nameSpace + QLatin1Char('|') + s.fileName + QLatin1Char('|')
- + QString::number(s.majorVersion) + '|' + QString::number(s.minorVersion);
+ + QString::number(s.version.majorVersion()) + '|'
+ + QString::number(s.version.minorVersion());
}
QStringList toStringList(const QList<QQmlDirParser::Script> &scripts)
@@ -248,7 +250,7 @@ void tst_qqmldirparser::parse_data()
<< "unversioned-component/qmldir"
<< QStringList()
<< QStringList()
- << (QStringList() << "foo|bar|-1|-1|false")
+ << (QStringList() << "foo|bar|255|255|false")
<< QStringList()
<< QStringList()
<< false;
diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
index 690db30838..0e70933ec6 100644
--- a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
+++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
@@ -77,7 +77,8 @@ void tst_qqmlenginecleanup::test_qmlClearTypeRegistrations()
QUrl testFile = testFileUrl("types.qml");
const auto qmlTypeForTestType = []() {
- return QQmlMetaType::qmlType(QStringLiteral("TestTypeCpp"), QStringLiteral("Test"), 2, 0);
+ return QQmlMetaType::qmlType(QStringLiteral("TestTypeCpp"), QStringLiteral("Test"),
+ QTypeRevision::fromVersion(2, 0));
};
QVERIFY(!qmlTypeForTestType().isValid());
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
index 9c865b3f73..6e95ddfdea 100644
--- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
+++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
@@ -190,7 +190,9 @@ void tst_QQmlImport::completeQmldirPaths()
QFETCH(int, minorVersion);
QFETCH(QStringList, expectedPaths);
- QCOMPARE(QQmlImports::completeQmldirPaths(uri, basePaths, majorVersion, minorVersion), expectedPaths);
+ QCOMPARE(QQmlImports::completeQmldirPaths(
+ uri, basePaths, QTypeRevision::fromVersion(majorVersion, minorVersion)),
+ expectedPaths);
}
class QmldirUrlInterceptor : public QQmlAbstractUrlInterceptor {
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 296d1b14e0..c8e6e9c935 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -217,13 +217,14 @@ void tst_qqmlmetatype::qmlPropertyValueInterceptorCast()
void tst_qqmlmetatype::qmlType()
{
- QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module() == QLatin1String("Test"));
QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
- type = QQmlMetaType::qmlType("Test/ParserStatusTestType", 1, 0);
+ type = QQmlMetaType::qmlType("Test/ParserStatusTestType", QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module() == QLatin1String("Test"));
QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
@@ -282,19 +283,22 @@ void tst_qqmlmetatype::defaultObject()
void tst_qqmlmetatype::registrationType()
{
- QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
QVERIFY(!type.isComposite());
- type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
QVERIFY(!type.isComposite());
- type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -310,7 +314,8 @@ void tst_qqmlmetatype::compositeType()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
- QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module().isEmpty());
QCOMPARE(type.elementName(), QLatin1String("ImplicitType"));
@@ -380,10 +385,12 @@ void tst_qqmlmetatype::unregisterCustomType()
int controllerId = 0;
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -403,10 +410,12 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlMetaType::unregisterType(controllerId);
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller2>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -426,10 +435,12 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlMetaType::unregisterType(controllerId);
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -480,7 +491,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider1>("mytypes", 1, 0, "StaticProvider", createStaticProvider1);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -496,7 +508,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider2>("mytypes", 1, 0, "StaticProvider", createStaticProvider2);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -512,7 +525,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider1>("mytypes", 1, 0, "StaticProvider", createStaticProvider1);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -548,7 +562,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
QQmlComponent c(&e);
c.setData("import QtQuick 2.2\n Item { }", dummy);
- const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation", 2, 2);
+ const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation",
+ QTypeRevision::fromVersion(2, 2));
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
@@ -568,7 +583,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
"import QtQuick 2.2 \n"
"Item { KeyNavigation.up: null }", dummy);
- const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation", 2, 2);
+ const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation",
+ QTypeRevision::fromVersion(2, 2));
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index c79fdc57b4..25a448a97f 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -167,8 +167,9 @@ void tst_qqmlpropertycache::revisionedProperties()
QQmlRefPointer<QQmlPropertyCache> cacheWithoutVersion(new QQmlPropertyCache(metaObject),
QQmlRefPointer<QQmlPropertyCache>::Adopt);
- QQmlRefPointer<QQmlPropertyCache> cacheWithVersion(new QQmlPropertyCache(metaObject, 1),
- QQmlRefPointer<QQmlPropertyCache>::Adopt);
+ QQmlRefPointer<QQmlPropertyCache> cacheWithVersion(
+ new QQmlPropertyCache(metaObject, QTypeRevision::fromEncodedVersion(1)),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cacheWithoutVersion, "propertyE")));
diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
index b44977bd5a..062a8b5c9a 100644
--- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
+++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp
@@ -76,7 +76,10 @@ void tst_qquickdesignersupport::customData()
QVERIFY(rootItem);
- QScopedPointer<QObject> newItemScopedPointer(QQuickDesignerSupportItems::createPrimitive(QLatin1String("QtQuick/Item"), 2, 6, view->rootContext()));
+ QScopedPointer<QObject> newItemScopedPointer(QQuickDesignerSupportItems::createPrimitive(
+ QLatin1String("QtQuick/Item"),
+ QTypeRevision::fromVersion(2, 6),
+ view->rootContext()));
QObject *newItem = newItemScopedPointer.data();
QVERIFY(newItem);
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index ed2e52f869..2044360b3d 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -196,7 +196,7 @@ void tst_creation::qobject_10tree_cpp()
void tst_creation::qobject_qmltype()
{
- QQmlType t = QQmlMetaType::qmlType("QtQuick/QtObject", 2, 0);
+ QQmlType t = QQmlMetaType::qmlType("QtQuick/QtObject", QTypeRevision::fromVersion(2, 0));
QBENCHMARK {
QObject *obj = t.create();