| 56 | } |
| 57 | |
| 58 | UNIT_TEST(PowerManager_SetFacility) |
| 59 | { |
| 60 | auto const configPath = PowerManager::GetConfigPath(); |
| 61 | SCOPE_GUARD(deleteFileGuard, bind(&FileWriter::DeleteFileX, std::cref(configPath))); |
| 62 | PowerManager manager; |
| 63 | SubscriberForTesting subscriber; |
| 64 | |
| 65 | manager.Subscribe(&subscriber); |
| 66 | |
| 67 | TestIsAllFacilitiesInState(manager, true); |
| 68 | TEST_EQUAL(manager.GetScheme(), Scheme::Normal, ()); |
| 69 | manager.SetFacility(Facility::Buildings3d, false); |
| 70 | TestAllFacilitiesEnabledExcept(manager, {Facility::Buildings3d}); |
| 71 | TEST_EQUAL(manager.GetScheme(), Scheme::None, ()); |
| 72 | |
| 73 | TEST_EQUAL(subscriber.m_onFacilityEvents.size(), 1, ()); |
| 74 | TEST_EQUAL(subscriber.m_onFacilityEvents[0].m_facility, Facility::Buildings3d, ()); |
| 75 | TEST_EQUAL(subscriber.m_onFacilityEvents[0].m_state, false, ()); |
| 76 | TEST_EQUAL(subscriber.m_onShemeEvents.size(), 1, ()); |
| 77 | TEST_EQUAL(subscriber.m_onShemeEvents[0], Scheme::None, ()); |
| 78 | |
| 79 | subscriber.m_onFacilityEvents.clear(); |
| 80 | subscriber.m_onShemeEvents.clear(); |
| 81 | |
| 82 | manager.SetFacility(Facility::MapDownloader, false); |
| 83 | TestAllFacilitiesEnabledExcept(manager, {Facility::Buildings3d, Facility::MapDownloader}); |
| 84 | TEST_EQUAL(manager.GetScheme(), Scheme::None, ()); |
| 85 | |
| 86 | TEST_EQUAL(subscriber.m_onFacilityEvents.size(), 1, ()); |
| 87 | TEST_EQUAL(subscriber.m_onFacilityEvents[0].m_facility, Facility::MapDownloader, ()); |
| 88 | TEST_EQUAL(subscriber.m_onFacilityEvents[0].m_state, false, ()); |
| 89 | TEST_EQUAL(subscriber.m_onShemeEvents.size(), 0, ()); |
| 90 | } |
| 91 | |
| 92 | UNIT_TEST(PowerManager_SetScheme) |
| 93 | { |
nothing calls this directly
no test coverage detected