Adding tests for decompose function
Added scale and rotation decompose test
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#include <YoggieEngine.h>
|
||||
#include <ImGuizmo.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
@ -23,6 +24,42 @@ TEST(TRANSFORM_COMPONENT_TESTS , CAN_EXTRACT_TRANSLATION_FROM_TRANSFORM_MATRIX)
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
|
Reference in New Issue
Block a user