The Great ScriptCanvas Purge, Part IV

Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
chcurran
2021-07-06 13:13:16 -07:00
parent fa7accf2dc
commit 360236b89e
173 changed files with 131 additions and 6154 deletions
@@ -19,145 +19,6 @@ using namespace ScriptCanvasTests;
using namespace ScriptCanvasEditor;
using namespace TestNodes;
// Tests the basic footprint of the ebus node both before and after graph activation to make sure all internal bookeeping is correct.
TEST_F(ScriptCanvasTestFixture, BehaviorContext_BusHandlerNodeFootPrint)
{
using namespace ScriptCanvas;
TemplateEventTestHandler<AZ::Uuid>::Reflect(m_serializeContext);
TemplateEventTestHandler<AZ::Uuid>::Reflect(m_behaviorContext);
auto graphEntity = aznew AZ::Entity;
SystemRequestBus::Broadcast(&SystemRequests::CreateGraphOnEntity, graphEntity);
ScriptCanvas::Graph* graph = AZ::EntityUtils::FindFirstDerivedComponent<ScriptCanvas::Graph>(graphEntity);
graphEntity->Init();
const ScriptCanvasId& graphUniqueId = graph->GetScriptCanvasId();
AZ::EntityId uuidEventHandlerId;
auto uuidEventHandler = CreateTestNode<ScriptCanvas::Nodes::Core::EBusEventHandler>(graphUniqueId, uuidEventHandlerId);
uuidEventHandler->InitializeBus("TemplateEventTestHandler<AZ::Uuid >");
AZ::Uuid uuidBusId = AZ::Uuid::CreateName("TemplateEventBus");
uuidEventHandler->SetInput_UNIT_TEST(ScriptCanvas::Nodes::Core::EBusEventHandler::c_busIdName, uuidBusId); //Set Uuid bus id
{
auto eventEntry = uuidEventHandler->FindEvent("VectorCreatedEvent");
EXPECT_NE(nullptr, eventEntry);
EXPECT_EQ(eventEntry->m_parameterSlotIds.size(), 1);
EXPECT_TRUE(eventEntry->m_resultSlotId.IsValid());
{
const Slot* outputSlot = uuidEventHandler->GetSlot(eventEntry->m_eventSlotId);
EXPECT_EQ(outputSlot->GetDescriptor(), SlotDescriptors::ExecutionOut());
}
{
const Slot* dataSlot = uuidEventHandler->GetSlot(eventEntry->m_parameterSlotIds[0]);
EXPECT_EQ(dataSlot->GetDescriptor(), SlotDescriptors::DataOut());
EXPECT_EQ(dataSlot->GetDataType(), Data::Type::Vector3());
const Datum* datum = uuidEventHandler->FindDatum(eventEntry->m_parameterSlotIds[0]);
EXPECT_EQ(nullptr, datum);
ModifiableDatumView datumView;
uuidEventHandler->FindModifiableDatumView(eventEntry->m_parameterSlotIds[0], datumView);
EXPECT_FALSE(datumView.IsValid());
}
{
const Slot* resultSlot = uuidEventHandler->GetSlot(eventEntry->m_resultSlotId);
EXPECT_EQ(resultSlot->GetDescriptor(), SlotDescriptors::DataIn());
EXPECT_EQ(resultSlot->GetDataType(), Data::Type::Vector3());
const Datum* datum = uuidEventHandler->FindDatum(eventEntry->m_resultSlotId);
EXPECT_NE(nullptr, datum);
if (datum)
{
EXPECT_TRUE(datum->IS_A<Data::Vector3Type>());
}
ModifiableDatumView datumView;
uuidEventHandler->FindModifiableDatumView(eventEntry->m_resultSlotId, datumView);
EXPECT_TRUE(datumView.IsValid());
if (datumView.IsValid())
{
const Datum* datum2 = datumView.GetDatum();
EXPECT_TRUE(datum2->IS_A<Data::Vector3Type>());
}
}
}
graphEntity->Activate();
{
auto eventEntry = uuidEventHandler->FindEvent("VectorCreatedEvent");
EXPECT_NE(nullptr, eventEntry);
EXPECT_EQ(eventEntry->m_parameterSlotIds.size(), 1);
EXPECT_TRUE(eventEntry->m_resultSlotId.IsValid());
{
const Slot* outputSlot = uuidEventHandler->GetSlot(eventEntry->m_eventSlotId);
EXPECT_EQ(outputSlot->GetDescriptor(), SlotDescriptors::ExecutionOut());
}
{
const Slot* dataSlot = uuidEventHandler->GetSlot(eventEntry->m_parameterSlotIds[0]);
EXPECT_EQ(dataSlot->GetDescriptor(), SlotDescriptors::DataOut());
EXPECT_EQ(dataSlot->GetDataType(), Data::Type::Vector3());
const Datum* datum = uuidEventHandler->FindDatum(eventEntry->m_parameterSlotIds[0]);
EXPECT_EQ(nullptr, datum);
ModifiableDatumView datumView;
uuidEventHandler->FindModifiableDatumView(eventEntry->m_parameterSlotIds[0], datumView);
EXPECT_FALSE(datumView.IsValid());
}
{
const Slot* resultSlot = uuidEventHandler->GetSlot(eventEntry->m_resultSlotId);
EXPECT_EQ(resultSlot->GetDescriptor(), SlotDescriptors::DataIn());
EXPECT_EQ(resultSlot->GetDataType(), Data::Type::Vector3());
const Datum* datum = uuidEventHandler->FindDatum(eventEntry->m_resultSlotId);
EXPECT_NE(nullptr, datum);
if (datum)
{
EXPECT_TRUE(datum->IS_A<Data::Vector3Type>());
}
ModifiableDatumView datumView;
uuidEventHandler->FindModifiableDatumView(eventEntry->m_resultSlotId, datumView);
EXPECT_TRUE(datumView.IsValid());
if (datumView.IsValid())
{
const Datum* datum2 = datumView.GetDatum();
EXPECT_TRUE(datum2->IS_A<Data::Vector3Type>());
}
}
}
delete graphEntity;
m_serializeContext->EnableRemoveReflection();
m_behaviorContext->EnableRemoveReflection();
TemplateEventTestHandler<AZ::Uuid>::Reflect(m_serializeContext);
TemplateEventTestHandler<AZ::Uuid>::Reflect(m_behaviorContext);
m_serializeContext->DisableRemoveReflection();
m_behaviorContext->DisableRemoveReflection();
}
void ReflectSignCorrectly()
{
AZ::BehaviorContext* behaviorContext(nullptr);
@@ -470,213 +470,11 @@ TEST_F(ScriptCanvasTestFixture, Contracts)
graph->GetEntity()->Deactivate();
delete graph->GetEntity();
}
//
// TEST_F(ScriptCanvasTestFixture, BinaryOperationTest)
// {
//
// using namespace ScriptCanvas::Nodes;
// using namespace ScriptCanvas::Nodes::Comparison;
//
// TestBehaviorContextObject::Reflect(m_serializeContext);
// TestBehaviorContextObject::Reflect(m_behaviorContext);
//
// BinaryOpTest<EqualTo>(1, 1, true);
// BinaryOpTest<EqualTo>(1, 0, false);
// BinaryOpTest<EqualTo>(0, 1, false);
// BinaryOpTest<EqualTo>(0, 0, true);
//
// BinaryOpTest<NotEqualTo>(1, 1, false);
// BinaryOpTest<NotEqualTo>(1, 0, true);
// BinaryOpTest<NotEqualTo>(0, 1, true);
// BinaryOpTest<NotEqualTo>(0, 0, false);
//
// BinaryOpTest<Greater>(1, 1, false);
// BinaryOpTest<Greater>(1, 0, true);
// BinaryOpTest<Greater>(0, 1, false);
// BinaryOpTest<Greater>(0, 0, false);
//
// BinaryOpTest<GreaterEqual>(1, 1, true);
// BinaryOpTest<GreaterEqual>(1, 0, true);
// BinaryOpTest<GreaterEqual>(0, 1, false);
// BinaryOpTest<GreaterEqual>(0, 0, true);
//
// BinaryOpTest<Less>(1, 1, false);
// BinaryOpTest<Less>(1, 0, false);
// BinaryOpTest<Less>(0, 1, true);
// BinaryOpTest<Less>(0, 0, false);
//
// BinaryOpTest<LessEqual>(1, 1, true);
// BinaryOpTest<LessEqual>(1, 0, false);
// BinaryOpTest<LessEqual>(0, 1, true);
// BinaryOpTest<LessEqual>(0, 0, true);
//
// BinaryOpTest<EqualTo>(true, true, true);
// BinaryOpTest<EqualTo>(true, false, false);
// BinaryOpTest<EqualTo>(false, true, false);
// BinaryOpTest<EqualTo>(false, false, true);
//
// BinaryOpTest<NotEqualTo>(true, true, false);
// BinaryOpTest<NotEqualTo>(true, false, true);
// BinaryOpTest<NotEqualTo>(false, true, true);
// BinaryOpTest<NotEqualTo>(false, false, false);
//
// AZStd::string string0("a string");
// AZStd::string string1("b string");
//
// BinaryOpTest<EqualTo>(string1, string1, true);
// BinaryOpTest<EqualTo>(string1, string0, false);
// BinaryOpTest<EqualTo>(string0, string1, false);
// BinaryOpTest<EqualTo>(string0, string0, true);
//
// BinaryOpTest<NotEqualTo>(string1, string1, false);
// BinaryOpTest<NotEqualTo>(string1, string0, true);
// BinaryOpTest<NotEqualTo>(string0, string1, true);
// BinaryOpTest<NotEqualTo>(string0, string0, false);
//
// BinaryOpTest<Greater>(string1, string1, false);
// BinaryOpTest<Greater>(string1, string0, true);
// BinaryOpTest<Greater>(string0, string1, false);
// BinaryOpTest<Greater>(string0, string0, false);
//
// BinaryOpTest<GreaterEqual>(string1, string1, true);
// BinaryOpTest<GreaterEqual>(string1, string0, true);
// BinaryOpTest<GreaterEqual>(string0, string1, false);
// BinaryOpTest<GreaterEqual>(string0, string0, true);
//
// BinaryOpTest<Less>(string1, string1, false);
// BinaryOpTest<Less>(string1, string0, false);
// BinaryOpTest<Less>(string0, string1, true);
// BinaryOpTest<Less>(string0, string0, false);
//
// BinaryOpTest<LessEqual>(string1, string1, true);
// BinaryOpTest<LessEqual>(string1, string0, false);
// BinaryOpTest<LessEqual>(string0, string1, true);
// BinaryOpTest<LessEqual>(string0, string0, true);
//
// const AZ::Vector3 vectorOne(1.0f, 1.0f, 1.0f);
// const AZ::Vector3 vectorZero(0.0f, 0.0f, 0.0f);
//
// BinaryOpTest<EqualTo>(vectorOne, vectorOne, true);
// BinaryOpTest<EqualTo>(vectorOne, vectorZero, false);
// BinaryOpTest<EqualTo>(vectorZero, vectorOne, false);
// BinaryOpTest<EqualTo>(vectorZero, vectorZero, true);
//
// BinaryOpTest<NotEqualTo>(vectorOne, vectorOne, false);
// BinaryOpTest<NotEqualTo>(vectorOne, vectorZero, true);
// BinaryOpTest<NotEqualTo>(vectorZero, vectorOne, true);
// BinaryOpTest<NotEqualTo>(vectorZero, vectorZero, false);
//
// const TestBehaviorContextObject zero(0);
// const TestBehaviorContextObject one(1);
// const TestBehaviorContextObject otherOne(1);
//
// BinaryOpTest<EqualTo>(one, one, true);
// BinaryOpTest<EqualTo>(one, zero, false);
// BinaryOpTest<EqualTo>(zero, one, false);
// BinaryOpTest<EqualTo>(zero, zero, true);
//
// BinaryOpTest<NotEqualTo>(one, one, false);
// BinaryOpTest<NotEqualTo>(one, zero, true);
// BinaryOpTest<NotEqualTo>(zero, one, true);
// BinaryOpTest<NotEqualTo>(zero, zero, false);
//
// BinaryOpTest<Greater>(one, one, false);
// BinaryOpTest<Greater>(one, zero, true);
// BinaryOpTest<Greater>(zero, one, false);
// BinaryOpTest<Greater>(zero, zero, false);
//
// BinaryOpTest<GreaterEqual>(one, one, true);
// BinaryOpTest<GreaterEqual>(one, zero, true);
// BinaryOpTest<GreaterEqual>(zero, one, false);
// BinaryOpTest<GreaterEqual>(zero, zero, true);
//
// BinaryOpTest<Less>(one, one, false);
// BinaryOpTest<Less>(one, zero, false);
// BinaryOpTest<Less>(zero, one, true);
// BinaryOpTest<Less>(zero, zero, false);
//
// BinaryOpTest<LessEqual>(one, one, true);
// BinaryOpTest<LessEqual>(one, zero, false);
// BinaryOpTest<LessEqual>(zero, one, true);
// BinaryOpTest<LessEqual>(zero, zero, true);
//
// BinaryOpTest<EqualTo>(one, otherOne, true);
// BinaryOpTest<EqualTo>(otherOne, one, true);
//
// BinaryOpTest<NotEqualTo>(one, otherOne, false);
// BinaryOpTest<NotEqualTo>(otherOne, one, false);
//
// BinaryOpTest<Greater>(one, otherOne, false);
// BinaryOpTest<Greater>(otherOne, one, false);
//
// BinaryOpTest<GreaterEqual>(one, otherOne, true);
// BinaryOpTest<GreaterEqual>(otherOne, one, true);
//
// BinaryOpTest<Less>(one, otherOne, false);
// BinaryOpTest<Less>(otherOne, one, false);
//
// BinaryOpTest<LessEqual>(one, otherOne, true);
// BinaryOpTest<LessEqual>(otherOne, one, true);
//
// // force failures, to verify crash proofiness
// BinaryOpTest<EqualTo>(one, zero, false, true);
// BinaryOpTest<NotEqualTo>(one, zero, true, true);
// BinaryOpTest<Greater>(one, zero, true, true);
// BinaryOpTest<GreaterEqual>(one, zero, true, true);
// BinaryOpTest<Less>(one, zero, false, true);
// BinaryOpTest<LessEqual>(one, zero, false, true);
//
// m_serializeContext->EnableRemoveReflection();
// m_behaviorContext->EnableRemoveReflection();
// TestBehaviorContextObject::Reflect(m_serializeContext);
// TestBehaviorContextObject::Reflect(m_behaviorContext);
// m_serializeContext->DisableRemoveReflection();
// m_behaviorContext->DisableRemoveReflection();
// }
const int k_executionCount = 998;
TEST_F(ScriptCanvasTestFixture, ExecutionLength)
{
using namespace ScriptCanvas;
ScriptCanvas::Graph* graph(nullptr);
SystemRequestBus::BroadcastResult(graph, &SystemRequests::MakeGraph);
EXPECT_TRUE(graph != nullptr);
graph->GetEntity()->Init();
const ScriptCanvasId& graphUniqueId = graph->GetScriptCanvasId();
AZ::EntityId startID;
CreateTestNode<ScriptCanvas::Nodes::Core::Start>(graphUniqueId, startID);
AZ::EntityId previousID = startID;
for (int i = 0; i < k_executionCount; ++i)
{
AZ::EntityId printNodeID;
TestResult* printNode = CreateTestNode<TestResult>(graphUniqueId, printNodeID);
printNode->SetInput_UNIT_TEST<int>("Value", i);
EXPECT_TRUE(Connect(*graph, previousID, "Out", printNodeID, "In"));
previousID = printNodeID;
}
AZ::Entity* graphEntity = graph->GetEntity();
{
ScriptCanvasEditor::ScopedOutputSuppression suppressOutput;
graphEntity->Activate();
}
ReportErrors(graph);
graphEntity->Deactivate();
delete graphEntity;
}
TEST_F(ScriptCanvasTestFixture, While)
{
RunUnitTestGraph("LY_SC_UnitTest_While", ScriptCanvas::ExecutionMode::Interpreted);
}
@@ -931,181 +931,3 @@ TEST_F(ScriptCanvasTestFixture, InterpretedExecutionOutPerformance)
{
RunUnitTestGraph("LY_SC_UnitTest_ExecutionOutPerformance", ExecutionMode::Interpreted);
}
#if defined(FUNCTION_LEGACY_SUPPORT_ENABLED)
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraph_UserNodeable)
{
ExpectParse("LY_SC_UnitTest_Subgraph_UserNodeableD");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraph_UserNodeableLatent)
{
ExpectParse("LY_SC_UnitTest_Subgraph_UserNodeableLatent");
}
TEST_F(ScriptCanvasTestFixture, InterpretedUseFunctionWithOnGraphStart)
{
RunUnitTestGraph("LY_SC_UnitTest_UseFunctionWithOnGraphStart");
}
TEST_F(ScriptCanvasTestFixture, InterpretedUseSubgraphWithStartAndEBus)
{
RunUnitTestGraph("LY_SC_UnitTests_UseSubgraphWithStartAndEBus");
}
TEST_F(ScriptCanvasTestFixture, InterpretedDeviousStateFunctionFixGraph)
{
RunUnitTestGraph("LY_SC_UnitTest_DeviousStateFunctionFixGraph");
}
TEST_F(ScriptCanvasTestFixture, InterpretedCallFunctionLocalValues)
{
RunUnitTestGraph("LY_SC_UnitTest_CallFunctionLocalValues");
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionLocalObjects)
{
ExpectParse("LY_SC_UnitTest_FunctionLocalObjects");
}
TEST_F(ScriptCanvasTestFixture, InterpretedFunctionLocalObjectsCall)
{
RunUnitTestGraph("LY_SC_UnitTest_FunctionLocalObjectsCall", ExecutionMode::Interpreted, DurationSpec::Ticks(31));
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionWithOnGraphStart)
{
ExpectParse("LY_SC_UnitTest_FunctionWithOnGraphStart");
}
TEST_F(ScriptCanvasTestFixture, NodeableDurationSubgraphDirectionExposedOutWithOutput)
{
RunUnitTestGraph("LY_SC_UnitTest_NodeableDurationSubgraphDirectionExposedOutWithOutput", ExecutionMode::Interpreted, DurationSpec::Ticks(3));
}
TEST_F(ScriptCanvasTestFixture, ParseOrderedSequencerFunction)
{
ExpectParse("LY_SC_UnitTest_OrderedSequencerFunction");
}
TEST_F(ScriptCanvasTestFixture, ParseFunction_Names_With_Spaces)
{
ExpectParse("LY_SC_UnitTest_Function Names With Spaces");
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionNameEvilVersion)
{
ExpectParse("LY_SC_UnitTest_Function Names(With) Random+Strings Evil~Version");
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionNameEvilVersionInFolder)
{
ExpectParse("TestFunction/LY_SC_UnitTest_Function Names(With) Random+Strings Evil~Version-In^Forder");
}
TEST_F(ScriptCanvasTestFixture, ParseNodeableDurationFunction)
{
ExpectParse("LY_SC_UnitTest_NodeableDurationFunction");
}
TEST_F(ScriptCanvasTestFixture, ParseNodeableDurationFunctionDirectExposure)
{
ExpectParse("LY_SC_UnitTest_NodeableDurationFunctionDirectExposure");
}
TEST_F(ScriptCanvasTestFixture, ParseNodeableDurationFunctionDirectExposureWithOutput)
{
ExpectParse("LY_SC_UnitTest_NodeableDurationFunctionDirectExposureWithOutput");
}
TEST_F(ScriptCanvasTestFixture, ParseFunctionBranchSingleNamedOutJustReturns)
{
ExpectParse("LY_SC_UnitTest_ParseFunctionBranchSingleNamedOutJustReturns");
}
TEST_F(ScriptCanvasTestFixture, ParseExposeAnyOut)
{
ExpectParse("LY_SC_UnitTest_ExposeAnyOut");
}
TEST_F(ScriptCanvasTestFixture, ParseMultipleInputNoParseError)
{
ExpectParse("LY_SC_UnitTest_MultipleInputNoParseError");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphMultipleInError)
{
ExpectParseError("LY_SC_UnitTest_InterpretedSubgraphMultipleInError");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphMultipleOutError)
{
ExpectParseError("LY_SC_UnitTest_InterpretedSubgraphMultipleOutError");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphOutInLoop)
{
ExpectParseError("LY_SC_UnitTest_InterpretedSubgraphOutInLoop");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphOutMidCycleMissingSlots)
{
ExpectParseError("LY_SC_UnitTest_InterpretedSubgraphOutMidCycleMissingSlots");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphComplexityError)
{
ExpectParseError("LY_SC_UnitTest_SubgraphComplexityError");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphReturnValueFromIn)
{
ExpectParseError("LY_SC_UnitTest_SubgraphReturnValueFromIn");
}
TEST_F(ScriptCanvasTestFixture, InterpretedSubgraphReturnValueFromInOut)
{
ExpectParseError("LY_SC_UnitTest_SubgraphReturnValueFromInOut");
}
TEST_F(ScriptCanvasTestFixture, InterpretedVerifyByValueCorrectness)
{
RunUnitTestGraph("LY_SC_UnitTest_VerifyByValueCorrectness", ExecutionMode::Interpreted);
}
TEST_F(ScriptCanvasTestFixture, InterpretedFunctionNoInputOneOutputCall)
{
RunUnitTestGraph("LY_SC_UnitTest_FunctionNoInputOneOutputCall", ExecutionMode::Interpreted);
}
TEST_F(ScriptCanvasTestFixture, InterpretedFunctionAddVector3Call)
{
RunUnitTestGraph("LY_SC_UnitTest_FunctionAddVector3Call", ExecutionMode::Interpreted);
}
TEST_F(ScriptCanvasTestFixture, InterpretedParseFunction)
{
ExpectParse("LY_SC_UnitTest_ParseFunction");
}
TEST_F(ScriptCanvasTestFixture, InterpretedParseFunctionBranch)
{
ExpectParse("LY_SC_UnitTest_ParseFunctionBranch");
}
TEST_F(ScriptCanvasTestFixture, InterpretedParseFunctionBranchDefaultOut)
{
ExpectParse("LY_SC_UnitTest_ParseFunctionBranchDefaultOut");
}
TEST_F(ScriptCanvasTestFixture, InterpretedParseFunctionDefaultOut)
{
ExpectParse("LY_SC_UnitTest_ParseFunctionDefaultOut");
}
TEST_F(ScriptCanvasTestFixture, InterpretedParseFunctionOut)
{
ExpectParse("LY_SC_UnitTest_ParseFunctionOut");
}
#endif