aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-07-01 11:04:39 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-07-01 11:54:23 +0200
commit659b575d19f318bb4d0248236ea16a9cd0a573ed (patch)
treeea931bb553aa4b4504b242b3f66dbc416fcf4018
parent692b2da77427259a3589cf8a1311075863f2f5ec (diff)
qmlplugindump: dump enums also for composite types
Change-Id: I2745d3df4fca77483313c70e5433339c444c7fd4 Fixes: QTBUG-76627 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/Animal.qml15
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/qmldir3
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp16
-rw-r--r--tools/qmlplugindump/main.cpp6
4 files changed, 39 insertions, 1 deletions
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/Animal.qml b/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/Animal.qml
new file mode 100644
index 0000000000..5bd7788a8c
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/Animal.qml
@@ -0,0 +1,15 @@
+pragma Singleton
+import QtQml 2.0
+
+QtObject {
+ property string name
+ property string category
+ property string sound
+ property int size: Animal.SizeSmall
+
+ enum SizeType {
+ SizeSmall,
+ SizeMedium,
+ SizeLarge
+ }
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/qmldir
new file mode 100644
index 0000000000..f08b348efa
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/CompositeWithEnum/qmldir
@@ -0,0 +1,3 @@
+module dumper.CompositeWithEnum
+singleton Animal 1.0 Animal.qml
+depends QtQml 2.0
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
index 17766a89b5..72356a4d84 100644
--- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
@@ -46,6 +46,7 @@ private slots:
void builtins();
void singleton();
void compositeWithinSingleton();
+ void compositeWithEnum();
void plugin_data();
void plugin();
@@ -135,6 +136,21 @@ void tst_qmlplugindump::compositeWithinSingleton()
QVERIFY2(result.contains(QLatin1String("exportMetaObjectRevisions: [0]")), qPrintable(result));
}
+void tst_qmlplugindump::compositeWithEnum()
+{
+ QProcess dumper;
+ QStringList args;
+ args << QLatin1String("dumper.CompositeWithEnum") << QLatin1String("1.0")
+ << QLatin1String(QT_QMLTEST_DIR "/data");
+ dumper.start(qmlplugindumpPath, args);
+ QVERIFY2(dumper.waitForStarted(), qPrintable(dumper.errorString()));
+ QVERIFY2(dumper.waitForFinished(), qPrintable(dumper.errorString()));
+
+ const QString &result = dumper.readAllStandardOutput();
+ QVERIFY2(result.contains(QLatin1String("exports: [\"Animal 1.0\"]")), qPrintable(result));
+ QVERIFY2(result.contains(QLatin1String("Enum {")), qPrintable(result));
+}
+
void tst_qmlplugindump::plugin_data()
{
QTest::addColumn<QString>("import");
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 67ffd5a555..b83aebb017 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -479,8 +479,12 @@ public:
}
}
- for (const QMetaObject *meta : qAsConst(objectsToMerge))
+ for (const QMetaObject *meta : qAsConst(objectsToMerge)) {
+ for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
+ dump(meta->enumerator(index));
+
writeMetaContent(meta, &knownAttributes);
+ }
qml->writeEndObject();
}