summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc/tst_moc.cpp
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/moc/tst_moc.cpp
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/moc/tst_moc.cpp')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp26
1 files changed, 25 insertions, 1 deletions
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