2023-05-13 18:13:25 +00:00
|
|
|
#include <YoggieEngine.h>
|
2023-05-16 18:43:05 +00:00
|
|
|
#include <ImGuizmo.h>
|
2023-05-13 18:13:25 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
|
|
|
|
TEST(HelloTDD, MyFirstTest) {
|
|
|
|
EXPECT_EQ(1, 1);
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST(TRANSFORM_COMPONENT_TESTS , CAN_EXTRACT_TRANSLATION_FROM_TRANSFORM_MATRIX) {
|
|
|
|
|
|
|
|
auto component = YoggieEngine::TransformComponent{};
|
|
|
|
|
|
|
|
component.Position = glm::vec3(1.0f, 2.0f, 3.0f);
|
|
|
|
auto transformationMatrix = component.GetTransform();
|
|
|
|
|
|
|
|
auto newComponent = YoggieEngine::TransformComponent{};
|
|
|
|
|
|
|
|
newComponent.Decompose(transformationMatrix);
|
|
|
|
|
|
|
|
EXPECT_EQ(newComponent.Position.x, component.Position.x);
|
|
|
|
EXPECT_EQ(newComponent.Position.y, component.Position.y);
|
|
|
|
EXPECT_EQ(newComponent.Position.z, component.Position.z);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-05-16 18:43:05 +00:00
|
|
|
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_SCALE_FROM_TRANSFORM_MATRIX) {
|
|
|
|
auto component = YoggieEngine::TransformComponent{};
|
|
|
|
|
|
|
|
component.Scale = glm::vec3(1.0f, 2.0f, 3.0f);
|
|
|
|
|
|
|
|
auto tranformationMatrix = component.GetTransform();
|
|
|
|
|
|
|
|
auto newComponent = YoggieEngine::TransformComponent{};
|
|
|
|
|
|
|
|
newComponent.Decompose(tranformationMatrix);
|
|
|
|
|
|
|
|
EXPECT_EQ(newComponent.Scale.x, component.Scale.x);
|
|
|
|
EXPECT_EQ(newComponent.Scale.y, component.Scale.y);
|
|
|
|
EXPECT_EQ(newComponent.Scale.z, component.Scale.z);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_ROTATION_FROM_TRANSFORM_MATRIX) {
|
|
|
|
auto component = YoggieEngine::TransformComponent{};
|
|
|
|
component.Rotation = glm::vec3(2.0f, 10.0f, 20.0f);
|
|
|
|
|
|
|
|
auto transformMatrix = component.GetTransform();
|
|
|
|
|
|
|
|
auto newComponent = YoggieEngine::TransformComponent{};
|
|
|
|
|
|
|
|
newComponent.Decompose(transformMatrix);
|
|
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(newComponent.Rotation.x, component.Rotation.x);
|
|
|
|
EXPECT_EQ(newComponent.Rotation.y, component.Rotation.y);
|
|
|
|
EXPECT_EQ(newComponent.Rotation.z, component.Rotation.z);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-05-13 18:13:25 +00:00
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
|
|
|
|
}
|