/* * 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 #include #include "ScriptCanvasTestingSystemComponent.h" #include "ScriptCanvasTestBus.h" #include "Framework/ScriptCanvasTestVerify.h" #include "Nodes/BehaviorContextObjectTestNode.h" #include "Nodes/Nodeables/SharedDataSlotExample.h" #include "Nodes/Nodeables/ValuePointerReferenceExample.h" #include "Nodes/TestAutoGenFunctions.h" namespace ScriptCanvasTestingNodes { void BehaviorContextObjectTest::Reflect(AZ::ReflectContext* context) { AZ::SerializeContext* serializeContext = azrtti_cast(context); if (serializeContext) { serializeContext->Class() ->Version(0) ->Field("String", &BehaviorContextObjectTest::m_string) ->Field("Name", &BehaviorContextObjectTest::m_name) ; if (AZ::EditContext* editContext = serializeContext->GetEditContext()) { editContext->Class("Behavior Context Object Test", "An Object that lives within Behavior Context exclusively for testing") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "Tests/Behavior Context") ->Attribute(AZ::Edit::Attributes::CategoryStyle, ".method") ->Attribute(ScriptCanvas::Attributes::Node::TitlePaletteOverride, "TestingNodeTitlePalette") ->DataElement(AZ::Edit::UIHandlers::Default, &BehaviorContextObjectTest::m_string, "String", "") ; } } if (AZ::BehaviorContext* behaviorContext = azrtti_cast(context)) { behaviorContext->Class() ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) ->Attribute(AZ::Script::Attributes::Category, "Tests/Behavior Context") ->Method("SetString", &BehaviorContextObjectTest::SetString) ->Method("GetString", &BehaviorContextObjectTest::GetString) ->Property("Name", BehaviorValueProperty(&BehaviorContextObjectTest::m_name)) ->Constant("Always24", BehaviorConstant(24)) ; } } } namespace ScriptCanvasTesting { void ScriptCanvasTestingSystemComponent::Reflect(AZ::ReflectContext* context) { if (AZ::SerializeContext* serialize = azrtti_cast(context)) { serialize->Class() ->Version(0) ; if (AZ::EditContext* ec = serialize->GetEditContext()) { ec->Class("ScriptCanvasTesting", "") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::AutoExpand, true) ; } } ScriptCanvasTestingNodes::BehaviorContextObjectTest::Reflect(context); ScriptCanvasTesting::Reflect(context); } void ScriptCanvasTestingSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) { provided.push_back(AZ_CRC("ScriptCanvasTestingService", 0xd2b424fc)); } void ScriptCanvasTestingSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) { incompatible.push_back(AZ_CRC("ScriptCanvasTestingService", 0xd2b424fc)); } void ScriptCanvasTestingSystemComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required) { (void)required; } void ScriptCanvasTestingSystemComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent) { (void)dependent; } void ScriptCanvasTestingSystemComponent::Init() { } void ScriptCanvasTestingSystemComponent::Activate() { ScriptCanvasEditor::UnitTestVerificationBus::Handler::BusConnect(); } void ScriptCanvasTestingSystemComponent::Deactivate() { ScriptCanvasEditor::UnitTestVerificationBus::Handler::BusDisconnect(); } ScriptCanvasEditor::UnitTestResult ScriptCanvasTestingSystemComponent::Verify(ScriptCanvasEditor::Reporter reporter) { return ScriptCanvasTests::VerifyReporterEditor(reporter); } }