diff options
author | Brett Stottlemyer <bstottle@ford.com> | 2019-05-06 08:24:42 -0400 |
---|---|---|
committer | Brett Stottlemyer <bstottle@ford.com> | 2019-05-07 00:15:38 +0000 |
commit | c96a4193e5d4d46804e8a11fad3b0e95d02b037b (patch) | |
tree | 23eef377dd09e14c12262837645e1aca3a207662 /tests | |
parent | d52f983698f0d6239938dd748e30d98394fd2946 (diff) |
Fix dynamic enums in Props and Signals
These worked with repc generated types, but can fail when going to dynamic
types (such as going through a proxy).
This also makes two changes to help with this change:
It adds a #define to dump what is sent for dynamic type info for
initialization (for debugging the protocol itself) and changes the repc
regexes so that a single character enum name can be used (previously the
parsing would fail if the unless the name was at least two characters).
Change-Id: Ied7219c60a901ef0cb00e06ef44001c6d077af89
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/proxy_multiprocess/client/main.cpp | 3 | ||||
-rw-r--r-- | tests/auto/proxy_multiprocess/server/main.cpp | 2 | ||||
-rw-r--r-- | tests/auto/proxy_multiprocess/subclass.rep | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/proxy_multiprocess/client/main.cpp b/tests/auto/proxy_multiprocess/client/main.cpp index 986d6d6..4874fb1 100644 --- a/tests/auto/proxy_multiprocess/client/main.cpp +++ b/tests/auto/proxy_multiprocess/client/main.cpp @@ -60,10 +60,12 @@ private Q_SLOTS: QCOMPARE(m_rep->subClass()->i(), initialI); QVERIFY(m_rep->tracks() != nullptr); QVERIFY(tracksSpy.count() || tracksSpy.wait()); + QCOMPARE(m_rep->myEnum(), QVariant::fromValue(ParentClassReplica::bar)); QCOMPARE(m_rep->variant(), QVariant::fromValue(42.0f)); } else { QVERIFY(m_rep->subClass() == nullptr); QVERIFY(m_rep->tracks() == nullptr); + QCOMPARE(m_rep->myEnum(), QVariant::fromValue(ParentClassReplica::foo)); QCOMPARE(m_rep->variant(), QVariant()); } @@ -77,6 +79,7 @@ private Q_SLOTS: QCOMPARE(m_rep->subClass()->myPOD(), updatedValue); QCOMPARE(m_rep->subClass()->i(), updatedI); QVERIFY(m_rep->tracks() != nullptr); + QCOMPARE(m_rep->myEnum(), QVariant::fromValue(ParentClassReplica::foobar)); QCOMPARE(m_rep->variant(), QVariant::fromValue(podValue)); qDebug() << "Verified expected final states, cleaning up."; } diff --git a/tests/auto/proxy_multiprocess/server/main.cpp b/tests/auto/proxy_multiprocess/server/main.cpp index 72f062c..2e6895b 100644 --- a/tests/auto/proxy_multiprocess/server/main.cpp +++ b/tests/auto/proxy_multiprocess/server/main.cpp @@ -55,6 +55,7 @@ private Q_SLOTS: if (objectMode == QLatin1Literal("ObjectPointer")) { parent.setSubClass(&subclass); parent.setTracks(&model); + parent.setMyEnum(ParentClassSource::bar); parent.setVariant(QVariant::fromValue(42.0f)); } @@ -80,6 +81,7 @@ private Q_SLOTS: parent.setSubClass(&updatedSubclass); if (objectMode == QLatin1Literal("NullPointer")) parent.setTracks(&model); + parent.setMyEnum(ParentClassSource::foobar); parent.setVariant(QVariant::fromValue(podValue)); emit parent.advance(); diff --git a/tests/auto/proxy_multiprocess/subclass.rep b/tests/auto/proxy_multiprocess/subclass.rep index e578b8f..7055944 100644 --- a/tests/auto/proxy_multiprocess/subclass.rep +++ b/tests/auto/proxy_multiprocess/subclass.rep @@ -9,12 +9,17 @@ class SubClass class ParentClass { + // We need several Enums to test dynamic registration + ENUM MyEnumProp {foo=1, bar=3, foobar=6} + ENUM MyEnumSignal {a=1, b, c} PROP(bool started = false) + PROP(MyEnumProp myEnum=foo) PROP(QVariant variant) SLOT(bool start()) SLOT(bool quit()) SIGNAL(advance()) + SIGNAL(enum2(MyEnumSignal myEnumSignal, MyEnumSignal sig2)) CLASS subClass(SubClass) MODEL tracks(display) |