1 /***************************************************************************** 2 * Copyright (c) 2014-2018 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #include "TestData.h" 11 12 #include <gtest/gtest.h> 13 #include <openrct2/Context.h> 14 #include <openrct2/Game.h> 15 #include <openrct2/GameState.h> 16 #include <openrct2/OpenRCT2.h> 17 #include <openrct2/ParkImporter.h> 18 #include <openrct2/audio/AudioContext.h> 19 #include <openrct2/core/File.h> 20 #include <openrct2/core/Path.hpp> 21 #include <openrct2/core/String.hpp> 22 #include <openrct2/platform/platform.h> 23 #include <openrct2/ride/Ride.h> 24 #include <string> 25 26 using namespace OpenRCT2; 27 28 constexpr int32_t updatesToTest = 10; 29 TEST(MultiLaunchTest,all)30TEST(MultiLaunchTest, all) 31 { 32 std::string path = TestData::GetParkPath("bpb.sv6"); 33 34 gOpenRCT2Headless = true; 35 gOpenRCT2NoGraphics = true; 36 37 core_init(); 38 for (int i = 0; i < 3; i++) 39 { 40 auto context = CreateContext(); 41 bool initialised = context->Initialise(); 42 ASSERT_TRUE(initialised); 43 44 load_from_sv6(path.c_str()); 45 game_load_init(); 46 47 // Check ride count to check load was successful 48 ASSERT_EQ(ride_get_count(), 134); 49 auto gs = context->GetGameState(); 50 ASSERT_NE(gs, nullptr); 51 auto& date = gs->GetDate(); 52 ASSERT_EQ(date.GetMonthTicks(), 0); 53 54 for (int j = 0; j < updatesToTest; j++) 55 { 56 gs->UpdateLogic(); 57 } 58 59 ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest); 60 61 // Check ride count again 62 ASSERT_EQ(ride_get_count(), 134); 63 } 64 SUCCEED(); 65 } 66