Skip to content

Commit

Permalink
add unit test for QMetaMethod::revision
Browse files Browse the repository at this point in the history
Change-Id: I724702d8ac9a75fefd848afccf4f4de9fc0ba4af
Reviewed-by: Olivier Goffart (Woboq GmbH) <[email protected]>
  • Loading branch information
Inkane committed Jun 2, 2020
1 parent fa987d4 commit 649d834
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private slots:
void fromSignal();

void gadget();
void revision();

void returnMetaType();
void parameterMetaType();
Expand Down Expand Up @@ -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()
{
{
Expand Down

0 comments on commit 649d834

Please sign in to comment.