Add status tests
This commit is contained in:
parent
0a87f30287
commit
025d8e0d1b
@ -20,6 +20,9 @@ private slots:
|
||||
void cleanup();
|
||||
|
||||
void clientJoinLeave();
|
||||
|
||||
void areaStatuses_data();
|
||||
void areaStatuses();
|
||||
};
|
||||
|
||||
void Area::init()
|
||||
@ -46,6 +49,34 @@ void Area::clientJoinLeave()
|
||||
QCOMPARE(m_area->charactersTaken().size(), 0);
|
||||
}
|
||||
|
||||
void Area::areaStatuses_data()
|
||||
{
|
||||
QTest::addColumn<QString>("statusCall");
|
||||
QTest::addColumn<AreaData::Status>("expectedStatus");
|
||||
QTest::addColumn<bool>("isSuccessful");
|
||||
|
||||
QTest::newRow("Idle") << "idle" << AreaData::Status::IDLE << true;
|
||||
QTest::newRow("RP") << "rp" << AreaData::Status::RP << true;
|
||||
QTest::newRow("Casing") << "casing" << AreaData::Status::CASING << true;
|
||||
QTest::newRow("Looking for players (long)") << "looking-for-players" << AreaData::Status::LOOKING_FOR_PLAYERS << true;
|
||||
QTest::newRow("Looking for players (short)") << "lfp" << AreaData::Status::LOOKING_FOR_PLAYERS << true;
|
||||
QTest::newRow("Gaming") << "gaming" << AreaData::Status::GAMING << true;
|
||||
QTest::newRow("Recess") << "recess" << AreaData::Status::RECESS << true;
|
||||
QTest::newRow("Nonsense") << "blah" << AreaData::Status::IDLE << false;
|
||||
}
|
||||
|
||||
void Area::areaStatuses()
|
||||
{
|
||||
QFETCH(QString, statusCall);
|
||||
QFETCH(AreaData::Status, expectedStatus);
|
||||
QFETCH(bool, isSuccessful);
|
||||
|
||||
bool l_success = m_area->changeStatus(statusCall);
|
||||
|
||||
QCOMPARE(m_area->status(), expectedStatus);
|
||||
QCOMPARE(l_success, isSuccessful);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user