diff --git a/tests/unittest_area/tst_unittest_area.cpp b/tests/unittest_area/tst_unittest_area.cpp index 6ef9bcd..69a2c74 100644 --- a/tests/unittest_area/tst_unittest_area.cpp +++ b/tests/unittest_area/tst_unittest_area.cpp @@ -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("statusCall"); + QTest::addColumn("expectedStatus"); + QTest::addColumn("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); +} + } }