InteractionTests.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #pragma once
  9. #include <QLineEdit>
  10. #include <QMenu>
  11. #include <QString>
  12. #include <QTableView>
  13. #include <GraphCanvas/Components/Nodes/NodeBus.h>
  14. #include <GraphCanvas/Components/SceneBus.h>
  15. #include <GraphCanvas/Components/Slots/SlotBus.h>
  16. #include <GraphCanvas/Components/VisualBus.h>
  17. #include <GraphCanvas/Utils/ConversionUtils.h>
  18. #include <ScriptCanvas/Bus/RequestBus.h>
  19. #include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationTest.h>
  20. #include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationStates/CreateElementsStates.h>
  21. namespace ScriptCanvas::Developer
  22. {
  23. /**
  24. EditorautomationTest that will test out the AltClick to delete elements functionality for nodes, connected nodes, and connections
  25. */
  26. class AltClickDeleteTest
  27. : public EditorAutomationTest
  28. , public GraphCanvas::SceneNotificationBus::Handler
  29. {
  30. public:
  31. AZ_CLASS_ALLOCATOR(AltClickDeleteTest, AZ::SystemAllocator)
  32. AltClickDeleteTest();
  33. ~AltClickDeleteTest() override = default;
  34. };
  35. /**
  36. EditorautomationTest that will test out the cut/copy/paste functions
  37. */
  38. class CutCopyPasteDuplicateTest
  39. : public EditorAutomationTest
  40. , public GraphCanvas::SceneNotificationBus::Handler
  41. {
  42. class CheckpointState
  43. : public CustomActionState
  44. {
  45. public:
  46. CheckpointState(AZStd::string checkpoint);
  47. ~CheckpointState() override = default;
  48. void OnCustomAction() override {}
  49. };
  50. public:
  51. AZ_CLASS_ALLOCATOR(CutCopyPasteDuplicateTest, AZ::SystemAllocator)
  52. CutCopyPasteDuplicateTest(QString nodeName);
  53. ~CutCopyPasteDuplicateTest() override = default;
  54. // SceneNotificationBus
  55. void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
  56. void OnNodeRemoved(const AZ::EntityId& nodeId) override;
  57. ///
  58. // EditorAutomationTests
  59. void OnStateComplete(int stateId) override;
  60. ////
  61. private:
  62. void ProcessCreationSet();
  63. AutomationStateModelId m_originalNodeId;
  64. GraphCanvas::NodeId m_removalTarget;
  65. AZStd::unordered_set< GraphCanvas::NodeId > m_createdSet;
  66. CreateNodeFromContextMenuState* m_createNodeState = nullptr;
  67. CheckpointState* m_cutPasteCheckpoint = nullptr;
  68. CheckpointState* m_copyPasteCheckpoint = nullptr;
  69. CheckpointState* m_copyPasteCopyCheckpoint = nullptr;
  70. CheckpointState* m_duplicateCheckpoint = nullptr;
  71. };
  72. }