ScriptCanvas_MethodOverload.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/PlatformDef.h>
  9. #include <AzCore/RTTI/RTTI.h>
  10. #include <Source/Framework/ScriptCanvasTestFixture.h>
  11. #include <Source/Framework/ScriptCanvasTestUtilities.h>
  12. #include <Source/Framework/ScriptCanvasTestNodes.h>
  13. #include <ScriptCanvas/Core/NodeableNodeOverloaded.h>
  14. #include <ScriptCanvas/Core/Nodeable.h>
  15. #include <ScriptCanvas/Core/SlotConfigurationDefaults.h>
  16. using namespace ScriptCanvasTests;
  17. template<typename Type>
  18. class SingleTypeNodeable
  19. : public ScriptCanvas::Nodeable
  20. {
  21. private:
  22. using ClassName = SingleTypeNodeable<Type>;
  23. public:
  24. AZ_RTTI((SingleTypeNodeable, "{62F173B5-596B-4872-B88B-E03DFCD5D059}", Type), ScriptCanvas::Nodeable);
  25. AZ_CLASS_ALLOCATOR(SingleTypeNodeable<Type>, AZ::SystemAllocator);
  26. static void Reflect(AZ::ReflectContext* reflectContext)
  27. {
  28. if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflectContext))
  29. {
  30. serializeContext->Class<SingleTypeNodeable, Nodeable>()
  31. ;
  32. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  33. {
  34. editContext->Class<SingleTypeNodeable>("Single Type Nodeable", "")
  35. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  36. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  37. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  38. ;
  39. }
  40. }
  41. if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(reflectContext))
  42. {
  43. behaviorContext->Class<ClassName>()
  44. ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::List)
  45. ->Method("MethodOne", &ClassName::MethodOne)
  46. ->Method("MethodTwo", &ClassName::MethodTwo)
  47. ;
  48. }
  49. }
  50. void MethodOne(Type paramOne)
  51. {
  52. AZ_UNUSED(paramOne);
  53. }
  54. void MethodTwo(Type paramOne, Type paramTwo)
  55. {
  56. AZ_UNUSED(paramOne);
  57. AZ_UNUSED(paramTwo);
  58. }
  59. };
  60. class SingleTypeNodeableNode
  61. : public ScriptCanvas::Nodes::NodeableNodeOverloaded
  62. {
  63. public:
  64. AZ_COMPONENT(SingleTypeNodeableNode, "{CDB445D4-A129-4E40-90E7-332DF825CC5E}", ScriptCanvas::Nodes::NodeableNodeOverloaded);
  65. static void Reflect(AZ::ReflectContext* reflectContext)
  66. {
  67. SingleTypeNodeable<ScriptCanvas::Data::NumberType>::Reflect(reflectContext);
  68. SingleTypeNodeable<ScriptCanvas::Data::Vector2Type>::Reflect(reflectContext);
  69. SingleTypeNodeable<ScriptCanvas::Data::Vector3Type>::Reflect(reflectContext);
  70. SingleTypeNodeable<ScriptCanvas::Data::Vector4Type>::Reflect(reflectContext);
  71. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(reflectContext))
  72. {
  73. serializeContext->Class<SingleTypeNodeableNode, ScriptCanvas::Nodes::NodeableNodeOverloaded>()
  74. ;
  75. if (AZ::EditContext* editContext = serializeContext->GetEditContext())
  76. {
  77. editContext->Class<SingleTypeNodeableNode>("Lerp Between", "")
  78. ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
  79. ->Attribute(AZ::Edit::Attributes::Category, "Math")
  80. ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
  81. ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
  82. ;
  83. }
  84. }
  85. }
  86. void ConfigureSlots() override
  87. {
  88. ScriptCanvas::SlotExecution::Ins ins;
  89. {
  90. {
  91. ScriptCanvas::SlotExecution::In methodOne;
  92. ScriptCanvas::ExecutionSlotConfiguration inSlotConfiguration;
  93. inSlotConfiguration.m_name = "MethodOne";
  94. inSlotConfiguration.m_displayGroup = "In";
  95. inSlotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Input);
  96. inSlotConfiguration.m_isLatent = false;
  97. ScriptCanvas::SlotId inSlotId = AddSlot(inSlotConfiguration);
  98. AZ_Assert(inSlotId.IsValid(), "In slot is not created successfully.");
  99. methodOne.slotId = inSlotId;
  100. {
  101. ScriptCanvas::DynamicDataSlotConfiguration dataSlotConfiguration;
  102. dataSlotConfiguration.m_name = "Param";
  103. dataSlotConfiguration.m_displayGroup = "In";
  104. dataSlotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Input);
  105. dataSlotConfiguration.m_dynamicDataType = ScriptCanvas::DynamicDataType::Value;
  106. // Since this contract will check in with the underlying overload to enforce
  107. // the typing, we don't need to have one of these contracts on each slot, as each
  108. // group assignment will trigger this contract to confirm the typing.
  109. dataSlotConfiguration.m_contractDescs = AZStd::vector<ScriptCanvas::ContractDescriptor>
  110. {
  111. { []() { return aznew ScriptCanvas::OverloadContract(); } }
  112. };
  113. ScriptCanvas::SlotId slotId = AddSlot(dataSlotConfiguration);
  114. AZ_Assert(slotId.IsValid(), "Data slot is not created successfully.");
  115. methodOne.inputs.push_back(slotId);
  116. }
  117. ins.push_back(methodOne);
  118. }
  119. {
  120. ScriptCanvas::SlotExecution::In methodTwo;
  121. ScriptCanvas::ExecutionSlotConfiguration inSlotConfiguration;
  122. inSlotConfiguration.m_name = "Cancel";
  123. inSlotConfiguration.m_displayGroup = "Cancel";
  124. inSlotConfiguration.m_toolTip = "Stops the lerp action immediately.";
  125. inSlotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Input);
  126. inSlotConfiguration.m_isLatent = false;
  127. ScriptCanvas::SlotId inSlotId = AddSlot(inSlotConfiguration);
  128. AZ_Assert(inSlotId.IsValid(), "Cancel slot is not created successfully.");
  129. methodTwo.slotId = inSlotId;
  130. {
  131. ScriptCanvas::DynamicDataSlotConfiguration dataSlotConfiguration;
  132. dataSlotConfiguration.m_name = "ParamOne";
  133. dataSlotConfiguration.m_displayGroup = "In";
  134. dataSlotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Input);
  135. dataSlotConfiguration.m_dynamicDataType = ScriptCanvas::DynamicDataType::Value;
  136. // Since this contract will check in with the underlying overload to enforce
  137. // the typing, we don't need to have one of these contracts on each slot, as each
  138. // group assignment will trigger this contract to confirm the typing.
  139. dataSlotConfiguration.m_contractDescs = AZStd::vector<ScriptCanvas::ContractDescriptor>
  140. {
  141. { []() { return aznew ScriptCanvas::OverloadContract(); } }
  142. };
  143. ScriptCanvas::SlotId slotId = AddSlot(dataSlotConfiguration);
  144. AZ_Assert(slotId.IsValid(), "Data slot is not created successfully.");
  145. methodTwo.inputs.push_back(slotId);
  146. }
  147. {
  148. ScriptCanvas::DynamicDataSlotConfiguration dataSlotConfiguration;
  149. dataSlotConfiguration.m_name = "ParamTwo";
  150. dataSlotConfiguration.m_displayGroup = "In";
  151. dataSlotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Input);
  152. dataSlotConfiguration.m_dynamicDataType = ScriptCanvas::DynamicDataType::Value;
  153. // Since this contract will check in with the underlying overload to enforce
  154. // the typing, we don't need to have one of these contracts on each slot, as each
  155. // group assignment will trigger this contract to confirm the typing.
  156. dataSlotConfiguration.m_contractDescs = AZStd::vector<ScriptCanvas::ContractDescriptor>
  157. {
  158. { []() { return aznew ScriptCanvas::OverloadContract(); } }
  159. };
  160. ScriptCanvas::SlotId slotId = AddSlot(dataSlotConfiguration);
  161. AZ_Assert(slotId.IsValid(), "Data slot is not created successfully.");
  162. methodTwo.inputs.push_back(slotId);
  163. }
  164. ins.push_back(methodTwo);
  165. }
  166. }
  167. SetSlotExecutionMap(AZStd::move(ScriptCanvas::SlotExecution::Map(AZStd::move(ins), {})));
  168. }
  169. AZStd::vector<AZStd::unique_ptr<ScriptCanvas::Nodeable>> GetInitializationNodeables() const override
  170. {
  171. AZStd::vector<AZStd::unique_ptr<ScriptCanvas::Nodeable>> nodeables;
  172. nodeables.push_back(AZStd::make_unique<SingleTypeNodeable<ScriptCanvas::Data::NumberType>>());
  173. nodeables.push_back(AZStd::make_unique<SingleTypeNodeable<ScriptCanvas::Data::Vector2Type>>());
  174. nodeables.push_back(AZStd::make_unique<SingleTypeNodeable<ScriptCanvas::Data::Vector3Type>>());
  175. nodeables.push_back(AZStd::make_unique<SingleTypeNodeable<ScriptCanvas::Data::Vector4Type>>());
  176. return nodeables;
  177. }
  178. };
  179. TEST_F(ScriptCanvasTestFixture, Overload_NodeableNode_TypeCheck)
  180. {
  181. RegisterComponentDescriptor<SingleTypeNodeableNode>();
  182. ScriptCanvas::Graph* graph = CreateGraph();
  183. const ScriptCanvas::ScriptCanvasId& scriptCanvasId = graph->GetScriptCanvasId();
  184. AZ::EntityId nodeableNodeId;
  185. SingleTypeNodeableNode* nodeableNode = CreateTestNode<SingleTypeNodeableNode>(scriptCanvasId, nodeableNodeId);
  186. nodeableNode->PostActivate();
  187. ScriptCanvas::SlotId paramId = nodeableNode->GetSlotByName("Param")->GetId();
  188. ScriptCanvas::SlotId paramOneId = nodeableNode->GetSlotByName("ParamOne")->GetId();
  189. ScriptCanvas::SlotId paramTwoId = nodeableNode->GetSlotByName("ParamTwo")->GetId();
  190. AZStd::vector< ScriptCanvas::SlotId > slotIds = {
  191. paramId,
  192. paramOneId,
  193. paramTwoId
  194. };
  195. AZStd::vector< ScriptCanvas::Data::Type > acceptedTypes = {
  196. ScriptCanvas::Data::Type::Number(),
  197. ScriptCanvas::Data::Type::Vector2(),
  198. ScriptCanvas::Data::Type::Vector3(),
  199. ScriptCanvas::Data::Type::Vector4()
  200. };
  201. AZStd::vector< ScriptCanvas::Data::Type > invalidTypes = {
  202. ScriptCanvas::Data::Type::EntityID(),
  203. ScriptCanvas::Data::Type::Color(),
  204. ScriptCanvas::Data::Type::Transform()
  205. };
  206. for (ScriptCanvas::Data::Type acceptedType : acceptedTypes)
  207. {
  208. for (ScriptCanvas::SlotId slotId : slotIds)
  209. {
  210. AZ::Outcome<void, AZStd::string> validTypeSlot = nodeableNode->IsValidTypeForSlot(slotId, acceptedType);
  211. EXPECT_TRUE(validTypeSlot.IsSuccess());
  212. }
  213. }
  214. for (ScriptCanvas::Data::Type invalidType : invalidTypes)
  215. {
  216. for (ScriptCanvas::SlotId slotId : slotIds)
  217. {
  218. AZ::Outcome<void, AZStd::string> invalidTypeSlot = nodeableNode->IsValidTypeForSlot(slotId, invalidType);
  219. EXPECT_FALSE(invalidTypeSlot.IsSuccess());
  220. }
  221. }
  222. }
  223. TEST_F(ScriptCanvasTestFixture, Overload_NodeableNode_ConnectionCheck)
  224. {
  225. RegisterComponentDescriptor<SingleTypeNodeableNode>();
  226. ScriptCanvas::Graph* graph = CreateGraph();
  227. const ScriptCanvas::ScriptCanvasId& scriptCanvasId = graph->GetScriptCanvasId();
  228. AZ::EntityId nodeableNodeId;
  229. SingleTypeNodeableNode* nodeableNode = CreateTestNode<SingleTypeNodeableNode>(scriptCanvasId, nodeableNodeId);
  230. nodeableNode->PostActivate();
  231. TestNodes::ConfigurableUnitTestNode* unitTestNode = CreateConfigurableNode("ConfigurableNode");
  232. ScriptCanvas::SlotId paramId = nodeableNode->GetSlotByName("Param")->GetId();
  233. ScriptCanvas::SlotId paramOneId = nodeableNode->GetSlotByName("ParamOne")->GetId();
  234. ScriptCanvas::SlotId paramTwoId = nodeableNode->GetSlotByName("ParamTwo")->GetId();
  235. AZStd::vector< ScriptCanvas::SlotId > slotIds = {
  236. paramId,
  237. paramOneId,
  238. paramTwoId
  239. };
  240. AZStd::vector< ScriptCanvas::Data::Type > acceptedTypes = {
  241. ScriptCanvas::Data::Type::Number(),
  242. ScriptCanvas::Data::Type::Vector2(),
  243. ScriptCanvas::Data::Type::Vector3(),
  244. ScriptCanvas::Data::Type::Vector4()
  245. };
  246. AZStd::vector< ScriptCanvas::Data::Type > invalidTypes = {
  247. ScriptCanvas::Data::Type::EntityID(),
  248. ScriptCanvas::Data::Type::Color(),
  249. ScriptCanvas::Data::Type::Transform()
  250. };
  251. for (ScriptCanvas::Data::Type acceptedType : acceptedTypes)
  252. {
  253. ScriptCanvas::Slot* validSlot = nullptr;
  254. {
  255. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  256. slotConfiguration.m_name = GenerateSlotName();
  257. slotConfiguration.SetType(acceptedType);
  258. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  259. validSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  260. }
  261. ScriptCanvas::Endpoint validStartEndpoint = validSlot->GetEndpoint();
  262. for (ScriptCanvas::SlotId slotId : slotIds)
  263. {
  264. ScriptCanvas::Endpoint paramEndpoint = { nodeableNode->GetEntityId(), slotId };
  265. const bool isValid = true;
  266. TestIsConnectionPossible(validStartEndpoint, paramEndpoint, isValid);
  267. }
  268. }
  269. for (ScriptCanvas::Data::Type invalidType : invalidTypes)
  270. {
  271. ScriptCanvas::Slot* invalidSlot = nullptr;
  272. {
  273. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  274. slotConfiguration.m_name = GenerateSlotName();
  275. slotConfiguration.SetType(invalidType);
  276. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  277. invalidSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  278. }
  279. ScriptCanvas::Endpoint invalidStartEndpoint = invalidSlot->GetEndpoint();
  280. for (ScriptCanvas::SlotId slotId : slotIds)
  281. {
  282. ScriptCanvas::Endpoint paramEndpoint = { nodeableNode->GetEntityId(), slotId };
  283. const bool isValid = false;
  284. TestIsConnectionPossible(invalidStartEndpoint, paramEndpoint, isValid);
  285. }
  286. }
  287. }
  288. TEST_F(ScriptCanvasTestFixture, Overload_NodeableNode_NumberConnection)
  289. {
  290. RegisterComponentDescriptor<SingleTypeNodeableNode>();
  291. ScriptCanvas::Graph* graph = CreateGraph();
  292. const ScriptCanvas::ScriptCanvasId& scriptCanvasId = graph->GetScriptCanvasId();
  293. AZ::EntityId nodeableNodeId;
  294. SingleTypeNodeableNode* nodeableNode = CreateTestNode<SingleTypeNodeableNode>(scriptCanvasId, nodeableNodeId);
  295. nodeableNode->PostActivate();
  296. TestNodes::ConfigurableUnitTestNode* unitTestNode = CreateConfigurableNode("ConfigurableNode");
  297. ScriptCanvas::SlotId paramId = nodeableNode->GetSlotByName("Param")->GetId();
  298. ScriptCanvas::SlotId paramOneId = nodeableNode->GetSlotByName("ParamOne")->GetId();
  299. ScriptCanvas::SlotId paramTwoId = nodeableNode->GetSlotByName("ParamTwo")->GetId();
  300. AZStd::vector< ScriptCanvas::SlotId > slotIds = {
  301. paramId,
  302. paramOneId,
  303. paramTwoId
  304. };
  305. AZStd::vector< ScriptCanvas::Data::Type > invalidTypes = {
  306. ScriptCanvas::Data::Type::Vector2(),
  307. ScriptCanvas::Data::Type::Vector3(),
  308. ScriptCanvas::Data::Type::Vector4(),
  309. ScriptCanvas::Data::Type::EntityID(),
  310. ScriptCanvas::Data::Type::Color(),
  311. ScriptCanvas::Data::Type::Transform()
  312. };
  313. ScriptCanvas::Slot* validSlot = nullptr;
  314. {
  315. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  316. slotConfiguration.m_name = GenerateSlotName();
  317. slotConfiguration.SetType(ScriptCanvas::Data::Type::Number());
  318. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  319. validSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  320. }
  321. ScriptCanvas::Slot* paramOneSlot = nodeableNode->GetSlot(paramOneId);
  322. ScriptCanvas::Slot* paramTwoSlot = nodeableNode->GetSlot(paramTwoId);
  323. EXPECT_FALSE(paramOneSlot->HasDisplayType());
  324. EXPECT_FALSE(paramTwoSlot->HasDisplayType());
  325. ScriptCanvas::Endpoint validStartEndpoint = validSlot->GetEndpoint();
  326. ScriptCanvas::Endpoint paramEndpoint = { nodeableNode->GetEntityId(), paramId };
  327. TestConnectionBetween(validStartEndpoint, paramEndpoint);
  328. EXPECT_TRUE(paramOneSlot->HasDisplayType());
  329. EXPECT_EQ(paramOneSlot->GetDisplayType(), ScriptCanvas::Data::Type::Number());
  330. EXPECT_TRUE(paramTwoSlot->HasDisplayType());
  331. EXPECT_EQ(paramTwoSlot->GetDisplayType(), ScriptCanvas::Data::Type::Number());
  332. for (ScriptCanvas::Data::Type invalidType : invalidTypes)
  333. {
  334. ScriptCanvas::Slot* invalidSlot = nullptr;
  335. {
  336. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  337. slotConfiguration.m_name = GenerateSlotName();
  338. slotConfiguration.SetType(invalidType);
  339. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  340. invalidSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  341. }
  342. ScriptCanvas::Endpoint invalidStartEndpoint = invalidSlot->GetEndpoint();
  343. for (ScriptCanvas::SlotId slotId : slotIds)
  344. {
  345. ScriptCanvas::Endpoint paramEndpoint2 = { nodeableNode->GetEntityId(), slotId };
  346. const bool isValid = false;
  347. TestIsConnectionPossible(invalidStartEndpoint, paramEndpoint2, isValid);
  348. }
  349. }
  350. }
  351. TEST_F(ScriptCanvasTestFixture, Overload_NodeableNode_Vector3Connection)
  352. {
  353. RegisterComponentDescriptor<SingleTypeNodeableNode>();
  354. ScriptCanvas::Graph* graph = CreateGraph();
  355. const ScriptCanvas::ScriptCanvasId& scriptCanvasId = graph->GetScriptCanvasId();
  356. AZ::EntityId nodeableNodeId;
  357. SingleTypeNodeableNode* nodeableNode = CreateTestNode<SingleTypeNodeableNode>(scriptCanvasId, nodeableNodeId);
  358. nodeableNode->PostActivate();
  359. TestNodes::ConfigurableUnitTestNode* unitTestNode = CreateConfigurableNode("ConfigurableNode");
  360. ScriptCanvas::SlotId paramId = nodeableNode->GetSlotByName("Param")->GetId();
  361. ScriptCanvas::SlotId paramOneId = nodeableNode->GetSlotByName("ParamOne")->GetId();
  362. ScriptCanvas::SlotId paramTwoId = nodeableNode->GetSlotByName("ParamTwo")->GetId();
  363. AZStd::vector< ScriptCanvas::SlotId > slotIds = {
  364. paramId,
  365. paramOneId,
  366. paramTwoId
  367. };
  368. AZStd::vector< ScriptCanvas::Data::Type > invalidTypes = {
  369. ScriptCanvas::Data::Type::Number(),
  370. ScriptCanvas::Data::Type::Vector2(),
  371. ScriptCanvas::Data::Type::Vector4(),
  372. ScriptCanvas::Data::Type::EntityID(),
  373. ScriptCanvas::Data::Type::Color(),
  374. ScriptCanvas::Data::Type::Transform()
  375. };
  376. ScriptCanvas::Slot* validSlot = nullptr;
  377. {
  378. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  379. slotConfiguration.m_name = GenerateSlotName();
  380. slotConfiguration.SetType(ScriptCanvas::Data::Type::Vector3());
  381. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  382. validSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  383. }
  384. ScriptCanvas::Slot* paramOneSlot = nodeableNode->GetSlot(paramOneId);
  385. ScriptCanvas::Slot* paramTwoSlot = nodeableNode->GetSlot(paramTwoId);
  386. EXPECT_FALSE(paramOneSlot->HasDisplayType());
  387. EXPECT_FALSE(paramTwoSlot->HasDisplayType());
  388. ScriptCanvas::Endpoint validStartEndpoint = validSlot->GetEndpoint();
  389. ScriptCanvas::Endpoint paramEndpoint = { nodeableNode->GetEntityId(), paramId };
  390. TestConnectionBetween(validStartEndpoint, paramEndpoint);
  391. EXPECT_TRUE(paramOneSlot->HasDisplayType());
  392. EXPECT_EQ(paramOneSlot->GetDisplayType(), ScriptCanvas::Data::Type::Vector3());
  393. EXPECT_TRUE(paramTwoSlot->HasDisplayType());
  394. EXPECT_EQ(paramTwoSlot->GetDisplayType(), ScriptCanvas::Data::Type::Vector3());
  395. for (ScriptCanvas::Data::Type invalidType : invalidTypes)
  396. {
  397. ScriptCanvas::Slot* invalidSlot = nullptr;
  398. {
  399. ScriptCanvas::DataSlotConfiguration slotConfiguration;
  400. slotConfiguration.m_name = GenerateSlotName();
  401. slotConfiguration.SetType(invalidType);
  402. slotConfiguration.SetConnectionType(ScriptCanvas::ConnectionType::Output);
  403. invalidSlot = unitTestNode->AddTestingSlot(slotConfiguration);
  404. }
  405. ScriptCanvas::Endpoint invalidStartEndpoint = invalidSlot->GetEndpoint();
  406. for (ScriptCanvas::SlotId slotId : slotIds)
  407. {
  408. ScriptCanvas::Endpoint paramEndpoint2 = { nodeableNode->GetEntityId(), slotId };
  409. const bool isValid = false;
  410. TestIsConnectionPossible(invalidStartEndpoint, paramEndpoint2, isValid);
  411. }
  412. }
  413. }