/***************************************************************************** * Copyright (c) 2014-2018 OpenRCT2 developers * * For a complete list of all authors, please refer to contributors.md * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ #include "TestData.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace OpenRCT2; class ReplayTests : public testing::Test { protected: std::vector GetReplayFiles() { std::string basePath = TestData::GetBasePath(); std::string replayPath = Path::Combine(basePath, "replays"); std::string replayPathPattern = Path::Combine(replayPath, "*.sv6r"); std::vector files; std::unique_ptr scanner = std::unique_ptr(Path::ScanDirectory(replayPathPattern, true)); while (scanner->Next()) { files.push_back(scanner->GetPath()); } return files; } }; TEST_F(ReplayTests, all) { std::vector replayFiles = GetReplayFiles(); if (replayFiles.empty()) { SUCCEED(); } gOpenRCT2Headless = true; gOpenRCT2NoGraphics = true; core_init(); for (auto&& replayFile : replayFiles) { auto context = CreateContext(); bool initialised = context->Initialise(); ASSERT_TRUE(initialised); auto gs = context->GetGameState(); ASSERT_NE(gs, nullptr); IReplayManager* replayManager = context->GetReplayManager(); ASSERT_NE(replayManager, nullptr); bool startedReplay = replayManager->StartPlayback(replayFile); ASSERT_TRUE(startedReplay); while (replayManager->IsReplaying()) { gs->UpdateLogic(); ASSERT_TRUE(replayManager->IsPlaybackStateMismatching() == false); } } SUCCEED(); }