2018-06-15 08:07:34 -04:00
|
|
|
/*****************************************************************************
|
|
|
|
* 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.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2017-06-21 12:39:10 -04:00
|
|
|
#include <string>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <openrct2/audio/AudioContext.h>
|
|
|
|
#include <openrct2/Context.h>
|
|
|
|
#include <openrct2/core/File.h>
|
|
|
|
#include <openrct2/core/Path.hpp>
|
|
|
|
#include <openrct2/core/String.hpp>
|
2017-08-27 16:40:56 -04:00
|
|
|
#include <openrct2/GameState.h>
|
2017-06-21 12:39:10 -04:00
|
|
|
#include <openrct2/OpenRCT2.h>
|
2017-08-02 17:48:10 -04:00
|
|
|
#include <openrct2/ParkImporter.h>
|
2018-03-13 08:14:02 -04:00
|
|
|
#include <openrct2/ride/Ride.h>
|
2017-06-21 12:39:10 -04:00
|
|
|
#include "TestData.h"
|
|
|
|
|
2017-09-28 16:30:02 -04:00
|
|
|
#include <openrct2/platform/platform.h>
|
2017-11-30 12:17:06 -05:00
|
|
|
#include <openrct2/Game.h>
|
2017-06-21 12:39:10 -04:00
|
|
|
|
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
2017-08-27 16:40:56 -04:00
|
|
|
constexpr sint32 updatesToTest = 10;
|
|
|
|
|
2017-06-21 12:39:10 -04:00
|
|
|
TEST(MultiLaunchTest, all)
|
|
|
|
{
|
|
|
|
std::string path = TestData::GetParkPath("bpb.sv6");
|
|
|
|
|
|
|
|
gOpenRCT2Headless = true;
|
2018-04-10 07:33:37 -04:00
|
|
|
gOpenRCT2NoGraphics = true;
|
2017-06-21 12:39:10 -04:00
|
|
|
|
|
|
|
core_init();
|
2017-06-24 03:54:24 -04:00
|
|
|
for (int i = 0; i < 3; i++)
|
2017-06-21 12:39:10 -04:00
|
|
|
{
|
|
|
|
auto context = CreateContext();
|
|
|
|
bool initialised = context->Initialise();
|
|
|
|
ASSERT_TRUE(initialised);
|
|
|
|
|
2018-05-21 14:06:21 -04:00
|
|
|
load_from_sv6(path.c_str());
|
2017-08-02 05:07:16 -04:00
|
|
|
game_load_init();
|
2017-06-21 12:39:10 -04:00
|
|
|
|
|
|
|
// Check ride count to check load was successful
|
|
|
|
ASSERT_EQ(gRideCount, 134);
|
2017-08-27 16:40:56 -04:00
|
|
|
auto gs = context->GetGameState();
|
|
|
|
ASSERT_NE(gs, nullptr);
|
2018-05-30 08:06:39 -04:00
|
|
|
auto& date = gs->GetDate();
|
|
|
|
ASSERT_EQ(date.GetMonthTicks(), 0);
|
2017-06-21 12:39:10 -04:00
|
|
|
|
2017-08-27 16:40:56 -04:00
|
|
|
for (int j = 0; j < updatesToTest; j++)
|
2017-08-01 18:52:33 -04:00
|
|
|
{
|
2017-08-27 16:40:56 -04:00
|
|
|
gs->UpdateLogic();
|
2017-08-01 18:52:33 -04:00
|
|
|
}
|
|
|
|
|
2018-05-30 08:06:39 -04:00
|
|
|
ASSERT_EQ(date.GetMonthTicks(), 7862 + updatesToTest);
|
2017-08-27 16:40:56 -04:00
|
|
|
|
2017-08-02 17:50:49 -04:00
|
|
|
// Check ride count again
|
|
|
|
ASSERT_EQ(gRideCount, 134);
|
2017-06-21 12:39:10 -04:00
|
|
|
}
|
|
|
|
SUCCEED();
|
|
|
|
}
|