summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp')
-rw-r--r--tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
index f459068bef..c8053ca43a 100644
--- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
+++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
@@ -1,6 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -22,7 +22,14 @@ struct CustomType
Q_DECLARE_METATYPE(CustomType)
-class tst_QMetaProperty : public QObject
+class Base : public QObject
+{
+ Q_OBJECT
+signals:
+ void baseSignal(int);
+};
+
+class tst_QMetaProperty : public Base
{
Q_OBJECT
Q_PROPERTY(EnumType value WRITE setValue READ getValue)
@@ -33,6 +40,7 @@ class tst_QMetaProperty : public QObject
Q_PROPERTY(int value10 READ value10 FINAL)
Q_PROPERTY(QMap<int, int> map MEMBER map)
Q_PROPERTY(CustomType custom MEMBER custom)
+ Q_PROPERTY(int propWithInheritedSig READ propWithInheritedSig NOTIFY baseSignal)
private slots:
void hasStdCppSet();
@@ -43,6 +51,7 @@ private slots:
void mapProperty();
void conversion();
void enumsFlags();
+ void notifySignalIndex();
public:
enum EnumType { EnumType1 };
@@ -57,6 +66,8 @@ public:
int value9() const { return 1; }
int value10() const { return 1; }
+ int propWithInheritedSig() const { return 0; }
+
QString value7;
QMap<int, int> map;
CustomType custom;
@@ -274,5 +285,20 @@ void tst_QMetaProperty::enumsFlags()
QCOMPARE(t.flagProperty(), EnumFlagsTester::flag2);
}
+
+void tst_QMetaProperty::notifySignalIndex()
+{
+ auto mo = this->metaObject();
+ auto propIndex = mo->indexOfProperty("propWithInheritedSig");
+ auto propWithInheritedSig = mo->property(propIndex);
+ QVERIFY(propWithInheritedSig.isValid());
+ QVERIFY(propWithInheritedSig.hasNotifySignal());
+ QVERIFY(propWithInheritedSig.notifySignalIndex() != -1);
+ QMetaMethod notifySignal = propWithInheritedSig.notifySignal();
+ QVERIFY(notifySignal.isValid());
+ QCOMPARE(notifySignal.name(), "baseSignal");
+ QCOMPARE(notifySignal.parameterCount(), 1);
+}
+
QTEST_MAIN(tst_QMetaProperty)
#include "tst_qmetaproperty.moc"