1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 01:22:25 +01:00

Show error message when issuing replay_start with a nonexistent file

This commit is contained in:
Kirill Gusev
2025-12-09 10:56:08 +03:00
committed by GitHub
parent cc1e217a90
commit b1103708ea
6 changed files with 88 additions and 41 deletions

View File

@@ -9,8 +9,10 @@
#include "TestData.h"
#include <exception>
#include <gtest/gtest.h>
#include <openrct2/Context.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/Game.h>
#include <openrct2/GameState.h>
#include <openrct2/OpenRCT2.h>
@@ -22,6 +24,7 @@
#include <openrct2/core/String.hpp>
#include <openrct2/platform/Platform.h>
#include <openrct2/ride/Ride.h>
#include <stdexcept>
#include <string>
using namespace OpenRCT2;
@@ -58,7 +61,7 @@ static std::vector<ReplayTestData> GetReplayFiles()
{
ReplayTestData test;
test.name = sanitizeTestName(scanner->GetFileInfo().Name);
test.filePath = scanner->GetPath();
test.filePath = Path::GetAbsolute(scanner->GetPath());
res.push_back(std::move(test));
}
return res;
@@ -84,8 +87,15 @@ TEST_P(ReplayTests, RunReplay)
IReplayManager* replayManager = context->GetReplayManager();
ASSERT_NE(replayManager, nullptr);
bool startedReplay = replayManager->StartPlayback(replayFile);
ASSERT_TRUE(startedReplay);
try
{
replayManager->StartPlayback(replayFile);
}
catch (const std::exception& e)
{
LOG_WARNING("Can't start replay!. %s", e.what());
FAIL();
}
while (replayManager->IsReplaying())
{