Fix failing component tests and add missing component tests with submodule initialization

Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-01 16:00:35 +00:00
parent d3b5941458
commit 316e0bc47e
8 changed files with 232 additions and 219 deletions

View File

@@ -0,0 +1,44 @@
#include <gtest/gtest.h>
#include "BuildBorderComponent.h"
#include "Entity.h"
#include "BitStream.h"
#include "GameDependencies.h"
class BuildBorderComponentTest : public GameDependenciesTest {
protected:
};
/**
* Test BuildBorderComponent serialization for initial update
*/
TEST_F(BuildBorderComponentTest, SerializeInitialUpdate) {
Entity testEntity(15, info);
BuildBorderComponent buildBorderComponent(&testEntity);
RakNet::BitStream bitStream;
buildBorderComponent.Serialize(bitStream, true);
bitStream.ResetReadPointer();
// BuildBorderComponent always writes true for initial update
bool hasBorderData;
ASSERT_TRUE(bitStream.Read(hasBorderData));
EXPECT_TRUE(hasBorderData);
}
/**
* Test BuildBorderComponent serialization for regular update (should write nothing)
*/
TEST_F(BuildBorderComponentTest, SerializeRegularUpdate) {
Entity testEntity(15, info);
BuildBorderComponent buildBorderComponent(&testEntity);
RakNet::BitStream bitStream;
buildBorderComponent.Serialize(bitStream, false);
bitStream.ResetReadPointer();
// For regular updates, BuildBorderComponent writes nothing
EXPECT_EQ(bitStream.GetNumberOfBitsUsed(), 0);
}