/***************************************************************************** * Copyright (c) 2014-2025 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 /* Test that all JSONs are with the expected formatting, otherwise the fetcher will abort NOTE: This will *not* test that it actually applies the patch, due to the scenarios not being available on the CI environment. */ TEST(FetchAndApplyScenarioPatch, expected_json_format) { // Needs to be headless and without graphics not to prompt for RCT2 path gOpenRCT2Headless = true; gOpenRCT2NoGraphics = true; auto context = OpenRCT2::CreateContext(); bool initialised = context->Initialise(); ASSERT_TRUE(initialised); auto& env = context->GetPlatformEnvironment(); auto scenarioPatches = env.GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DirId::scenarioPatches); std::error_code ec; OpenRCT2::RCT12::SetDryRun(true); OpenRCT2::Guard::SetAssertBehaviour(AssertBehaviour::abort); static const u8string dummySHA; for (const fs::directory_entry& entry : fs::directory_iterator(scenarioPatches, ec)) { auto path = entry.path().u8string(); if (OpenRCT2::String::endsWith(path, ".parkpatch")) { OpenRCT2::RCT12::ApplyScenarioPatch(path, dummySHA); } } SUCCEED(); }