Integrating latest 47acbe8
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDialog>
|
||||
#include <QIcon>
|
||||
#include <QItemSelection>
|
||||
#include <QLabel>
|
||||
#include <QTableView>
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationTest.h>
|
||||
|
||||
#include <GraphCanvas/Editor/EditorTypes.h>
|
||||
|
||||
class QWindow;
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
class EditorAutomationTestDialogRequests
|
||||
: public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
|
||||
using BusIdType = GraphCanvas::EditorId;
|
||||
|
||||
virtual void ShowTestDialog() = 0;
|
||||
};
|
||||
|
||||
using EditorAutomationTestDialogRequestBus = AZ::EBus<EditorAutomationTestDialogRequests>;
|
||||
|
||||
class QtActionTest;
|
||||
|
||||
class TestListModel
|
||||
: public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TestListModel, AZ::SystemAllocator, 0);
|
||||
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexForce = -1,
|
||||
|
||||
TestName,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
TestListModel();
|
||||
~TestListModel() override;
|
||||
|
||||
// QAbstractItemModel
|
||||
QModelIndex index(int row, int column, const QModelIndex& parent) const override;
|
||||
QModelIndex parent(const QModelIndex& index = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
////
|
||||
|
||||
void AddTest(EditorAutomationTest* actionTest);
|
||||
|
||||
EditorAutomationTest* FindTestForIndex(const QModelIndex& index) const;
|
||||
EditorAutomationTest* FindTestForRow(int row) const;
|
||||
|
||||
int FindRowForTest(EditorAutomationTest* actionTest);
|
||||
|
||||
void UpdateTestDisplay(EditorAutomationTest* actionTest);
|
||||
|
||||
private:
|
||||
|
||||
AZStd::vector< EditorAutomationTest* > m_actionTests;
|
||||
|
||||
QIcon m_runningIcon;
|
||||
QIcon m_passedIcon;
|
||||
QIcon m_failedIcon;
|
||||
};
|
||||
|
||||
class EditorAutomationTestDialog
|
||||
: public QDialog
|
||||
, public AZ::SystemTickBus::Handler
|
||||
, public EditorAutomationTestDialogRequestBus::Handler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EditorAutomationTestDialog(QMainWindow* mainWindow);
|
||||
~EditorAutomationTestDialog() override;
|
||||
|
||||
void RunAllTests();
|
||||
void RunTest(QModelIndex index);
|
||||
|
||||
// SystemTickBus
|
||||
void OnSystemTick();
|
||||
////
|
||||
|
||||
// EditorAutomationTestDialogRequestBus::Handler
|
||||
void ShowTestDialog() override;
|
||||
////
|
||||
|
||||
void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
|
||||
private:
|
||||
|
||||
void StartNewTestRun();
|
||||
void FinishTestRun();
|
||||
|
||||
void DisplayErrorsForTest(EditorAutomationTest* actionTest);
|
||||
void UpdateRunLabel();
|
||||
|
||||
int m_runCount = 0;
|
||||
int m_successCount = 0;
|
||||
|
||||
AZStd::chrono::time_point<AZStd::chrono::system_clock> m_startTime;
|
||||
|
||||
EditorAutomationTest* m_activeTest = nullptr;
|
||||
AZStd::unordered_set< EditorAutomationTest* > m_testQueue;
|
||||
|
||||
TestListModel* m_testListModel = nullptr;
|
||||
|
||||
QTableView* m_tableView = nullptr;
|
||||
|
||||
QLabel* m_errorTestLabel = nullptr;
|
||||
QLabel* m_runLabel = nullptr;
|
||||
QMainWindow* m_scriptCanvasWindow = nullptr;
|
||||
|
||||
QWindow* m_canvasWindow = nullptr;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user