2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-02-25 13:02:31 +01:00
|
|
|
#include "testresult.h"
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <coreplugin/ioutputpane.h>
|
|
|
|
|
|
2019-11-14 14:11:34 +01:00
|
|
|
#include <utils/ansiescapecodehandler.h>
|
2015-08-19 13:19:28 +02:00
|
|
|
#include <utils/itemviews.h>
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
2014-10-21 13:10:37 +02:00
|
|
|
class QAction;
|
2014-11-05 15:27:49 +01:00
|
|
|
class QFrame;
|
2015-08-19 13:19:28 +02:00
|
|
|
class QKeyEvent;
|
2014-11-05 15:27:49 +01:00
|
|
|
class QLabel;
|
2014-10-07 15:51:02 +02:00
|
|
|
class QModelIndex;
|
2014-10-21 13:10:37 +02:00
|
|
|
class QMenu;
|
2017-05-05 13:01:06 +02:00
|
|
|
class QPlainTextEdit;
|
|
|
|
|
class QStackedWidget;
|
2014-10-07 15:51:02 +02:00
|
|
|
class QToolButton;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
class IContext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
2019-08-19 10:55:32 +02:00
|
|
|
|
2019-11-06 14:25:16 +01:00
|
|
|
enum class OutputChannel;
|
2019-08-19 10:55:32 +02:00
|
|
|
class TestResult;
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestResultModel;
|
2014-10-21 13:10:37 +02:00
|
|
|
class TestResultFilterModel;
|
2018-05-03 23:29:18 +03:00
|
|
|
class TestEditorMark;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-08-19 13:19:28 +02:00
|
|
|
class ResultsTreeView : public Utils::TreeView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-05-31 07:38:04 +02:00
|
|
|
explicit ResultsTreeView(QWidget *parent = nullptr);
|
2015-08-19 13:19:28 +02:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void copyShortcutTriggered();
|
|
|
|
|
|
|
|
|
|
protected:
|
2020-11-18 15:26:38 +01:00
|
|
|
void keyPressEvent(QKeyEvent *event) final;
|
2015-08-19 13:19:28 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
class TestResultsPane : public Core::IOutputPane
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-07-11 15:44:51 +02:00
|
|
|
~TestResultsPane() override;
|
2014-10-07 15:51:02 +02:00
|
|
|
static TestResultsPane *instance();
|
|
|
|
|
|
|
|
|
|
// IOutputPane interface
|
2016-09-29 12:15:43 +02:00
|
|
|
QWidget *outputWidget(QWidget *parent) override;
|
|
|
|
|
QList<QWidget *> toolBarWidgets() const override;
|
|
|
|
|
QString displayName() const override;
|
|
|
|
|
int priorityInStatusBar() const override;
|
|
|
|
|
void clearContents() override;
|
|
|
|
|
void setFocus() override;
|
|
|
|
|
bool hasFocus() const override;
|
|
|
|
|
bool canFocus() const override;
|
|
|
|
|
bool canNavigate() const override;
|
|
|
|
|
bool canNext() const override;
|
|
|
|
|
bool canPrevious() const override;
|
|
|
|
|
void goToNext() override;
|
|
|
|
|
void goToPrev() override;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-02-25 13:02:31 +01:00
|
|
|
void addTestResult(const TestResultPtr &result);
|
2019-11-06 14:25:16 +01:00
|
|
|
void addOutputLine(const QByteArray &outputLine, OutputChannel channel);
|
2018-05-03 23:29:18 +03:00
|
|
|
void showTestResult(const QModelIndex &index);
|
2016-06-28 22:38:54 +03:00
|
|
|
private:
|
2018-05-31 07:38:04 +02:00
|
|
|
explicit TestResultsPane(QObject *parent = nullptr);
|
2016-06-28 22:38:54 +03:00
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
void onItemActivated(const QModelIndex &index);
|
|
|
|
|
void onRunAllTriggered();
|
|
|
|
|
void onRunSelectedTriggered();
|
2018-11-02 07:44:04 +01:00
|
|
|
void checkAllFilter(bool checked);
|
2014-10-21 13:10:37 +02:00
|
|
|
void filterMenuTriggered(QAction *action);
|
2021-08-18 09:13:57 +02:00
|
|
|
bool eventFilter(QObject *object, QEvent *event) override;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2014-11-04 14:16:22 +01:00
|
|
|
void initializeFilterMenu();
|
2014-11-05 15:27:49 +01:00
|
|
|
void updateSummaryLabel();
|
2014-10-07 15:51:02 +02:00
|
|
|
void createToolButtons();
|
2014-11-03 08:30:22 +01:00
|
|
|
void onTestRunStarted();
|
|
|
|
|
void onTestRunFinished();
|
2015-04-16 08:54:41 +02:00
|
|
|
void onScrollBarRangeChanged(int, int max);
|
2015-08-19 13:19:28 +02:00
|
|
|
void onCustomContextMenuRequested(const QPoint &pos);
|
2017-09-09 16:46:43 +02:00
|
|
|
const TestResult *getTestResult(const QModelIndex &idx);
|
|
|
|
|
void onCopyItemTriggered(const TestResult *result);
|
2015-08-19 13:19:28 +02:00
|
|
|
void onCopyWholeTriggered();
|
|
|
|
|
void onSaveWholeTriggered();
|
2017-09-09 16:46:43 +02:00
|
|
|
void onRunThisTestTriggered(TestRunMode runMode, const TestResult *result);
|
2017-05-05 13:01:06 +02:00
|
|
|
void toggleOutputStyle();
|
2015-08-20 15:59:15 +02:00
|
|
|
QString getWholeOutput(const QModelIndex &parent = QModelIndex());
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2018-07-11 15:44:51 +02:00
|
|
|
void createMarks(const QModelIndex &parent = QModelIndex());
|
2018-05-03 23:29:18 +03:00
|
|
|
void clearMarks();
|
|
|
|
|
|
2017-05-05 13:01:06 +02:00
|
|
|
QStackedWidget *m_outputWidget;
|
2014-11-05 15:27:49 +01:00
|
|
|
QFrame *m_summaryWidget;
|
|
|
|
|
QLabel *m_summaryLabel;
|
2015-08-19 13:19:28 +02:00
|
|
|
ResultsTreeView *m_treeView;
|
2014-10-07 15:51:02 +02:00
|
|
|
TestResultModel *m_model;
|
2014-10-21 13:10:37 +02:00
|
|
|
TestResultFilterModel *m_filterModel;
|
2014-10-07 15:51:02 +02:00
|
|
|
Core::IContext *m_context;
|
2015-08-20 15:59:15 +02:00
|
|
|
QToolButton *m_expandCollapse;
|
2014-10-07 15:51:02 +02:00
|
|
|
QToolButton *m_runAll;
|
|
|
|
|
QToolButton *m_runSelected;
|
2020-09-11 09:44:21 +02:00
|
|
|
QToolButton *m_runFailed;
|
2018-05-05 22:28:55 +03:00
|
|
|
QToolButton *m_runFile;
|
2014-11-03 08:30:22 +01:00
|
|
|
QToolButton *m_stopTestRun;
|
2014-10-21 13:10:37 +02:00
|
|
|
QToolButton *m_filterButton;
|
2017-05-05 13:01:06 +02:00
|
|
|
QToolButton *m_outputToggleButton;
|
|
|
|
|
QPlainTextEdit *m_textOutput;
|
2014-10-21 13:10:37 +02:00
|
|
|
QMenu *m_filterMenu;
|
2016-09-29 12:15:43 +02:00
|
|
|
bool m_autoScroll = false;
|
|
|
|
|
bool m_atEnd = false;
|
|
|
|
|
bool m_testRunning = false;
|
2018-05-03 23:29:18 +03:00
|
|
|
QVector<TestEditorMark *> m_marks;
|
2019-11-14 14:11:34 +01:00
|
|
|
QTextCharFormat m_defaultFormat;
|
|
|
|
|
Utils::AnsiEscapeCodeHandler m_stdErrHandler;
|
|
|
|
|
Utils::AnsiEscapeCodeHandler m_stdOutHandler;
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|