Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
431d15bd
Commit
431d15bd
authored
Nov 03, 2014
by
Christian Stenger
Committed by
Christian Stenger
Dec 04, 2014
Browse files
Add stop button and minor preparation for progress bar
parent
345b4de4
Changes
9
Hide whitespace changes
Inline
Side-by-side
plugins/autotest/autotest.qrc
View file @
431d15bd
...
...
@@ -16,5 +16,6 @@
<file>images/xpass.png</file>
<file>images/run.png</file>
<file>images/runselected.png</file>
<file>images/stop.png</file>
</qresource>
</RCC>
plugins/autotest/images/stop.png
0 → 100644
View file @
431d15bd
314 Bytes
plugins/autotest/testconfiguration.cpp
View file @
431d15bd
...
...
@@ -24,12 +24,16 @@ namespace Autotest {
namespace
Internal
{
TestConfiguration
::
TestConfiguration
(
const
QString
&
testClass
,
const
QStringList
&
testCases
,
QObject
*
parent
)
int
testCaseCount
,
QObject
*
parent
)
:
QObject
(
parent
),
m_testClass
(
testClass
),
m_testCases
(
testCases
),
m_testCaseCount
(
testCaseCount
),
m_project
(
0
)
{
if
(
testCases
.
size
()
!=
0
)
{
m_testCaseCount
=
testCases
.
size
();
}
}
TestConfiguration
::~
TestConfiguration
()
...
...
plugins/autotest/testconfiguration.h
View file @
431d15bd
...
...
@@ -37,7 +37,7 @@ class TestConfiguration : public QObject
Q_OBJECT
public:
explicit
TestConfiguration
(
const
QString
&
testClass
,
const
QStringList
&
testCases
,
QObject
*
parent
=
0
);
int
testCaseCount
=
0
,
QObject
*
parent
=
0
);
~
TestConfiguration
();
void
setTargetFile
(
const
QString
&
targetFile
);
...
...
@@ -49,6 +49,7 @@ public:
QString
testClass
()
const
{
return
m_testClass
;
}
QStringList
testCases
()
const
{
return
m_testCases
;
}
int
testCaseCount
()
const
{
return
m_testCaseCount
;
}
QString
proFile
()
const
{
return
m_proFile
;
}
QString
targetFile
()
const
{
return
m_targetFile
;
}
QString
targetName
()
const
{
return
m_targetName
;
}
...
...
@@ -64,6 +65,7 @@ public slots:
private:
QString
m_testClass
;
QStringList
m_testCases
;
int
m_testCaseCount
;
QString
m_proFile
;
QString
m_targetFile
;
QString
m_targetName
;
...
...
plugins/autotest/testresultspane.cpp
View file @
431d15bd
...
...
@@ -52,6 +52,10 @@ TestResultsPane::TestResultsPane(QObject *parent) :
connect
(
m_listView
,
&
Utils
::
ListView
::
activated
,
this
,
&
TestResultsPane
::
onItemActivated
);
connect
(
m_listView
->
selectionModel
(),
&
QItemSelectionModel
::
currentChanged
,
trd
,
&
TestResultDelegate
::
currentChanged
);
connect
(
TestRunner
::
instance
(),
&
TestRunner
::
testRunStarted
,
this
,
&
TestResultsPane
::
onTestRunStarted
);
connect
(
TestRunner
::
instance
(),
&
TestRunner
::
testRunFinished
,
this
,
&
TestResultsPane
::
onTestRunFinished
);
}
void
TestResultsPane
::
createToolButtons
()
...
...
@@ -66,6 +70,12 @@ void TestResultsPane::createToolButtons()
m_runSelected
->
setToolTip
(
tr
(
"Run Selected Tests"
));
connect
(
m_runSelected
,
&
QToolButton
::
clicked
,
this
,
&
TestResultsPane
::
onRunSelectedTriggered
);
m_stopTestRun
=
new
QToolButton
(
m_listView
);
m_stopTestRun
->
setIcon
(
QIcon
(
QLatin1String
(
":/images/stop.png"
)));
m_stopTestRun
->
setToolTip
(
tr
(
"Stop Test Run"
));
m_stopTestRun
->
setEnabled
(
false
);
connect
(
m_stopTestRun
,
&
QToolButton
::
clicked
,
TestRunner
::
instance
(),
&
TestRunner
::
stopTestRun
);
m_filterButton
=
new
QToolButton
(
m_listView
);
m_filterButton
->
setIcon
(
QIcon
(
QLatin1String
(
Core
::
Constants
::
ICON_FILTER
)));
m_filterButton
->
setToolTip
(
tr
(
"Filter Test Results"
));
...
...
@@ -114,7 +124,7 @@ QWidget *TestResultsPane::outputWidget(QWidget *parent)
QList
<
QWidget
*>
TestResultsPane
::
toolBarWidgets
()
const
{
return
QList
<
QWidget
*>
()
<<
m_runAll
<<
m_runSelected
<<
m_filterButton
;
return
QList
<
QWidget
*>
()
<<
m_runAll
<<
m_runSelected
<<
m_stopTestRun
<<
m_filterButton
;
}
QString
TestResultsPane
::
displayName
()
const
...
...
@@ -254,5 +264,19 @@ void TestResultsPane::filterMenuTriggered(QAction *action)
navigateStateChanged
();
}
void
TestResultsPane
::
onTestRunStarted
()
{
m_stopTestRun
->
setEnabled
(
true
);
m_runAll
->
setEnabled
(
false
);
m_runSelected
->
setEnabled
(
false
);
}
void
TestResultsPane
::
onTestRunFinished
()
{
m_stopTestRun
->
setEnabled
(
false
);
m_runAll
->
setEnabled
(
true
);
m_runSelected
->
setEnabled
(
true
);
}
}
// namespace Internal
}
// namespace Autotest
plugins/autotest/testresultspane.h
View file @
431d15bd
...
...
@@ -82,6 +82,8 @@ private slots:
private:
explicit
TestResultsPane
(
QObject
*
parent
=
0
);
void
createToolButtons
();
void
onTestRunStarted
();
void
onTestRunFinished
();
Utils
::
ListView
*
m_listView
;
TestResultModel
*
m_model
;
...
...
@@ -89,6 +91,7 @@ private:
Core
::
IContext
*
m_context
;
QToolButton
*
m_runAll
;
QToolButton
*
m_runSelected
;
QToolButton
*
m_stopTestRun
;
QToolButton
*
m_filterButton
;
QMenu
*
m_filterMenu
;
};
...
...
plugins/autotest/testrunner.cpp
View file @
431d15bd
...
...
@@ -104,10 +104,16 @@ void TestRunner::runTests()
}
}
int
testCaseCount
=
0
;
foreach
(
const
TestConfiguration
*
config
,
m_selectedTests
)
testCaseCount
+=
config
->
testCaseCount
();
// clear old log and output pane
m_xmlLog
.
clear
();
TestResultsPane
::
instance
()
->
clearContents
();
emit
testRunStarted
();
foreach
(
TestConfiguration
*
tc
,
m_selectedTests
)
{
QString
cmd
=
tc
->
targetFile
();
QString
workDir
=
tc
->
workingDirectory
();
...
...
@@ -121,11 +127,18 @@ void TestRunner::runTests()
exec
(
cmd
,
args
,
workDir
,
env
);
}
qDebug
(
"test run finished"
);
emit
testRunFinished
();
}
void
TestRunner
::
stopTestRun
()
{
if
(
m_runner
.
state
()
!=
QProcess
::
NotRunning
)
{
m_runner
.
kill
();
m_runner
.
waitForFinished
();
TestResultsPane
::
instance
()
->
addTestResult
(
TestResult
(
QString
(),
QString
(),
QString
(),
ResultType
::
MESSAGE_FATAL
,
tr
(
"*** Test Run canceled by user ***"
)));
}
}
/******************** XML line parser helper ********************/
...
...
plugins/autotest/testrunner.h
View file @
431d15bd
...
...
@@ -43,6 +43,8 @@ public:
void
setSelectedTests
(
const
QList
<
TestConfiguration
*>
&
selected
);
signals:
void
testRunStarted
();
void
testRunFinished
();
public
slots
:
void
runTests
();
...
...
plugins/autotest/testtreemodel.cpp
View file @
431d15bd
...
...
@@ -305,7 +305,8 @@ QList<TestConfiguration *> TestTreeModel::getAllTestCases() const
for
(
int
row
=
0
;
row
<
count
;
++
row
)
{
TestTreeItem
*
child
=
m_autoTestRootItem
->
child
(
row
);
TestConfiguration
*
tc
=
new
TestConfiguration
(
child
->
name
(),
QStringList
());
TestConfiguration
*
tc
=
new
TestConfiguration
(
child
->
name
(),
QStringList
(),
child
->
childCount
());
addProjectInformation
(
tc
,
child
->
filePath
());
result
<<
tc
;
}
...
...
@@ -325,7 +326,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
case
Qt
::
Unchecked
:
continue
;
case
Qt
::
Checked
:
tc
=
new
TestConfiguration
(
child
->
name
(),
QStringList
());
tc
=
new
TestConfiguration
(
child
->
name
(),
QStringList
()
,
child
->
childCount
()
);
addProjectInformation
(
tc
,
child
->
filePath
());
result
<<
tc
;
continue
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment