mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 17:38:08 +00:00
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:
43
tests/dGameTests/dComponentsTests/TriggerComponentTests.cpp
Normal file
43
tests/dGameTests/dComponentsTests/TriggerComponentTests.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "TriggerComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "BitStream.h"
|
||||
#include "GameDependencies.h"
|
||||
|
||||
class TriggerComponentTest : public GameDependenciesTest {
|
||||
protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Test TriggerComponent serialization for initial update
|
||||
*/
|
||||
TEST_F(TriggerComponentTest, SerializeInitialUpdate) {
|
||||
Entity testEntity(15, info);
|
||||
TriggerComponent triggerComponent(&testEntity, ""); // Need triggerInfo parameter
|
||||
|
||||
RakNet::BitStream bitStream;
|
||||
triggerComponent.Serialize(bitStream, true);
|
||||
|
||||
bitStream.ResetReadPointer();
|
||||
|
||||
// TriggerComponent typically writes minimal data or no data
|
||||
// Trigger logic is usually server-side only
|
||||
EXPECT_EQ(bitStream.GetNumberOfBitsUsed(), 0); // Usually empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Test TriggerComponent serialization for regular update
|
||||
*/
|
||||
TEST_F(TriggerComponentTest, SerializeRegularUpdate) {
|
||||
Entity testEntity(15, info);
|
||||
TriggerComponent triggerComponent(&testEntity, ""); // Need triggerInfo parameter
|
||||
|
||||
RakNet::BitStream bitStream;
|
||||
triggerComponent.Serialize(bitStream, false);
|
||||
|
||||
bitStream.ResetReadPointer();
|
||||
|
||||
// Regular updates also typically write no data
|
||||
EXPECT_EQ(bitStream.GetNumberOfBitsUsed(), 0);
|
||||
}
|
Reference in New Issue
Block a user