diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-03-24 14:18:20 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-06-02 22:42:15 +0200 |
commit | 649d834443326bfef6ad296cd53819121b8d1a17 (patch) | |
tree | 13983f3472e04f306f22c03eb2e271b34ecfc01c /tests/auto/corelib/kernel/qmetamethod | |
parent | fa987d44417528856d5e80ed7b48ba99e19fa307 (diff) |
add unit test for QMetaMethod::revision
Change-Id: I724702d8ac9a75fefd848afccf4f4de9fc0ba4af
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qmetamethod')
-rw-r--r-- | tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index 8450537019..dbc0716463 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -48,6 +48,7 @@ private slots: void fromSignal(); void gadget(); + void revision(); void returnMetaType(); void parameterMetaType(); @@ -781,11 +782,21 @@ class MyTestClass : public QObject public: MyTestClass() {}; public Q_SLOTS: - MyGadget doStuff(int, float, MyGadget) {return {};} + Q_REVISION(42) MyGadget doStuff(int, float, MyGadget) {return {};} Q_SIGNALS: QObject *mySignal(); }; +void tst_QMetaMethod::revision() +{ + auto mo = MyTestClass::staticMetaObject; + const auto normalized = QMetaObject::normalizedSignature("doStuff(int, float, MyGadget)"); + const int idx = mo.indexOfSlot(normalized); + QMetaMethod mm = mo.method(idx); + QVERIFY(mm.isValid()); + QCOMPARE(QTypeRevision::fromEncodedVersion(mm.revision()), QTypeRevision::fromMinorVersion(42)); +} + void tst_QMetaMethod::returnMetaType() { { |