MCPcopy Create free account
hub / github.com/KDE/kdevelop / TestView

Method TestView

plugins/testview/testview.cpp:50–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48};
49
50TestView::TestView(TestViewPlugin* plugin, QWidget* parent)
51 : QWidget(parent)
52 , m_plugin(plugin)
53 , m_tree(new QTreeView(this))
54 , m_filter(new QSortFilterProxyModel(this))
55{
56 setWindowIcon(QIcon::fromTheme(QStringLiteral("preflight-verifier"), windowIcon()));
57 setWindowTitle(i18nc("@title:window", "Unit Tests"));
58
59 auto* layout = new QVBoxLayout(this);
60 layout->setContentsMargins(0, 0, 0, 0);
61 setLayout(layout);
62 layout->addWidget(m_tree);
63
64 m_tree->setSortingEnabled(true);
65 m_tree->header()->hide();
66 m_tree->setIndentation(10);
67 m_tree->setEditTriggers(QTreeView::NoEditTriggers);
68 m_tree->setSelectionBehavior(QTreeView::SelectRows);
69 m_tree->setSelectionMode(QTreeView::ExtendedSelection);
70 m_tree->setExpandsOnDoubleClick(false);
71 m_tree->sortByColumn(0, Qt::AscendingOrder);
72 connect(m_tree, &QTreeView::doubleClicked, this, &TestView::doubleClicked);
73
74 m_model = new QStandardItemModel(this);
75 m_filter->setRecursiveFilteringEnabled(true);
76 m_filter->setSourceModel(m_model);
77 m_tree->setModel(m_filter);
78
79 auto* showSource = new QAction( QIcon::fromTheme(QStringLiteral("code-context")), i18nc("@action:inmenu", "Show Source"), this );
80 connect (showSource, &QAction::triggered, this, &TestView::showSource);
81 m_contextMenuActions << showSource;
82
83 addAction(plugin->actionCollection()->action(QStringLiteral("run_all_tests")));
84 addAction(plugin->actionCollection()->action(QStringLiteral("stop_running_tests")));
85
86 auto* runSelected = new QAction( QIcon::fromTheme(QStringLiteral("system-run")), i18nc("@action", "Run Selected Tests"), this );
87 connect (runSelected, &QAction::triggered, this, &TestView::runSelectedTests);
88 addAction(runSelected);
89
90 auto* edit = new QLineEdit(parent);
91 edit->setPlaceholderText(i18nc("@info:placeholder", "Filter..."));
92 edit->setClearButtonEnabled(true);
93 auto* widgetAction = new QWidgetAction(this);
94 widgetAction->setDefaultWidget(edit);
95 connect(edit, &QLineEdit::textChanged, this, &TestView::changeFilter);
96 addAction(widgetAction);
97
98 setFocusProxy(edit);
99
100 IProjectController* pc = ICore::self()->projectController();
101 connect (pc, &IProjectController::projectClosed, this, &TestView::removeProject);
102
103 ITestController* tc = ICore::self()->testController();
104 connect (tc, &ITestController::testSuiteAdded,
105 this, &TestView::addTestSuite);
106 connect (tc, &ITestController::testSuiteRemoved,
107 this, &TestView::removeTestSuite);

Callers

nothing calls this directly

Calls 11

setSortingEnabledMethod · 0.80
headerMethod · 0.80
setSourceModelMethod · 0.80
setPlaceholderTextMethod · 0.80
projectControllerMethod · 0.80
testControllerMethod · 0.80
addWidgetMethod · 0.45
setModelMethod · 0.45
actionMethod · 0.45
actionCollectionMethod · 0.45
testSuitesMethod · 0.45

Tested by

no test coverage detected