/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "LmbrCentralReflectionTest.h"
#include "Shape/EditorSphereShapeComponent.h"
namespace LmbrCentral
{
// Serialized legacy EditorSphereShapeComponent v1.
const char kEditorSphereComponentVersion1[] =
R"DELIMITER(
)DELIMITER";
class LoadEditorSphereShapeComponentFromVersion1
: public LoadEditorComponentTest
{
protected:
const char* GetSourceDataBuffer() const override { return kEditorSphereComponentVersion1; }
};
TEST_F(LoadEditorSphereShapeComponentFromVersion1, Application_IsRunning)
{
ASSERT_NE(GetApplication(), nullptr);
}
TEST_F(LoadEditorSphereShapeComponentFromVersion1, Components_Load)
{
EXPECT_NE(m_object.get(), nullptr);
}
TEST_F(LoadEditorSphereShapeComponentFromVersion1, EditorComponent_Found)
{
EXPECT_EQ(m_entity->GetComponents().size(), 2);
EXPECT_NE(m_entity->FindComponent(m_object->GetId()), nullptr);
}
TEST_F(LoadEditorSphereShapeComponentFromVersion1, Radius_MatchesSourceData)
{
float radius = 0.0f;
SphereShapeComponentRequestsBus::EventResult(
radius, m_entity->GetId(), &SphereShapeComponentRequests::GetRadius);
EXPECT_FLOAT_EQ(radius, 0.57f);
}
}