summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-03-20 11:17:08 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-03-20 15:31:01 +0000
commit40b17bc608858d55386f8353f22a7078574ba61e (patch)
tree760441a63f747a9a1beacad6e66b13fd026073d2 /tests
parent3a81d7b62225f558ff48e3302d91725e00f2c3f9 (diff)
Implement slideEntered/Exited signals in the public API
Needs some rework internally since this needs passing around more data in our internal event struct. Change-Id: I879f11a279bea424b981358f27115969e5980c55 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/behaviors/tst_q3dsbehaviors.cpp8
-rw-r--r--tests/auto/uippresentation/tst_q3dsuippresentation.cpp44
2 files changed, 26 insertions, 26 deletions
diff --git a/tests/auto/behaviors/tst_q3dsbehaviors.cpp b/tests/auto/behaviors/tst_q3dsbehaviors.cpp
index 7252474..d9d5434 100644
--- a/tests/auto/behaviors/tst_q3dsbehaviors.cpp
+++ b/tests/auto/behaviors/tst_q3dsbehaviors.cpp
@@ -178,17 +178,17 @@ void tst_Q3DSBehaviors::events()
QCOMPARE(h.object->property("eventCount").toInt(), 0);
const QString eventKey = QLatin1String("meltdown");
- behaviorOwner->processEvent(eventKey);
+ behaviorOwner->processEvent(Q3DSGraphObject::Event(behaviorOwner, eventKey));
QTRY_VERIFY(h.object->property("updateCount").toInt() > u);
u = h.object->property("updateCount").toInt();
QCOMPARE(h.object->property("eventCount").toInt(), 1);
- behaviorOwner->processEvent(eventKey);
+ behaviorOwner->processEvent(Q3DSGraphObject::Event(behaviorOwner, eventKey));
QTRY_VERIFY(h.object->property("updateCount").toInt() > u);
u = h.object->property("updateCount").toInt();
QCOMPARE(h.object->property("eventCount").toInt(), 2);
- behaviorOwner->processEvent(QLatin1String("not interested"));
+ behaviorOwner->processEvent(Q3DSGraphObject::Event(behaviorOwner, QLatin1String("not interested")));
QTRY_VERIFY(h.object->property("updateCount").toInt() > u);
u = h.object->property("updateCount").toInt();
QCOMPARE(h.object->property("eventCount").toInt(), 2); // must not have changed
@@ -197,7 +197,7 @@ void tst_Q3DSBehaviors::events()
QTRY_VERIFY(h.object->property("updateCount").toInt() > 50);
u = h.object->property("updateCount").toInt();
- behaviorOwner->processEvent(eventKey);
+ behaviorOwner->processEvent(Q3DSGraphObject::Event(behaviorOwner, eventKey));
QTRY_VERIFY(h.object->property("updateCount").toInt() > u);
u = h.object->property("updateCount").toInt();
QCOMPARE(h.object->property("eventCount").toInt(), 2); // must not have changed
diff --git a/tests/auto/uippresentation/tst_q3dsuippresentation.cpp b/tests/auto/uippresentation/tst_q3dsuippresentation.cpp
index 89b1528..70c41fe 100644
--- a/tests/auto/uippresentation/tst_q3dsuippresentation.cpp
+++ b/tests/auto/uippresentation/tst_q3dsuippresentation.cpp
@@ -473,37 +473,37 @@ void tst_Q3DSUipPresentation::events()
const QString event1Key = QLatin1String("some event");
const QString event2Key = QLatin1String("another event");
int triggerCount[] = { 0, 0, 0, 0, 0 };
- int id0 = model1->addEventHandler(event1Key, [model1, &triggerCount, event1Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1 && event == event1Key)
+ int id0 = model1->addEventHandler(event1Key, [model1, &triggerCount, event1Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1 && e.event == event1Key)
++triggerCount[0];
});
- int id1 = model1->addEventHandler(event1Key, [model1, &triggerCount, event1Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1 && event == event1Key)
+ int id1 = model1->addEventHandler(event1Key, [model1, &triggerCount, event1Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1 && e.event == event1Key)
++triggerCount[1];
});
- int id2 = model1->addEventHandler(event2Key, [model1, &triggerCount, event2Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1 && event == event2Key)
+ int id2 = model1->addEventHandler(event2Key, [model1, &triggerCount, event2Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1 && e.event == event2Key)
++triggerCount[2];
});
- model1->processEvent(event1Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event1Key));
QCOMPARE(triggerCount[0], 1);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 0);
- model1->processEvent(event2Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event2Key));
QCOMPARE(triggerCount[0], 1);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 1);
model1->removeEventHandler(event2Key, id2);
- model1->processEvent(event2Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event2Key));
QCOMPARE(triggerCount[0], 1);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 1);
model1->removeEventHandler(event1Key, id1);
- model1->processEvent(event1Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event1Key));
QCOMPARE(triggerCount[0], 2);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 1);
@@ -511,17 +511,17 @@ void tst_Q3DSUipPresentation::events()
// test bubbling up
Q3DSGraphObject *model1Parent = model1->parent(); // layer1
QVERIFY(model1Parent);
- model1Parent->addEventHandler(event1Key, [model1Parent, &triggerCount, event1Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1Parent && event == event1Key)
+ model1Parent->addEventHandler(event1Key, [model1Parent, &triggerCount, event1Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1Parent && e.event == event1Key)
++triggerCount[3];
});
Q3DSGraphObject *model1GrandParent = model1Parent->parent(); // scene
QVERIFY(model1GrandParent);
- model1GrandParent->addEventHandler(event1Key, [model1GrandParent, &triggerCount, event1Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1GrandParent && event == event1Key)
+ model1GrandParent->addEventHandler(event1Key, [model1GrandParent, &triggerCount, event1Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1GrandParent && e.event == event1Key)
++triggerCount[4];
});
- model1->processEvent(event1Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event1Key));
QCOMPARE(triggerCount[0], 3);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 1);
@@ -529,7 +529,7 @@ void tst_Q3DSUipPresentation::events()
QCOMPARE(triggerCount[4], 1);
model1->removeEventHandler(event1Key, id0);
- model1->processEvent(event1Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event1Key));
QCOMPARE(triggerCount[0], 3);
QCOMPARE(triggerCount[1], 1);
QCOMPARE(triggerCount[2], 1);
@@ -547,19 +547,19 @@ void tst_Q3DSUipPresentation::eventsCatchAll()
const QString event1Key = QLatin1String("some event");
const QString event2Key = QLatin1String("another event");
int triggerCount[] = { 0, 0 };
- model1->addEventHandler(QString(), [model1, &triggerCount, event1Key, event2Key](Q3DSGraphObject *obj, const QString &event) {
- if (obj == model1) {
- if (event == event1Key)
+ model1->addEventHandler(QString(), [model1, &triggerCount, event1Key, event2Key](const Q3DSGraphObject::Event &e) {
+ if (e.target == model1) {
+ if (e.event == event1Key)
++triggerCount[0];
- if (event == event2Key)
+ if (e.event == event2Key)
++triggerCount[1];
}
});
- model1->processEvent(event1Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event1Key));
QCOMPARE(triggerCount[0], 1);
QCOMPARE(triggerCount[1], 0);
- model1->processEvent(event2Key);
+ model1->processEvent(Q3DSGraphObject::Event(model1, event2Key));
QCOMPARE(triggerCount[0], 1);
QCOMPARE(triggerCount[1], 1);
}