Translations:KDevelop5/Manual/Code generation with templates/77/en: Difference between revisions
Appearance
Importing a new version from external source |
Importing a new version from external source |
||
Line 1: | Line 1: | ||
* testNumberOfPassengersChanged | * testNumberOfPassengersChanged<syntaxhighlight lang="cpp" line>void TestBus::testNumberOfPassengersChanged() | ||
{ | { | ||
// create spy object | // create spy object | ||
Line 10: | Line 10: | ||
// verify the signal was sent | // verify the signal was sent | ||
QCOMPARE(spy1.count(), 1); | QCOMPARE(spy1.count(), 1); | ||
}</ | }</syntaxhighlight> |
Latest revision as of 08:38, 2 April 2020
- testNumberOfPassengersChanged
void TestBus::testNumberOfPassengersChanged() { // create spy object QSignalSpy spy1(&m_bus, &Transportation::Bus::numberOfPassengersChanged); // now change the number of passengers m_bus.setNumberOfPassengers(4); // verify the check was made QVERIFY(m_bus.numberOfPassengers() == 4); // verify the signal was sent QCOMPARE(spy1.count(), 1); }