summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-01-29 16:57:12 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-01-29 16:57:27 +0100
commita1dbdcbd6e818118f5fc28cdd39e47a02380adbd (patch)
tree0d813d9d72baeb1b5f7be048e775896c73f134f5 /tests/auto/tools
parent67ea445f09db9feea4e863faa12c45fb007f53a4 (diff)
parent4cbadf699838406d14366ce61deec03cf45113f7 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: src/corelib/Qt5CoreConfigExtras.cmake.in src/corelib/Qt5CoreMacros.cmake src/dbus/Qt5DBusConfigExtras.cmake.in src/widgets/Qt5WidgetsConfigExtras.cmake.in Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/allmocs_baseline_in.json16
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp26
2 files changed, 41 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json
index 2a70a52587..0ce464a709 100644
--- a/tests/auto/tools/moc/allmocs_baseline_in.json
+++ b/tests/auto/tools/moc/allmocs_baseline_in.json
@@ -1023,6 +1023,7 @@
"final": false,
"name": "prop1",
"read": "getProp1",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "FwdClass1",
@@ -1035,6 +1036,7 @@
"final": false,
"name": "prop2",
"read": "getProp2",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "FwdClass2",
@@ -1047,6 +1049,7 @@
"final": false,
"name": "prop3",
"read": "getProp3",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "FwdClass3",
@@ -1157,6 +1160,7 @@
"final": false,
"name": "flags",
"read": "flags",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Flags",
@@ -1181,6 +1185,7 @@
"final": false,
"name": "flags",
"read": "flags",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Foo::Bar::Flags",
@@ -1193,6 +1198,7 @@
"final": false,
"name": "flagsList",
"read": "flagsList",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "QVector<Foo::Bar::Flags>",
@@ -1706,6 +1712,7 @@
"final": false,
"name": "blah",
"read": "blah",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "A::SomeEnum",
@@ -1755,6 +1762,7 @@
"final": false,
"name": "blah",
"read": "blah",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "A::SomeEnum",
@@ -1924,6 +1932,7 @@
"final": false,
"name": "gadgetPoperty",
"read": "gadgetPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Gadget::SomeEnum",
@@ -1935,6 +1944,7 @@
"final": false,
"name": "objectPoperty",
"read": "objectPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Object::SomeEnum",
@@ -1958,6 +1968,7 @@
"final": false,
"name": "nestedGadgetPoperty",
"read": "nestedGadgetPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Nested::Gadget::SomeEnum",
@@ -1981,6 +1992,7 @@
"final": false,
"name": "nestedObjectPoperty",
"read": "nestedObjectPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Nested::Object::SomeEnum",
@@ -2109,6 +2121,7 @@
"final": false,
"name": "gadgetPoperty",
"read": "gadgetPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Gadget::SomeEnum",
@@ -2120,6 +2133,7 @@
"final": false,
"name": "objectPoperty",
"read": "objectPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Object::SomeEnum",
@@ -2143,6 +2157,7 @@
"final": false,
"name": "nestedGadgetPoperty",
"read": "nestedGadgetPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Nested::Gadget::SomeEnum",
@@ -2166,6 +2181,7 @@
"final": false,
"name": "nestedObjectPoperty",
"read": "nestedObjectPoperty",
+ "required": false,
"scriptable": true,
"stored": true,
"type": "Nested::Object::SomeEnum",
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 2bad8f2e63..a4ee6795c4 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
@@ -721,6 +721,7 @@ private slots:
void cxxAttributes();
void mocJsonOutput();
void mocInclude();
+ void requiredProperties();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -4029,6 +4030,29 @@ void tst_Moc::mocInclude()
QCOMPARE(obj.prop1->x, 45);
}
+class RequiredTest :public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int required MEMBER m_required REQUIRED)
+ Q_PROPERTY(int notRequired MEMBER m_notRequired)
+
+private:
+ int m_required;
+ int m_notRequired;
+};
+
+void tst_Moc::requiredProperties()
+{
+ QMetaObject mo = RequiredTest::staticMetaObject;
+ QMetaProperty required = mo.property(mo.indexOfProperty("required"));
+ QVERIFY(required.isValid());
+ QVERIFY(required.isRequired());
+ QMetaProperty notRequired = mo.property(mo.indexOfProperty("notRequired"));
+ QVERIFY(notRequired.isValid());
+ QVERIFY(!notRequired.isRequired());
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS