/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include #include #include #include #include #include #include #include #include #include #include namespace EMotionFX { using MetaDataRuleBaseClass = InitSceneAPIFixture< AZ::MemoryComponent, AZ::AssetManagerComponent, AZ::JobManagerComponent, AZ::StreamerComponent, AzToolsFramework::Components::PropertyManagerComponent, EMotionFX::Integration::SystemComponent, EMotionFX::Pipeline::MotionGroupExporter >; class MetaDataRuleTestsPipelineFixture : public MetaDataRuleBaseClass { public: void SetUp() override { MetaDataRuleBaseClass::SetUp(); m_commandManager = AZStd::make_unique(); } void TearDown() override { m_commandManager.reset(); MetaDataRuleBaseClass::TearDown(); } private: AZStd::unique_ptr m_commandManager; }; TEST_F(MetaDataRuleTestsPipelineFixture, TestVersion1Import) { EMotionFX::Pipeline::Rule::MetaDataRule::Reflect(GetSerializeContext()); const AZStd::string sourceText { "\n" " \n" " \n" " \n" "\n" }; const Pipeline::Rule::MetaDataRule* metaDataRule = MCore::ReflectionSerializer::Deserialize(sourceText); const AZStd::vector& commands = metaDataRule->GetMetaData&>(); EXPECT_EQ(commands.size(), 5) << "There should be 5 commands"; EMotionFX::Motion* motion = aznew EMotionFX::Motion("TestMotion"); CommandSystem::MetaData::ApplyMetaDataOnMotion(motion, commands); ASSERT_EQ(motion->GetEventTable()->GetNumTracks(), 1); EMotionFX::MotionEventTrack* eventTrack = motion->GetEventTable()->GetTrack(0); EXPECT_STREQ(eventTrack->GetName(), "Sync"); ASSERT_EQ(eventTrack->GetNumEvents(), 1); EMotionFX::MotionEvent& event = eventTrack->GetEvent(0); const EventDataSet& eventDatas = event.GetEventDatas(); ASSERT_EQ(eventDatas.size(), 1); const AZStd::shared_ptr eventData = AZStd::rtti_pointer_cast(eventDatas[0]); ASSERT_TRUE(eventData); EXPECT_STREQ(eventData->GetSubject().c_str(), "RightFoot"); EXPECT_STREQ(eventData->GetParameters().c_str(), ""); EXPECT_STREQ(eventData->GetMirrorSubject().c_str(), "LeftFoot"); motion->Destroy(); delete metaDataRule; } } // end namespace EMotionFX