| 23 | }; |
| 24 | |
| 25 | TEST_F(ScriptDDFTest, TransformToDDF) |
| 26 | { |
| 27 | int top = lua_gettop(L); |
| 28 | |
| 29 | lua_newtable(L); |
| 30 | dmScript::PushVector3(L, dmVMath::Vector3(1.0f, 2.0f, 3.0f)); |
| 31 | lua_setfield(L, -2, "position"); |
| 32 | dmScript::PushQuat(L, dmVMath::Quat(4.0f, 5.0f, 6.0f, 7.0f)); |
| 33 | lua_setfield(L, -2, "rotation"); |
| 34 | |
| 35 | char* buf = new char[sizeof(TestScript::Transform)]; |
| 36 | |
| 37 | uint32_t size = dmScript::CheckDDF(L, TestScript::Transform::m_DDFDescriptor, buf, sizeof(TestScript::Transform), -1); |
| 38 | ASSERT_EQ(sizeof(TestScript::Transform), size); |
| 39 | |
| 40 | TestScript::Transform* transform = (TestScript::Transform*) buf; |
| 41 | |
| 42 | ASSERT_EQ(1.0f, transform->m_Position.getX()); |
| 43 | ASSERT_EQ(2.0f, transform->m_Position.getY()); |
| 44 | ASSERT_EQ(3.0f, transform->m_Position.getZ()); |
| 45 | ASSERT_EQ(4.0f, transform->m_Rotation.getX()); |
| 46 | ASSERT_EQ(5.0f, transform->m_Rotation.getY()); |
| 47 | ASSERT_EQ(6.0f, transform->m_Rotation.getZ()); |
| 48 | ASSERT_EQ(7.0f, transform->m_Rotation.getW()); |
| 49 | |
| 50 | lua_pop(L, 1); |
| 51 | |
| 52 | ASSERT_EQ(top, lua_gettop(L)); |
| 53 | |
| 54 | delete[] buf; |
| 55 | } |
| 56 | |
| 57 | TEST_F(ScriptDDFTest, TransformToLua) |
| 58 | { |
nothing calls this directly
no test coverage detected