mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-01 21:22:06 +00:00
use dummy database and add missing pure fns
This commit is contained in:
@@ -168,7 +168,7 @@ void TestSQLDatabase::InsertNewPropertyModel(const LWOOBJID& propertyId, const I
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSQLDatabase::UpdateModelPositionRotation(const LWOOBJID& propertyId, const NiPoint3& position, const NiQuaternion& rotation) {
|
void TestSQLDatabase::UpdateModel(const LWOOBJID& propertyId, const NiPoint3& position, const NiQuaternion& rotation, const std::array<std::pair<int32_t, std::string>, 5>& behaviors) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,3 +288,15 @@ std::vector<uint32_t> TestSQLDatabase::GetRewardCodesByAccountID(const uint32_t
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestSQLDatabase::AddBehavior(const IBehaviors::Info& info) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string TestSQLDatabase::GetBehavior(const int32_t behaviorId) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestSQLDatabase::RemoveBehavior(const int32_t behaviorId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TestSQLDatabase : public GameDatabase {
|
|||||||
std::vector<IPropertyContents::Model> GetPropertyModels(const LWOOBJID& propertyId) override;
|
std::vector<IPropertyContents::Model> GetPropertyModels(const LWOOBJID& propertyId) override;
|
||||||
void RemoveUnreferencedUgcModels() override;
|
void RemoveUnreferencedUgcModels() override;
|
||||||
void InsertNewPropertyModel(const LWOOBJID& propertyId, const IPropertyContents::Model& model, const std::string_view name) override;
|
void InsertNewPropertyModel(const LWOOBJID& propertyId, const IPropertyContents::Model& model, const std::string_view name) override;
|
||||||
void UpdateModelPositionRotation(const LWOOBJID& propertyId, const NiPoint3& position, const NiQuaternion& rotation) override;
|
void UpdateModel(const LWOOBJID& propertyId, const NiPoint3& position, const NiQuaternion& rotation, const std::array<std::pair<int32_t, std::string>, 5>& behaviors) override;
|
||||||
void RemoveModel(const LWOOBJID& modelId) override;
|
void RemoveModel(const LWOOBJID& modelId) override;
|
||||||
void UpdatePerformanceCost(const LWOZONEID& zoneId, const float performanceCost) override;
|
void UpdatePerformanceCost(const LWOZONEID& zoneId, const float performanceCost) override;
|
||||||
void InsertNewBugReport(const IBugReports::Info& info) override;
|
void InsertNewBugReport(const IBugReports::Info& info) override;
|
||||||
@@ -86,6 +86,9 @@ class TestSQLDatabase : public GameDatabase {
|
|||||||
std::vector<IIgnoreList::Info> GetIgnoreList(const uint32_t playerId) override;
|
std::vector<IIgnoreList::Info> GetIgnoreList(const uint32_t playerId) override;
|
||||||
void InsertRewardCode(const uint32_t account_id, const uint32_t reward_code) override;
|
void InsertRewardCode(const uint32_t account_id, const uint32_t reward_code) override;
|
||||||
std::vector<uint32_t> GetRewardCodesByAccountID(const uint32_t account_id) override;
|
std::vector<uint32_t> GetRewardCodesByAccountID(const uint32_t account_id) override;
|
||||||
|
virtual void AddBehavior(const IBehaviors::Info& info);
|
||||||
|
virtual std::string GetBehavior(const int32_t behaviorId);
|
||||||
|
virtual void RemoveBehavior(const int32_t behaviorId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!TESTSQLDATABASE_H
|
#endif //!TESTSQLDATABASE_H
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "dZoneManager.h"
|
#include "dZoneManager.h"
|
||||||
|
#include "GameDatabase/TestSQL/TestSQLDatabase.h"
|
||||||
|
#include "Database.h"
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
class dZoneManager;
|
class dZoneManager;
|
||||||
@@ -38,6 +40,7 @@ protected:
|
|||||||
Game::entityManager = new EntityManager();
|
Game::entityManager = new EntityManager();
|
||||||
Game::zoneManager = new dZoneManager();
|
Game::zoneManager = new dZoneManager();
|
||||||
Game::zoneManager->LoadZone(LWOZONEID(1, 0, 0));
|
Game::zoneManager->LoadZone(LWOZONEID(1, 0, 0));
|
||||||
|
Database::_setDatabase(new TestSQLDatabase()); // this new is managed by the Database
|
||||||
|
|
||||||
// Create a CDClientManager instance and load from defaults
|
// Create a CDClientManager instance and load from defaults
|
||||||
CDClientManager::LoadValuesFromDefaults();
|
CDClientManager::LoadValuesFromDefaults();
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ TEST_F(SavingTest, CharacterComponentTest) {
|
|||||||
auto hairStylePrev = characterComponent->m_Character->GetHairStyle();
|
auto hairStylePrev = characterComponent->m_Character->GetHairStyle();
|
||||||
auto pantsColorPrev = characterComponent->m_Character->GetPantsColor();
|
auto pantsColorPrev = characterComponent->m_Character->GetPantsColor();
|
||||||
auto leftHandPrev = characterComponent->m_Character->GetLeftHand();
|
auto leftHandPrev = characterComponent->m_Character->GetLeftHand();
|
||||||
|
auto shirtStylePrev = characterComponent->m_Character->GetShirtStyle();
|
||||||
auto mouthPrev = characterComponent->m_Character->GetMouth();
|
auto mouthPrev = characterComponent->m_Character->GetMouth();
|
||||||
auto rightHandPrev = characterComponent->m_Character->GetRightHand();
|
auto rightHandPrev = characterComponent->m_Character->GetRightHand();
|
||||||
auto shirtColorPrev = characterComponent->m_Character->GetShirtColor();
|
auto shirtColorPrev = characterComponent->m_Character->GetShirtColor();
|
||||||
@@ -75,7 +76,7 @@ TEST_F(SavingTest, CharacterComponentTest) {
|
|||||||
characterComponent = entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
|
characterComponent = entity->AddComponent<CharacterComponent>(character.get(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||||
characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
||||||
|
|
||||||
// Check that the buff component is the same as before
|
// Check that the buff component is the same as before which means resaving data and loading it back in didn't change anything
|
||||||
ASSERT_EQ(statsPrev, characterComponent->StatisticsToString());
|
ASSERT_EQ(statsPrev, characterComponent->StatisticsToString());
|
||||||
ASSERT_EQ(claimCodesPrev, characterComponent->GetClaimCodes());
|
ASSERT_EQ(claimCodesPrev, characterComponent->GetClaimCodes());
|
||||||
ASSERT_EQ(eyebrowsPrev, characterComponent->m_Character->GetEyebrows());
|
ASSERT_EQ(eyebrowsPrev, characterComponent->m_Character->GetEyebrows());
|
||||||
@@ -86,7 +87,27 @@ TEST_F(SavingTest, CharacterComponentTest) {
|
|||||||
ASSERT_EQ(leftHandPrev, characterComponent->m_Character->GetLeftHand());
|
ASSERT_EQ(leftHandPrev, characterComponent->m_Character->GetLeftHand());
|
||||||
ASSERT_EQ(mouthPrev, characterComponent->m_Character->GetMouth());
|
ASSERT_EQ(mouthPrev, characterComponent->m_Character->GetMouth());
|
||||||
ASSERT_EQ(rightHandPrev, characterComponent->m_Character->GetRightHand());
|
ASSERT_EQ(rightHandPrev, characterComponent->m_Character->GetRightHand());
|
||||||
|
ASSERT_EQ(shirtStylePrev, characterComponent->m_Character->GetShirtStyle());
|
||||||
ASSERT_EQ(shirtColorPrev, characterComponent->m_Character->GetShirtColor());
|
ASSERT_EQ(shirtColorPrev, characterComponent->m_Character->GetShirtColor());
|
||||||
|
|
||||||
|
// Check that no data was lost during the saving process.
|
||||||
|
ASSERT_EQ("32114;69;343;13;163;2;181;2;388;252;146;24451;25;9022;41898;42186;42524;4404;0;0;0;0;0;0;0;0;0;", characterComponent->StatisticsToString());
|
||||||
|
|
||||||
|
// need a variable because the macro does not support {}
|
||||||
|
const std::array<uint64_t, 4> correctCodes = { 1073741968, 0, 0, 0 };
|
||||||
|
ASSERT_EQ(correctCodes, characterComponent->GetClaimCodes());
|
||||||
|
ASSERT_EQ(1, characterComponent->m_Character->GetEyebrows());
|
||||||
|
ASSERT_EQ(2, characterComponent->m_Character->GetEyes());
|
||||||
|
ASSERT_EQ(9, characterComponent->m_Character->GetHairColor());
|
||||||
|
ASSERT_EQ(8, characterComponent->m_Character->GetHairStyle());
|
||||||
|
ASSERT_EQ(3, characterComponent->m_Character->GetPantsColor());
|
||||||
|
ASSERT_EQ(27634704, characterComponent->m_Character->GetLeftHand());
|
||||||
|
ASSERT_EQ(3, characterComponent->m_Character->GetMouth());
|
||||||
|
ASSERT_EQ(27187396, characterComponent->m_Character->GetRightHand());
|
||||||
|
ASSERT_EQ(13, characterComponent->m_Character->GetShirtColor());
|
||||||
|
|
||||||
|
// Fails currently due to not reading style from xml
|
||||||
|
// ASSERT_EQ(27, characterComponent->m_Character->GetShirtStyle());
|
||||||
|
|
||||||
// character->GetXMLDoc().Print(&printer);
|
// character->GetXMLDoc().Print(&printer);
|
||||||
// std::string xmlDataModified(printer.CStr());
|
// std::string xmlDataModified(printer.CStr());
|
||||||
|
|||||||
Reference in New Issue
Block a user