2024-10-30 07:30:20 +00:00
|
|
|
#ifndef GAMEDEPENDENCIES_H
|
|
|
|
#define GAMEDEPENDENCIES_H
|
2022-11-07 08:12:35 +00:00
|
|
|
|
|
|
|
#include "Game.h"
|
2023-10-21 23:31:55 +00:00
|
|
|
#include "Logger.h"
|
2022-11-07 08:12:35 +00:00
|
|
|
#include "dServer.h"
|
2024-01-08 23:32:09 +00:00
|
|
|
#include "CDClientManager.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "EntityInfo.h"
|
2022-11-07 08:12:35 +00:00
|
|
|
#include "EntityManager.h"
|
2023-01-12 06:36:03 +00:00
|
|
|
#include "dConfig.h"
|
2022-11-28 00:48:46 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
2022-11-07 08:12:35 +00:00
|
|
|
class dZoneManager;
|
|
|
|
class AssetManager;
|
|
|
|
|
|
|
|
class dServerMock : public dServer {
|
2022-11-28 00:48:46 +00:00
|
|
|
RakNet::BitStream* sentBitStream = nullptr;
|
2022-11-07 08:12:35 +00:00
|
|
|
public:
|
|
|
|
dServerMock() {};
|
|
|
|
~dServerMock() {};
|
2022-11-28 00:48:46 +00:00
|
|
|
RakNet::BitStream* GetMostRecentBitStream() { return sentBitStream; };
|
2024-02-27 05:43:33 +00:00
|
|
|
void Send(RakNet::BitStream& bitStream, const SystemAddress& sysAddr, bool broadcast) override { sentBitStream = &bitStream; };
|
2022-11-07 08:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GameDependenciesTest : public ::testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUpDependencies() {
|
2024-01-29 07:53:12 +00:00
|
|
|
info.pos = NiPoint3Constant::ZERO;
|
|
|
|
info.rot = NiQuaternionConstant::IDENTITY;
|
2022-11-07 08:12:35 +00:00
|
|
|
info.scale = 1.0f;
|
|
|
|
info.spawner = nullptr;
|
|
|
|
info.lot = 999;
|
2023-10-21 23:31:55 +00:00
|
|
|
Game::logger = new Logger("./testing.log", true, true);
|
2022-11-07 08:12:35 +00:00
|
|
|
Game::server = new dServerMock();
|
2023-01-12 06:36:03 +00:00
|
|
|
Game::config = new dConfig("worldconfig.ini");
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager = new EntityManager();
|
2024-01-08 23:32:09 +00:00
|
|
|
|
|
|
|
// Create a CDClientManager instance and load from defaults
|
2024-02-09 05:40:43 +00:00
|
|
|
CDClientManager::LoadValuesFromDefaults();
|
2022-11-07 08:12:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TearDownDependencies() {
|
|
|
|
if (Game::server) delete Game::server;
|
2023-07-15 20:56:33 +00:00
|
|
|
if (Game::entityManager) delete Game::entityManager;
|
2022-11-07 08:12:35 +00:00
|
|
|
if (Game::logger) {
|
|
|
|
Game::logger->Flush();
|
|
|
|
delete Game::logger;
|
|
|
|
}
|
2023-01-12 06:36:03 +00:00
|
|
|
if (Game::config) delete Game::config;
|
2022-11-07 08:12:35 +00:00
|
|
|
}
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
EntityInfo info{};
|
2022-11-07 08:12:35 +00:00
|
|
|
};
|
|
|
|
|
2024-10-30 07:30:20 +00:00
|
|
|
#endif //!GAMEDEPENDENCIES_H
|