fix event tests

This commit is contained in:
Simon Stürz 2016-03-04 13:28:56 +01:00 committed by Michael Zanetti
parent a4cffced68
commit 99cf429335

View File

@ -67,12 +67,14 @@ void TestEvents::triggerEvent()
// Lets wait for the notification
spy.wait();
QCOMPARE(spy.count(), 1);
// Make sure the event contains all the stuff we expect
Event event = spy.at(0).at(0).value<Event>();
QCOMPARE(event.eventTypeId(), mockEvent1Id);
QCOMPARE(event.deviceId(), device->id());
QVERIFY(spy.count() > 0);
for (int i = 0; i < spy.count(); i++ ){
Event event = spy.at(i).at(0).value<Event>();
if (event.deviceId() == device->id()) {
// Make sure the event contains all the stuff we expect
QCOMPARE(event.eventTypeId(), mockEvent1Id);
}
}
}
void TestEvents::triggerStateChangeEvent()
@ -94,13 +96,15 @@ void TestEvents::triggerStateChangeEvent()
// Lets wait for the notification
spy.wait();
QCOMPARE(spy.count(), 1);
// Make sure the event contains all the stuff we expect
Event event = spy.at(0).at(0).value<Event>();
QCOMPARE(event.eventTypeId().toString(), mockIntStateId.toString());
QCOMPARE(event.deviceId(), device->id());
QCOMPARE(event.param("value").value().toInt(), 11);
QVERIFY(spy.count() > 0);
for (int i = 0; i < spy.count(); i++ ){
Event event = spy.at(i).at(0).value<Event>();
if (event.deviceId() == device->id()) {
// Make sure the event contains all the stuff we expect
QCOMPARE(event.eventTypeId().toString(), mockIntStateId.toString());
QCOMPARE(event.param("value").value().toInt(), 11);
}
}
}
void TestEvents::params()