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