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:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user