forked from qt-creator/qt-creator
Use Qt style for enums
Change-Id: I10c1379dea467f10214772168f4c1ec3134a99ee Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
This commit is contained in:
@@ -389,7 +389,7 @@ static TestTreeItem *constructTestTreeItem(const QString &fileName,
|
|||||||
const QMap<QString, TestCodeLocationAndType> &functions,
|
const QMap<QString, TestCodeLocationAndType> &functions,
|
||||||
const QMap<QString, TestCodeLocationList> dataTags = QMap<QString, TestCodeLocationList>())
|
const QMap<QString, TestCodeLocationList> dataTags = QMap<QString, TestCodeLocationList>())
|
||||||
{
|
{
|
||||||
TestTreeItem *treeItem = new TestTreeItem(testCaseName, fileName, TestTreeItem::TEST_CLASS);
|
TestTreeItem *treeItem = new TestTreeItem(testCaseName, fileName, TestTreeItem::TestClass);
|
||||||
treeItem->setMainFile(mainFile); // used for Quick Tests only
|
treeItem->setMainFile(mainFile); // used for Quick Tests only
|
||||||
treeItem->setLine(line);
|
treeItem->setLine(line);
|
||||||
treeItem->setColumn(column);
|
treeItem->setColumn(column);
|
||||||
|
@@ -104,9 +104,9 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
// do not provide this menu entry for unnamed Quick Tests as it makes no sense
|
// do not provide this menu entry for unnamed Quick Tests as it makes no sense
|
||||||
int type = index.data(TypeRole).toInt();
|
int type = index.data(TypeRole).toInt();
|
||||||
const QString &unnamed = tr(Constants::UNNAMED_QUICKTESTS);
|
const QString &unnamed = tr(Constants::UNNAMED_QUICKTESTS);
|
||||||
if ((type == TestTreeItem::TEST_FUNCTION && index.parent().data().toString() != unnamed)
|
if ((type == TestTreeItem::TestFunction && index.parent().data().toString() != unnamed)
|
||||||
|| (type == TestTreeItem::TEST_CLASS && index.data().toString() != unnamed)
|
|| (type == TestTreeItem::TestClass && index.data().toString() != unnamed)
|
||||||
|| (type == TestTreeItem::TEST_DATATAG)) {
|
|| (type == TestTreeItem::TestDataTag)) {
|
||||||
runThisTest = new QAction(tr("Run This Test"), &menu);
|
runThisTest = new QAction(tr("Run This Test"), &menu);
|
||||||
runThisTest->setEnabled(enabled);
|
runThisTest->setEnabled(enabled);
|
||||||
connect(runThisTest, &QAction::triggered,
|
connect(runThisTest, &QAction::triggered,
|
||||||
@@ -250,8 +250,8 @@ void TestNavigationWidget::onRunThisTestTriggered()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TestTreeItem *item = static_cast<TestTreeItem *>(sourceIndex.internalPointer());
|
TestTreeItem *item = static_cast<TestTreeItem *>(sourceIndex.internalPointer());
|
||||||
if (item->type() == TestTreeItem::TEST_CLASS || item->type() == TestTreeItem::TEST_FUNCTION
|
if (item->type() == TestTreeItem::TestClass || item->type() == TestTreeItem::TestFunction
|
||||||
|| item->type() == TestTreeItem::TEST_DATATAG) {
|
|| item->type() == TestTreeItem::TestDataTag) {
|
||||||
if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) {
|
if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) {
|
||||||
TestRunner *runner = TestRunner::instance();
|
TestRunner *runner = TestRunner::instance();
|
||||||
runner->setSelectedTests( {configuration} );
|
runner->setSelectedTests( {configuration} );
|
||||||
|
@@ -35,7 +35,7 @@ TestResult::TestResult()
|
|||||||
|
|
||||||
TestResult::TestResult(const QString &className)
|
TestResult::TestResult(const QString &className)
|
||||||
: m_class(className)
|
: m_class(className)
|
||||||
, m_result(Result::INVALID)
|
, m_result(Result::Invalid)
|
||||||
, m_line(0)
|
, m_line(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -43,33 +43,33 @@ TestResult::TestResult(const QString &className)
|
|||||||
Result::Type TestResult::resultFromString(const QString &resultString)
|
Result::Type TestResult::resultFromString(const QString &resultString)
|
||||||
{
|
{
|
||||||
if (resultString == QLatin1String("pass"))
|
if (resultString == QLatin1String("pass"))
|
||||||
return Result::PASS;
|
return Result::Pass;
|
||||||
if (resultString == QLatin1String("fail"))
|
if (resultString == QLatin1String("fail"))
|
||||||
return Result::FAIL;
|
return Result::Fail;
|
||||||
if (resultString == QLatin1String("xfail"))
|
if (resultString == QLatin1String("xfail"))
|
||||||
return Result::EXPECTED_FAIL;
|
return Result::ExpectedFail;
|
||||||
if (resultString == QLatin1String("xpass"))
|
if (resultString == QLatin1String("xpass"))
|
||||||
return Result::UNEXPECTED_PASS;
|
return Result::UnexpectedPass;
|
||||||
if (resultString == QLatin1String("skip"))
|
if (resultString == QLatin1String("skip"))
|
||||||
return Result::SKIP;
|
return Result::Skip;
|
||||||
if (resultString == QLatin1String("qdebug"))
|
if (resultString == QLatin1String("qdebug"))
|
||||||
return Result::MESSAGE_DEBUG;
|
return Result::MessageDebug;
|
||||||
if (resultString == QLatin1String("warn") || resultString == QLatin1String("qwarn"))
|
if (resultString == QLatin1String("warn") || resultString == QLatin1String("qwarn"))
|
||||||
return Result::MESSAGE_WARN;
|
return Result::MessageWarn;
|
||||||
if (resultString == QLatin1String("qfatal"))
|
if (resultString == QLatin1String("qfatal"))
|
||||||
return Result::MESSAGE_FATAL;
|
return Result::MessageFatal;
|
||||||
if (resultString == QLatin1String("bpass"))
|
if (resultString == QLatin1String("bpass"))
|
||||||
return Result::BLACKLISTED_PASS;
|
return Result::BlacklistedPass;
|
||||||
if (resultString == QLatin1String("bfail"))
|
if (resultString == QLatin1String("bfail"))
|
||||||
return Result::BLACKLISTED_FAIL;
|
return Result::BlacklistedFail;
|
||||||
qDebug("Unexpected test result: %s", qPrintable(resultString));
|
qDebug("Unexpected test result: %s", qPrintable(resultString));
|
||||||
return Result::INVALID;
|
return Result::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result::Type TestResult::toResultType(int rt)
|
Result::Type TestResult::toResultType(int rt)
|
||||||
{
|
{
|
||||||
if (rt < Result::FIRST_TYPE || rt > Result::LAST_TYPE)
|
if (rt < Result::FIRST_TYPE || rt > Result::LAST_TYPE)
|
||||||
return Result::INVALID;
|
return Result::Invalid;
|
||||||
|
|
||||||
return (Result::Type)rt;
|
return (Result::Type)rt;
|
||||||
}
|
}
|
||||||
@@ -80,27 +80,27 @@ QString TestResult::resultToString(const Result::Type type)
|
|||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Result::PASS:
|
case Result::Pass:
|
||||||
return QLatin1String("PASS");
|
return QLatin1String("PASS");
|
||||||
case Result::FAIL:
|
case Result::Fail:
|
||||||
return QLatin1String("FAIL");
|
return QLatin1String("FAIL");
|
||||||
case Result::EXPECTED_FAIL:
|
case Result::ExpectedFail:
|
||||||
return QLatin1String("XFAIL");
|
return QLatin1String("XFAIL");
|
||||||
case Result::UNEXPECTED_PASS:
|
case Result::UnexpectedPass:
|
||||||
return QLatin1String("XPASS");
|
return QLatin1String("XPASS");
|
||||||
case Result::SKIP:
|
case Result::Skip:
|
||||||
return QLatin1String("SKIP");
|
return QLatin1String("SKIP");
|
||||||
case Result::BENCHMARK:
|
case Result::Benchmark:
|
||||||
return QLatin1String("BENCH");
|
return QLatin1String("BENCH");
|
||||||
case Result::MESSAGE_DEBUG:
|
case Result::MessageDebug:
|
||||||
return QLatin1String("DEBUG");
|
return QLatin1String("DEBUG");
|
||||||
case Result::MESSAGE_WARN:
|
case Result::MessageWarn:
|
||||||
return QLatin1String("WARN");
|
return QLatin1String("WARN");
|
||||||
case Result::MESSAGE_FATAL:
|
case Result::MessageFatal:
|
||||||
return QLatin1String("FATAL");
|
return QLatin1String("FATAL");
|
||||||
case Result::BLACKLISTED_PASS:
|
case Result::BlacklistedPass:
|
||||||
return QLatin1String("BPASS");
|
return QLatin1String("BPASS");
|
||||||
case Result::BLACKLISTED_FAIL:
|
case Result::BlacklistedFail:
|
||||||
return QLatin1String("BFAIL");
|
return QLatin1String("BFAIL");
|
||||||
default:
|
default:
|
||||||
return QLatin1String("UNKNOWN");
|
return QLatin1String("UNKNOWN");
|
||||||
@@ -113,25 +113,25 @@ QColor TestResult::colorForType(const Result::Type type)
|
|||||||
return QColor("transparent");
|
return QColor("transparent");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Result::PASS:
|
case Result::Pass:
|
||||||
return QColor("#009900");
|
return QColor("#009900");
|
||||||
case Result::FAIL:
|
case Result::Fail:
|
||||||
return QColor("#a00000");
|
return QColor("#a00000");
|
||||||
case Result::EXPECTED_FAIL:
|
case Result::ExpectedFail:
|
||||||
return QColor("#00ff00");
|
return QColor("#00ff00");
|
||||||
case Result::UNEXPECTED_PASS:
|
case Result::UnexpectedPass:
|
||||||
return QColor("#ff0000");
|
return QColor("#ff0000");
|
||||||
case Result::SKIP:
|
case Result::Skip:
|
||||||
return QColor("#787878");
|
return QColor("#787878");
|
||||||
case Result::BLACKLISTED_PASS:
|
case Result::BlacklistedPass:
|
||||||
return QColor(0, 0, 0);
|
return QColor(0, 0, 0);
|
||||||
case Result::BLACKLISTED_FAIL:
|
case Result::BlacklistedFail:
|
||||||
return QColor(0, 0, 0);
|
return QColor(0, 0, 0);
|
||||||
case Result::MESSAGE_DEBUG:
|
case Result::MessageDebug:
|
||||||
return QColor("#329696");
|
return QColor("#329696");
|
||||||
case Result::MESSAGE_WARN:
|
case Result::MessageWarn:
|
||||||
return QColor("#d0bb00");
|
return QColor("#d0bb00");
|
||||||
case Result::MESSAGE_FATAL:
|
case Result::MessageFatal:
|
||||||
return QColor("#640000");
|
return QColor("#640000");
|
||||||
default:
|
default:
|
||||||
return QColor("#000000");
|
return QColor("#000000");
|
||||||
|
@@ -29,28 +29,28 @@ namespace Internal {
|
|||||||
|
|
||||||
namespace Result{
|
namespace Result{
|
||||||
enum Type {
|
enum Type {
|
||||||
PASS, FIRST_TYPE = PASS,
|
Pass, FIRST_TYPE = Pass,
|
||||||
FAIL,
|
Fail,
|
||||||
EXPECTED_FAIL,
|
ExpectedFail,
|
||||||
UNEXPECTED_PASS,
|
UnexpectedPass,
|
||||||
SKIP,
|
Skip,
|
||||||
BLACKLISTED_PASS,
|
BlacklistedPass,
|
||||||
BLACKLISTED_FAIL,
|
BlacklistedFail,
|
||||||
BENCHMARK,
|
Benchmark,
|
||||||
MESSAGE_DEBUG,
|
MessageDebug,
|
||||||
MESSAGE_WARN,
|
MessageWarn,
|
||||||
MESSAGE_FATAL,
|
MessageFatal,
|
||||||
|
|
||||||
MESSAGE_INTERNAL, INTERNAL_MESSAGES_BEGIN = MESSAGE_INTERNAL,
|
MessageInternal, INTERNAL_MESSAGES_BEGIN = MessageInternal,
|
||||||
MESSAGE_TEST_CASE_START,
|
MessageTestCaseStart,
|
||||||
MESSAGE_TEST_CASE_SUCCESS,
|
MessageTestCaseSuccess,
|
||||||
MESSAGE_TEST_CASE_WARN,
|
MessageTestCaseWarn,
|
||||||
MESSAGE_TEST_CASE_FAIL,
|
MessageTestCaseFail,
|
||||||
MESSAGE_TEST_CASE_END,
|
MessageTestCaseEnd,
|
||||||
MESSAGE_CURRENT_TEST, INTERNAL_MESSAGES_END = MESSAGE_CURRENT_TEST,
|
MessageCurrentTest, INTERNAL_MESSAGES_END = MessageCurrentTest,
|
||||||
|
|
||||||
INVALID,
|
Invalid,
|
||||||
LAST_TYPE = INVALID
|
LAST_TYPE = Invalid
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,12 +42,12 @@ QString TestResultDelegate::outputString(const TestResult &testResult, bool sele
|
|||||||
const QString desc = testResult.description();
|
const QString desc = testResult.description();
|
||||||
QString output;
|
QString output;
|
||||||
switch (testResult.result()) {
|
switch (testResult.result()) {
|
||||||
case Result::PASS:
|
case Result::Pass:
|
||||||
case Result::FAIL:
|
case Result::Fail:
|
||||||
case Result::EXPECTED_FAIL:
|
case Result::ExpectedFail:
|
||||||
case Result::UNEXPECTED_PASS:
|
case Result::UnexpectedPass:
|
||||||
case Result::BLACKLISTED_FAIL:
|
case Result::BlacklistedFail:
|
||||||
case Result::BLACKLISTED_PASS:
|
case Result::BlacklistedPass:
|
||||||
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
||||||
if (!testResult.dataTag().isEmpty())
|
if (!testResult.dataTag().isEmpty())
|
||||||
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
||||||
@@ -55,7 +55,7 @@ QString TestResultDelegate::outputString(const TestResult &testResult, bool sele
|
|||||||
output.append(QLatin1Char('\n')).append(desc);
|
output.append(QLatin1Char('\n')).append(desc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Result::BENCHMARK:
|
case Result::Benchmark:
|
||||||
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
output = testResult.className() + QLatin1String("::") + testResult.testCase();
|
||||||
if (!testResult.dataTag().isEmpty())
|
if (!testResult.dataTag().isEmpty())
|
||||||
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag()));
|
||||||
|
@@ -52,14 +52,14 @@ static QIcon testResultIcon(Result::Type result) {
|
|||||||
QIcon(QLatin1String(":/images/fatal.png")),
|
QIcon(QLatin1String(":/images/fatal.png")),
|
||||||
}; // provide an icon for unknown??
|
}; // provide an icon for unknown??
|
||||||
|
|
||||||
if (result < 0 || result >= Result::MESSAGE_INTERNAL) {
|
if (result < 0 || result >= Result::MessageInternal) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case Result::MESSAGE_TEST_CASE_SUCCESS:
|
case Result::MessageTestCaseSuccess:
|
||||||
return icons[Result::PASS];
|
return icons[Result::Pass];
|
||||||
case Result::MESSAGE_TEST_CASE_FAIL:
|
case Result::MessageTestCaseFail:
|
||||||
return icons[Result::FAIL];
|
return icons[Result::Fail];
|
||||||
case Result::MESSAGE_TEST_CASE_WARN:
|
case Result::MessageTestCaseWarn:
|
||||||
return icons[Result::MESSAGE_WARN];
|
return icons[Result::MessageWarn];
|
||||||
default:
|
default:
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
@@ -84,25 +84,25 @@ void TestResultItem::updateDescription(const QString &description)
|
|||||||
|
|
||||||
void TestResultItem::updateResult()
|
void TestResultItem::updateResult()
|
||||||
{
|
{
|
||||||
if (m_testResult->result() != Result::MESSAGE_TEST_CASE_START)
|
if (m_testResult->result() != Result::MessageTestCaseStart)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Result::Type newResult = Result::MESSAGE_TEST_CASE_SUCCESS;
|
Result::Type newResult = Result::MessageTestCaseSuccess;
|
||||||
foreach (Utils::TreeItem *child, children()) {
|
foreach (Utils::TreeItem *child, children()) {
|
||||||
const TestResult *current = static_cast<TestResultItem *>(child)->testResult();
|
const TestResult *current = static_cast<TestResultItem *>(child)->testResult();
|
||||||
if (current) {
|
if (current) {
|
||||||
switch (current->result()) {
|
switch (current->result()) {
|
||||||
case Result::FAIL:
|
case Result::Fail:
|
||||||
case Result::MESSAGE_FATAL:
|
case Result::MessageFatal:
|
||||||
case Result::UNEXPECTED_PASS:
|
case Result::UnexpectedPass:
|
||||||
m_testResult->setResult(Result::MESSAGE_TEST_CASE_FAIL);
|
m_testResult->setResult(Result::MessageTestCaseFail);
|
||||||
return;
|
return;
|
||||||
case Result::EXPECTED_FAIL:
|
case Result::ExpectedFail:
|
||||||
case Result::MESSAGE_WARN:
|
case Result::MessageWarn:
|
||||||
case Result::SKIP:
|
case Result::Skip:
|
||||||
case Result::BLACKLISTED_FAIL:
|
case Result::BlacklistedFail:
|
||||||
case Result::BLACKLISTED_PASS:
|
case Result::BlacklistedPass:
|
||||||
newResult = Result::MESSAGE_TEST_CASE_WARN;
|
newResult = Result::MessageTestCaseWarn;
|
||||||
break;
|
break;
|
||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ QVariant TestResultModel::data(const QModelIndex &idx, int role) const
|
|||||||
|
|
||||||
void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
|
void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
|
||||||
{
|
{
|
||||||
const bool isCurrentTestMssg = testResult->result() == Result::MESSAGE_CURRENT_TEST;
|
const bool isCurrentTestMssg = testResult->result() == Result::MessageCurrentTest;
|
||||||
|
|
||||||
QVector<Utils::TreeItem *> topLevelItems = rootItem()->children();
|
QVector<Utils::TreeItem *> topLevelItems = rootItem()->children();
|
||||||
int lastRow = topLevelItems.size() - 1;
|
int lastRow = topLevelItems.size() - 1;
|
||||||
@@ -143,11 +143,11 @@ void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
|
|||||||
int count = m_testResultCount.value(testResult->result(), 0);
|
int count = m_testResultCount.value(testResult->result(), 0);
|
||||||
m_testResultCount.insert(testResult->result(), ++count);
|
m_testResultCount.insert(testResult->result(), ++count);
|
||||||
} else {
|
} else {
|
||||||
// MESSAGE_CURRENT_TEST should always be the last top level item
|
// MessageCurrentTest should always be the last top level item
|
||||||
if (lastRow >= 0) {
|
if (lastRow >= 0) {
|
||||||
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(lastRow));
|
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(lastRow));
|
||||||
const TestResult *result = current->testResult();
|
const TestResult *result = current->testResult();
|
||||||
if (result && result->result() == Result::MESSAGE_CURRENT_TEST) {
|
if (result && result->result() == Result::MessageCurrentTest) {
|
||||||
current->updateDescription(testResult->description());
|
current->updateDescription(testResult->description());
|
||||||
emit dataChanged(current->index(), current->index());
|
emit dataChanged(current->index(), current->index());
|
||||||
return;
|
return;
|
||||||
@@ -166,18 +166,18 @@ void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
|
|||||||
current->appendChild(newItem);
|
current->appendChild(newItem);
|
||||||
if (autoExpand)
|
if (autoExpand)
|
||||||
current->expand();
|
current->expand();
|
||||||
if (testResult->result() == Result::MESSAGE_TEST_CASE_END) {
|
if (testResult->result() == Result::MessageTestCaseEnd) {
|
||||||
current->updateResult();
|
current->updateResult();
|
||||||
emit dataChanged(current->index(), current->index());
|
emit dataChanged(current->index(), current->index());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we have a MESSAGE_CURRENT_TEST present, add the new top level item before it
|
// if we have a MessageCurrentTest present, add the new top level item before it
|
||||||
if (lastRow >= 0) {
|
if (lastRow >= 0) {
|
||||||
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(lastRow));
|
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(lastRow));
|
||||||
const TestResult *result = current->testResult();
|
const TestResult *result = current->testResult();
|
||||||
if (result && result->result() == Result::MESSAGE_CURRENT_TEST) {
|
if (result && result->result() == Result::MessageCurrentTest) {
|
||||||
rootItem()->insertChild(current->index().row(), newItem);
|
rootItem()->insertChild(current->index().row(), newItem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ void TestResultModel::removeCurrentTestMessage()
|
|||||||
QVector<Utils::TreeItem *> topLevelItems = rootItem()->children();
|
QVector<Utils::TreeItem *> topLevelItems = rootItem()->children();
|
||||||
for (int row = topLevelItems.size() - 1; row >= 0; --row) {
|
for (int row = topLevelItems.size() - 1; row >= 0; --row) {
|
||||||
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(row));
|
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(row));
|
||||||
if (current->testResult()->result() == Result::MESSAGE_CURRENT_TEST) {
|
if (current->testResult()->result() == Result::MessageCurrentTest) {
|
||||||
delete takeItem(current);
|
delete takeItem(current);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -272,14 +272,14 @@ TestResultFilterModel::TestResultFilterModel(TestResultModel *sourceModel, QObje
|
|||||||
|
|
||||||
void TestResultFilterModel::enableAllResultTypes()
|
void TestResultFilterModel::enableAllResultTypes()
|
||||||
{
|
{
|
||||||
m_enabled << Result::PASS << Result::FAIL << Result::EXPECTED_FAIL
|
m_enabled << Result::Pass << Result::Fail << Result::ExpectedFail
|
||||||
<< Result::UNEXPECTED_PASS << Result::SKIP << Result::MESSAGE_DEBUG
|
<< Result::UnexpectedPass << Result::Skip << Result::MessageDebug
|
||||||
<< Result::MESSAGE_WARN << Result::MESSAGE_INTERNAL
|
<< Result::MessageWarn << Result::MessageInternal
|
||||||
<< Result::MESSAGE_FATAL << Result::INVALID << Result::BLACKLISTED_PASS
|
<< Result::MessageFatal << Result::Invalid << Result::BlacklistedPass
|
||||||
<< Result::BLACKLISTED_FAIL << Result::BENCHMARK
|
<< Result::BlacklistedFail << Result::Benchmark
|
||||||
<< Result::MESSAGE_CURRENT_TEST << Result::MESSAGE_TEST_CASE_START
|
<< Result::MessageCurrentTest << Result::MessageTestCaseStart
|
||||||
<< Result::MESSAGE_TEST_CASE_SUCCESS << Result::MESSAGE_TEST_CASE_WARN
|
<< Result::MessageTestCaseSuccess << Result::MessageTestCaseWarn
|
||||||
<< Result::MESSAGE_TEST_CASE_FAIL << Result::MESSAGE_TEST_CASE_END;
|
<< Result::MessageTestCaseFail << Result::MessageTestCaseEnd;
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,12 +287,12 @@ void TestResultFilterModel::toggleTestResultType(Result::Type type)
|
|||||||
{
|
{
|
||||||
if (m_enabled.contains(type)) {
|
if (m_enabled.contains(type)) {
|
||||||
m_enabled.remove(type);
|
m_enabled.remove(type);
|
||||||
if (type == Result::MESSAGE_INTERNAL)
|
if (type == Result::MessageInternal)
|
||||||
m_enabled.remove(Result::MESSAGE_TEST_CASE_END);
|
m_enabled.remove(Result::MessageTestCaseEnd);
|
||||||
} else {
|
} else {
|
||||||
m_enabled.insert(type);
|
m_enabled.insert(type);
|
||||||
if (type == Result::MESSAGE_INTERNAL)
|
if (type == Result::MessageInternal)
|
||||||
m_enabled.insert(Result::MESSAGE_TEST_CASE_END);
|
m_enabled.insert(Result::MessageTestCaseEnd);
|
||||||
}
|
}
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
@@ -394,23 +394,23 @@ void TestResultsPane::initializeFilterMenu()
|
|||||||
const bool omitIntern = AutotestPlugin::instance()->settings()->omitInternalMssg;
|
const bool omitIntern = AutotestPlugin::instance()->settings()->omitInternalMssg;
|
||||||
// FilterModel has all messages enabled by default
|
// FilterModel has all messages enabled by default
|
||||||
if (omitIntern)
|
if (omitIntern)
|
||||||
m_filterModel->toggleTestResultType(Result::MESSAGE_INTERNAL);
|
m_filterModel->toggleTestResultType(Result::MessageInternal);
|
||||||
|
|
||||||
QMap<Result::Type, QString> textAndType;
|
QMap<Result::Type, QString> textAndType;
|
||||||
textAndType.insert(Result::PASS, tr("Pass"));
|
textAndType.insert(Result::Pass, tr("Pass"));
|
||||||
textAndType.insert(Result::FAIL, tr("Fail"));
|
textAndType.insert(Result::Fail, tr("Fail"));
|
||||||
textAndType.insert(Result::EXPECTED_FAIL, tr("Expected Fail"));
|
textAndType.insert(Result::ExpectedFail, tr("Expected Fail"));
|
||||||
textAndType.insert(Result::UNEXPECTED_PASS, tr("Unexpected Pass"));
|
textAndType.insert(Result::UnexpectedPass, tr("Unexpected Pass"));
|
||||||
textAndType.insert(Result::SKIP, tr("Skip"));
|
textAndType.insert(Result::Skip, tr("Skip"));
|
||||||
textAndType.insert(Result::BENCHMARK, tr("Benchmarks"));
|
textAndType.insert(Result::Benchmark, tr("Benchmarks"));
|
||||||
textAndType.insert(Result::MESSAGE_DEBUG, tr("Debug Messages"));
|
textAndType.insert(Result::MessageDebug, tr("Debug Messages"));
|
||||||
textAndType.insert(Result::MESSAGE_WARN, tr("Warning Messages"));
|
textAndType.insert(Result::MessageWarn, tr("Warning Messages"));
|
||||||
textAndType.insert(Result::MESSAGE_INTERNAL, tr("Internal Messages"));
|
textAndType.insert(Result::MessageInternal, tr("Internal Messages"));
|
||||||
foreach (Result::Type result, textAndType.keys()) {
|
foreach (Result::Type result, textAndType.keys()) {
|
||||||
QAction *action = new QAction(m_filterMenu);
|
QAction *action = new QAction(m_filterMenu);
|
||||||
action->setText(textAndType.value(result));
|
action->setText(textAndType.value(result));
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(result != Result::MESSAGE_INTERNAL || !omitIntern);
|
action->setChecked(result != Result::MessageInternal || !omitIntern);
|
||||||
action->setData(result);
|
action->setData(result);
|
||||||
m_filterMenu->addAction(action);
|
m_filterMenu->addAction(action);
|
||||||
}
|
}
|
||||||
@@ -425,22 +425,22 @@ void TestResultsPane::initializeFilterMenu()
|
|||||||
void TestResultsPane::updateSummaryLabel()
|
void TestResultsPane::updateSummaryLabel()
|
||||||
{
|
{
|
||||||
QString labelText = QString::fromLatin1("<p><b>Test summary:</b> %1 %2, %3 %4")
|
QString labelText = QString::fromLatin1("<p><b>Test summary:</b> %1 %2, %3 %4")
|
||||||
.arg(QString::number(m_model->resultTypeCount(Result::PASS)), tr("passes"),
|
.arg(QString::number(m_model->resultTypeCount(Result::Pass)), tr("passes"),
|
||||||
QString::number(m_model->resultTypeCount(Result::FAIL)), tr("fails"));
|
QString::number(m_model->resultTypeCount(Result::Fail)), tr("fails"));
|
||||||
int count = m_model->resultTypeCount(Result::UNEXPECTED_PASS);
|
int count = m_model->resultTypeCount(Result::UnexpectedPass);
|
||||||
if (count)
|
if (count)
|
||||||
labelText.append(QString::fromLatin1(", %1 %2")
|
labelText.append(QString::fromLatin1(", %1 %2")
|
||||||
.arg(QString::number(count), tr("unexpected passes")));
|
.arg(QString::number(count), tr("unexpected passes")));
|
||||||
count = m_model->resultTypeCount(Result::EXPECTED_FAIL);
|
count = m_model->resultTypeCount(Result::ExpectedFail);
|
||||||
if (count)
|
if (count)
|
||||||
labelText.append(QString::fromLatin1(", %1 %2")
|
labelText.append(QString::fromLatin1(", %1 %2")
|
||||||
.arg(QString::number(count), tr("expected fails")));
|
.arg(QString::number(count), tr("expected fails")));
|
||||||
count = m_model->resultTypeCount(Result::MESSAGE_FATAL);
|
count = m_model->resultTypeCount(Result::MessageFatal);
|
||||||
if (count)
|
if (count)
|
||||||
labelText.append(QString::fromLatin1(", %1 %2")
|
labelText.append(QString::fromLatin1(", %1 %2")
|
||||||
.arg(QString::number(count), tr("fatals")));
|
.arg(QString::number(count), tr("fatals")));
|
||||||
count = m_model->resultTypeCount(Result::BLACKLISTED_FAIL)
|
count = m_model->resultTypeCount(Result::BlacklistedFail)
|
||||||
+ m_model->resultTypeCount(Result::BLACKLISTED_PASS);
|
+ m_model->resultTypeCount(Result::BlacklistedPass);
|
||||||
if (count)
|
if (count)
|
||||||
labelText.append(QString::fromLatin1(", %1 %2")
|
labelText.append(QString::fromLatin1(", %1 %2")
|
||||||
.arg(QString::number(count), tr("blacklisted")));
|
.arg(QString::number(count), tr("blacklisted")));
|
||||||
|
@@ -114,7 +114,7 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
if (config->project()) {
|
if (config->project()) {
|
||||||
testCaseCount += config->testCaseCount();
|
testCaseCount += config->testCaseCount();
|
||||||
} else {
|
} else {
|
||||||
emitTestResultCreated(new FaultyTestResult(Result::MESSAGE_WARN,
|
emitTestResultCreated(new FaultyTestResult(Result::MessageWarn,
|
||||||
QObject::tr("Project is null for \"%1\". Removing from test run.\n"
|
QObject::tr("Project is null for \"%1\". Removing from test run.\n"
|
||||||
"Check the test environment.").arg(config->displayName())));
|
"Check the test environment.").arg(config->displayName())));
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
QProcessEnvironment environment = testConfiguration->environment().toProcessEnvironment();
|
QProcessEnvironment environment = testConfiguration->environment().toProcessEnvironment();
|
||||||
QString commandFilePath = executableFilePath(testConfiguration->targetFile(), environment);
|
QString commandFilePath = executableFilePath(testConfiguration->targetFile(), environment);
|
||||||
if (commandFilePath.isEmpty()) {
|
if (commandFilePath.isEmpty()) {
|
||||||
emitTestResultCreated(new FaultyTestResult(Result::MESSAGE_FATAL,
|
emitTestResultCreated(new FaultyTestResult(Result::MessageFatal,
|
||||||
QObject::tr("Could not find command \"%1\". (%2)")
|
QObject::tr("Could not find command \"%1\". (%2)")
|
||||||
.arg(testConfiguration->targetFile())
|
.arg(testConfiguration->targetFile())
|
||||||
.arg(testConfiguration->displayName())));
|
.arg(testConfiguration->displayName())));
|
||||||
@@ -177,7 +177,7 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
if (futureInterface.isCanceled()) {
|
if (futureInterface.isCanceled()) {
|
||||||
testProcess.kill();
|
testProcess.kill();
|
||||||
testProcess.waitForFinished();
|
testProcess.waitForFinished();
|
||||||
emitTestResultCreated(new FaultyTestResult(Result::MESSAGE_FATAL,
|
emitTestResultCreated(new FaultyTestResult(Result::MessageFatal,
|
||||||
QObject::tr("Test run canceled by user.")));
|
QObject::tr("Test run canceled by user.")));
|
||||||
}
|
}
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
@@ -188,7 +188,7 @@ void performTestRun(QFutureInterface<void> &futureInterface,
|
|||||||
if (testProcess.state() != QProcess::NotRunning) {
|
if (testProcess.state() != QProcess::NotRunning) {
|
||||||
testProcess.kill();
|
testProcess.kill();
|
||||||
testProcess.waitForFinished();
|
testProcess.waitForFinished();
|
||||||
emitTestResultCreated(new FaultyTestResult(Result::MESSAGE_FATAL, QObject::tr(
|
emitTestResultCreated(new FaultyTestResult(Result::MessageFatal, QObject::tr(
|
||||||
"Test case canceled due to timeout. \nMaybe raise the timeout?")));
|
"Test case canceled due to timeout. \nMaybe raise the timeout?")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,14 +208,14 @@ void TestRunner::prepareToRunTests()
|
|||||||
|
|
||||||
foreach (TestConfiguration *config, m_selectedTests) {
|
foreach (TestConfiguration *config, m_selectedTests) {
|
||||||
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
|
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
|
||||||
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MESSAGE_WARN,
|
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MessageWarn,
|
||||||
tr("Project's run configuration was guessed for \"%1\".\n"
|
tr("Project's run configuration was guessed for \"%1\".\n"
|
||||||
"This might cause trouble during execution.").arg(config->displayName())));
|
"This might cause trouble during execution.").arg(config->displayName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_selectedTests.empty()) {
|
if (m_selectedTests.empty()) {
|
||||||
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MESSAGE_WARN,
|
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MessageWarn,
|
||||||
tr("No tests selected. Canceling test run.")));
|
tr("No tests selected. Canceling test run.")));
|
||||||
onFinished();
|
onFinished();
|
||||||
return;
|
return;
|
||||||
@@ -223,7 +223,7 @@ void TestRunner::prepareToRunTests()
|
|||||||
|
|
||||||
ProjectExplorer::Project *project = m_selectedTests.at(0)->project();
|
ProjectExplorer::Project *project = m_selectedTests.at(0)->project();
|
||||||
if (!project) {
|
if (!project) {
|
||||||
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MESSAGE_WARN,
|
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MessageWarn,
|
||||||
tr("Project is null. Canceling test run.\n"
|
tr("Project is null. Canceling test run.\n"
|
||||||
"Only desktop kits are supported. Make sure the "
|
"Only desktop kits are supported. Make sure the "
|
||||||
"currently active kit is a desktop kit.")));
|
"currently active kit is a desktop kit.")));
|
||||||
@@ -239,7 +239,7 @@ void TestRunner::prepareToRunTests()
|
|||||||
if (project->hasActiveBuildSettings()) {
|
if (project->hasActiveBuildSettings()) {
|
||||||
buildProject(project);
|
buildProject(project);
|
||||||
} else {
|
} else {
|
||||||
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MESSAGE_FATAL,
|
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MessageFatal,
|
||||||
tr("Project is not configured. Canceling test run.")));
|
tr("Project is not configured. Canceling test run.")));
|
||||||
onFinished();
|
onFinished();
|
||||||
return;
|
return;
|
||||||
@@ -284,7 +284,7 @@ void TestRunner::buildFinished(bool success)
|
|||||||
if (success) {
|
if (success) {
|
||||||
runTests();
|
runTests();
|
||||||
} else {
|
} else {
|
||||||
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MESSAGE_FATAL,
|
TestResultsPane::instance()->addTestResult(new FaultyTestResult(Result::MessageFatal,
|
||||||
tr("Build failed. Canceling test run.")));
|
tr("Build failed. Canceling test run.")));
|
||||||
onFinished();
|
onFinished();
|
||||||
}
|
}
|
||||||
|
@@ -37,8 +37,8 @@ TestTreeItem::TestTreeItem(const QString &name, const QString &filePath, Type ty
|
|||||||
m_line(0)
|
m_line(0)
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case TEST_CLASS:
|
case TestClass:
|
||||||
case TEST_FUNCTION:
|
case TestFunction:
|
||||||
m_checked = Qt::Checked;
|
m_checked = Qt::Checked;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -82,14 +82,14 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
|
|||||||
{
|
{
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
if (m_type == ROOT && childCount() == 0)
|
if (m_type == Root && childCount() == 0)
|
||||||
return QString(m_name + QObject::tr(" (none)"));
|
return QString(m_name + QObject::tr(" (none)"));
|
||||||
else if (m_name.isEmpty())
|
else if (m_name.isEmpty())
|
||||||
return QObject::tr(Constants::UNNAMED_QUICKTESTS);
|
return QObject::tr(Constants::UNNAMED_QUICKTESTS);
|
||||||
else
|
else
|
||||||
return m_name;
|
return m_name;
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
if (m_type == TEST_CLASS && m_name.isEmpty()) {
|
if (m_type == TestClass && m_name.isEmpty()) {
|
||||||
return QObject::tr("<p>Give all test cases a name to ensure correct behavior "
|
return QObject::tr("<p>Give all test cases a name to ensure correct behavior "
|
||||||
"when running test cases and to be able to select them.</p>");
|
"when running test cases and to be able to select them.</p>");
|
||||||
}
|
}
|
||||||
@@ -98,14 +98,14 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
|
|||||||
return testTreeIcon(m_type);
|
return testTreeIcon(m_type);
|
||||||
case Qt::CheckStateRole:
|
case Qt::CheckStateRole:
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case ROOT:
|
case Root:
|
||||||
case TEST_DATAFUNCTION:
|
case TestDataFunction:
|
||||||
case TEST_SPECIALFUNCTION:
|
case TestSpecialFunction:
|
||||||
case TEST_DATATAG:
|
case TestDataTag:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
case TEST_CLASS:
|
case TestClass:
|
||||||
return m_name.isEmpty() ? QVariant() : checked();
|
return m_name.isEmpty() ? QVariant() : checked();
|
||||||
case TEST_FUNCTION:
|
case TestFunction:
|
||||||
if (parentItem() && parentItem()->name().isEmpty())
|
if (parentItem() && parentItem()->name().isEmpty())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
return checked();
|
return checked();
|
||||||
@@ -119,12 +119,12 @@ QVariant TestTreeItem::data(int /*column*/, int role) const
|
|||||||
}
|
}
|
||||||
case ItalicRole:
|
case ItalicRole:
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case TEST_DATAFUNCTION:
|
case TestDataFunction:
|
||||||
case TEST_SPECIALFUNCTION:
|
case TestSpecialFunction:
|
||||||
return true;
|
return true;
|
||||||
case TEST_CLASS:
|
case TestClass:
|
||||||
return m_name.isEmpty();
|
return m_name.isEmpty();
|
||||||
case TEST_FUNCTION:
|
case TestFunction:
|
||||||
return parentItem() ? parentItem()->name().isEmpty() : false;
|
return parentItem() ? parentItem()->name().isEmpty() : false;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -174,12 +174,12 @@ bool TestTreeItem::modifyContent(const TestTreeItem *modified)
|
|||||||
void TestTreeItem::setChecked(const Qt::CheckState checkState)
|
void TestTreeItem::setChecked(const Qt::CheckState checkState)
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case TEST_FUNCTION: {
|
case TestFunction: {
|
||||||
m_checked = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
|
m_checked = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
|
||||||
parentItem()->revalidateCheckState();
|
parentItem()->revalidateCheckState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TEST_CLASS: {
|
case TestClass: {
|
||||||
Qt::CheckState usedState = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
|
Qt::CheckState usedState = (checkState == Qt::Unchecked ? Qt::Unchecked : Qt::Checked);
|
||||||
for (int row = 0, count = childCount(); row < count; ++row)
|
for (int row = 0, count = childCount(); row < count; ++row)
|
||||||
childItem(row)->setChecked(usedState);
|
childItem(row)->setChecked(usedState);
|
||||||
@@ -193,11 +193,11 @@ void TestTreeItem::setChecked(const Qt::CheckState checkState)
|
|||||||
Qt::CheckState TestTreeItem::checked() const
|
Qt::CheckState TestTreeItem::checked() const
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case TEST_CLASS:
|
case TestClass:
|
||||||
case TEST_FUNCTION:
|
case TestFunction:
|
||||||
return m_checked;
|
return m_checked;
|
||||||
case TEST_DATAFUNCTION:
|
case TestDataFunction:
|
||||||
case TEST_SPECIALFUNCTION:
|
case TestSpecialFunction:
|
||||||
return Qt::Unchecked;
|
return Qt::Unchecked;
|
||||||
default:
|
default:
|
||||||
if (parent())
|
if (parent())
|
||||||
@@ -233,8 +233,8 @@ void TestTreeItem::revalidateCheckState()
|
|||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
for (int row = 0, count = childCount(); row < count; ++row) {
|
||||||
TestTreeItem *child = childItem(row);
|
TestTreeItem *child = childItem(row);
|
||||||
switch (child->type()) {
|
switch (child->type()) {
|
||||||
case TEST_DATAFUNCTION:
|
case TestDataFunction:
|
||||||
case TEST_SPECIALFUNCTION:
|
case TestSpecialFunction:
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@@ -42,16 +42,16 @@ class TestTreeItem : public Utils::TreeItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
ROOT,
|
Root,
|
||||||
TEST_CLASS,
|
TestClass,
|
||||||
TEST_FUNCTION,
|
TestFunction,
|
||||||
TEST_DATATAG,
|
TestDataTag,
|
||||||
TEST_DATAFUNCTION,
|
TestDataFunction,
|
||||||
TEST_SPECIALFUNCTION
|
TestSpecialFunction
|
||||||
};
|
};
|
||||||
|
|
||||||
TestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
TestTreeItem(const QString &name = QString(), const QString &filePath = QString(),
|
||||||
Type type = ROOT);
|
Type type = Root);
|
||||||
virtual ~TestTreeItem();
|
virtual ~TestTreeItem();
|
||||||
TestTreeItem(const TestTreeItem& other);
|
TestTreeItem(const TestTreeItem& other);
|
||||||
|
|
||||||
|
@@ -38,8 +38,8 @@ namespace Internal {
|
|||||||
|
|
||||||
TestTreeModel::TestTreeModel(QObject *parent) :
|
TestTreeModel::TestTreeModel(QObject *parent) :
|
||||||
TreeModel(parent),
|
TreeModel(parent),
|
||||||
m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::ROOT)),
|
m_autoTestRootItem(new TestTreeItem(tr("Auto Tests"), QString(), TestTreeItem::Root)),
|
||||||
m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::ROOT)),
|
m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::Root)),
|
||||||
m_parser(new TestCodeParser(this)),
|
m_parser(new TestCodeParser(this)),
|
||||||
m_connectionsInitialized(false)
|
m_connectionsInitialized(false)
|
||||||
{
|
{
|
||||||
@@ -134,11 +134,11 @@ bool TestTreeModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
if (role == Qt::CheckStateRole) {
|
if (role == Qt::CheckStateRole) {
|
||||||
switch (item->type()) {
|
switch (item->type()) {
|
||||||
case TestTreeItem::TEST_CLASS:
|
case TestTreeItem::TestClass:
|
||||||
if (item->childCount() > 0)
|
if (item->childCount() > 0)
|
||||||
emit dataChanged(index.child(0, 0), index.child(item->childCount() - 1, 0));
|
emit dataChanged(index.child(0, 0), index.child(item->childCount() - 1, 0));
|
||||||
break;
|
break;
|
||||||
case TestTreeItem::TEST_FUNCTION:
|
case TestTreeItem::TestFunction:
|
||||||
emit dataChanged(index.parent(), index.parent());
|
emit dataChanged(index.parent(), index.parent());
|
||||||
break;
|
break;
|
||||||
default: // avoid warning regarding unhandled enum member
|
default: // avoid warning regarding unhandled enum member
|
||||||
@@ -157,19 +157,19 @@ Qt::ItemFlags TestTreeModel::flags(const QModelIndex &index) const
|
|||||||
|
|
||||||
TestTreeItem *item = static_cast<TestTreeItem *>(itemForIndex(index));
|
TestTreeItem *item = static_cast<TestTreeItem *>(itemForIndex(index));
|
||||||
switch(item->type()) {
|
switch(item->type()) {
|
||||||
case TestTreeItem::TEST_CLASS:
|
case TestTreeItem::TestClass:
|
||||||
if (item->name().isEmpty())
|
if (item->name().isEmpty())
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsTristate | Qt::ItemIsUserCheckable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsTristate | Qt::ItemIsUserCheckable;
|
||||||
case TestTreeItem::TEST_FUNCTION:
|
case TestTreeItem::TestFunction:
|
||||||
if (item->parentItem()->name().isEmpty())
|
if (item->parentItem()->name().isEmpty())
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
|
||||||
case TestTreeItem::ROOT:
|
case TestTreeItem::Root:
|
||||||
return Qt::ItemIsEnabled;
|
return Qt::ItemIsEnabled;
|
||||||
case TestTreeItem::TEST_DATAFUNCTION:
|
case TestTreeItem::TestDataFunction:
|
||||||
case TestTreeItem::TEST_SPECIALFUNCTION:
|
case TestTreeItem::TestSpecialFunction:
|
||||||
case TestTreeItem::TEST_DATATAG:
|
case TestTreeItem::TestDataTag:
|
||||||
default:
|
default:
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ QList<TestConfiguration *> TestTreeModel::getSelectedTests() const
|
|||||||
int grandChildCount = child->childCount();
|
int grandChildCount = child->childCount();
|
||||||
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
|
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
|
||||||
const TestTreeItem *grandChild = child->childItem(grandChildRow);
|
const TestTreeItem *grandChild = child->childItem(grandChildRow);
|
||||||
if (grandChild->type() != TestTreeItem::TEST_FUNCTION)
|
if (grandChild->type() != TestTreeItem::TestFunction)
|
||||||
continue;
|
continue;
|
||||||
testFunctions << child->name() + QLatin1String("::") + grandChild->name();
|
testFunctions << child->name() + QLatin1String("::") + grandChild->name();
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
|
|||||||
|
|
||||||
TestConfiguration *config = 0;
|
TestConfiguration *config = 0;
|
||||||
switch (item->type()) {
|
switch (item->type()) {
|
||||||
case TestTreeItem::TEST_CLASS: {
|
case TestTreeItem::TestClass: {
|
||||||
if (item->parent() == m_quickTestRootItem) {
|
if (item->parent() == m_quickTestRootItem) {
|
||||||
// Quick Test TestCase
|
// Quick Test TestCase
|
||||||
QStringList testFunctions;
|
QStringList testFunctions;
|
||||||
@@ -374,7 +374,7 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TestTreeItem::TEST_FUNCTION: {
|
case TestTreeItem::TestFunction: {
|
||||||
const TestTreeItem *parent = item->parentItem();
|
const TestTreeItem *parent = item->parentItem();
|
||||||
if (parent->parent() == m_quickTestRootItem) {
|
if (parent->parent() == m_quickTestRootItem) {
|
||||||
// it's a Quick Test function of a named TestCase
|
// it's a Quick Test function of a named TestCase
|
||||||
@@ -390,7 +390,7 @@ TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TestTreeItem::TEST_DATATAG: {
|
case TestTreeItem::TestDataTag: {
|
||||||
const TestTreeItem *function = item->parentItem();
|
const TestTreeItem *function = item->parentItem();
|
||||||
const TestTreeItem *parent = function ? function->parentItem() : 0;
|
const TestTreeItem *parent = function ? function->parentItem() : 0;
|
||||||
if (!parent)
|
if (!parent)
|
||||||
@@ -489,7 +489,7 @@ void TestTreeModel::updateUnnamedQuickTest(const QString &mainFile,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!hasUnnamedQuickTests())
|
if (!hasUnnamedQuickTests())
|
||||||
addTestTreeItem(new TestTreeItem(QString(), QString(), TestTreeItem::TEST_CLASS), QuickTest);
|
addTestTreeItem(new TestTreeItem(QString(), QString(), TestTreeItem::TestClass), QuickTest);
|
||||||
|
|
||||||
TestTreeItem *unnamed = unnamedQuickTests();
|
TestTreeItem *unnamed = unnamedQuickTests();
|
||||||
foreach (const QString &functionName, functions.keys()) {
|
foreach (const QString &functionName, functions.keys()) {
|
||||||
@@ -730,7 +730,7 @@ bool TestTreeSortFilterModel::lessThan(const QModelIndex &left, const QModelInde
|
|||||||
{
|
{
|
||||||
// root items keep the intended order: 1st Auto Tests, 2nd Quick Tests
|
// root items keep the intended order: 1st Auto Tests, 2nd Quick Tests
|
||||||
const TestTreeItem *leftItem = static_cast<TestTreeItem *>(left.internalPointer());
|
const TestTreeItem *leftItem = static_cast<TestTreeItem *>(left.internalPointer());
|
||||||
if (leftItem->type() == TestTreeItem::ROOT)
|
if (leftItem->type() == TestTreeItem::Root)
|
||||||
return left.row() > right.row();
|
return left.row() > right.row();
|
||||||
|
|
||||||
const QString leftVal = m_sourceModel->data(left, Qt::DisplayRole).toString();
|
const QString leftVal = m_sourceModel->data(left, Qt::DisplayRole).toString();
|
||||||
@@ -775,9 +775,9 @@ bool TestTreeSortFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex
|
|||||||
const TestTreeItem *item = static_cast<TestTreeItem *>(index.internalPointer());
|
const TestTreeItem *item = static_cast<TestTreeItem *>(index.internalPointer());
|
||||||
|
|
||||||
switch (item->type()) {
|
switch (item->type()) {
|
||||||
case TestTreeItem::TEST_DATAFUNCTION:
|
case TestTreeItem::TestDataFunction:
|
||||||
return m_filterMode & ShowTestData;
|
return m_filterMode & ShowTestData;
|
||||||
case TestTreeItem::TEST_SPECIALFUNCTION:
|
case TestTreeItem::TestSpecialFunction:
|
||||||
return m_filterMode & ShowInitAndCleanup;
|
return m_filterMode & ShowInitAndCleanup;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
|
@@ -83,11 +83,11 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol)
|
|||||||
locationAndType.m_column = member->column() - 1;
|
locationAndType.m_column = member->column() - 1;
|
||||||
}
|
}
|
||||||
if (specialFunctions.contains(name))
|
if (specialFunctions.contains(name))
|
||||||
locationAndType.m_type = TestTreeItem::TEST_SPECIALFUNCTION;
|
locationAndType.m_type = TestTreeItem::TestSpecialFunction;
|
||||||
else if (name.endsWith(QLatin1String("_data")))
|
else if (name.endsWith(QLatin1String("_data")))
|
||||||
locationAndType.m_type = TestTreeItem::TEST_DATAFUNCTION;
|
locationAndType.m_type = TestTreeItem::TestDataFunction;
|
||||||
else
|
else
|
||||||
locationAndType.m_type = TestTreeItem::TEST_FUNCTION;
|
locationAndType.m_type = TestTreeItem::TestFunction;
|
||||||
m_privSlots.insert(name, locationAndType);
|
m_privSlots.insert(name, locationAndType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::CallAST *ast)
|
|||||||
locationAndType.m_name = QString::fromUtf8(token.spell());
|
locationAndType.m_name = QString::fromUtf8(token.spell());
|
||||||
locationAndType.m_column = column - 1;
|
locationAndType.m_column = column - 1;
|
||||||
locationAndType.m_line = line;
|
locationAndType.m_line = line;
|
||||||
locationAndType.m_type = TestTreeItem::TEST_DATATAG;
|
locationAndType.m_type = TestTreeItem::TestDataTag;
|
||||||
m_currentTags.append(locationAndType);
|
m_currentTags.append(locationAndType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ bool TestQmlVisitor::visit(QmlJS::AST::UiObjectDefinition *ast)
|
|||||||
m_testCaseLocation.m_name = m_currentDoc->fileName();
|
m_testCaseLocation.m_name = m_currentDoc->fileName();
|
||||||
m_testCaseLocation.m_line = sourceLocation.startLine;
|
m_testCaseLocation.m_line = sourceLocation.startLine;
|
||||||
m_testCaseLocation.m_column = sourceLocation.startColumn - 1;
|
m_testCaseLocation.m_column = sourceLocation.startColumn - 1;
|
||||||
m_testCaseLocation.m_type = TestTreeItem::TEST_CLASS;
|
m_testCaseLocation.m_type = TestTreeItem::TestClass;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,11 +322,11 @@ bool TestQmlVisitor::visit(QmlJS::AST::FunctionDeclaration *ast)
|
|||||||
locationAndType.m_line = sourceLocation.startLine;
|
locationAndType.m_line = sourceLocation.startLine;
|
||||||
locationAndType.m_column = sourceLocation.startColumn - 1;
|
locationAndType.m_column = sourceLocation.startColumn - 1;
|
||||||
if (specialFunctions.contains(name.toString()))
|
if (specialFunctions.contains(name.toString()))
|
||||||
locationAndType.m_type = TestTreeItem::TEST_SPECIALFUNCTION;
|
locationAndType.m_type = TestTreeItem::TestSpecialFunction;
|
||||||
else if (name.endsWith(QLatin1String("_data")))
|
else if (name.endsWith(QLatin1String("_data")))
|
||||||
locationAndType.m_type = TestTreeItem::TEST_DATAFUNCTION;
|
locationAndType.m_type = TestTreeItem::TestDataFunction;
|
||||||
else
|
else
|
||||||
locationAndType.m_type = TestTreeItem::TEST_FUNCTION;
|
locationAndType.m_type = TestTreeItem::TestFunction;
|
||||||
|
|
||||||
m_testFunctions.insert(name.toString(), locationAndType);
|
m_testFunctions.insert(name.toString(), locationAndType);
|
||||||
}
|
}
|
||||||
|
@@ -160,7 +160,7 @@ void TestXmlOutputReader::processOutput()
|
|||||||
static QString className;
|
static QString className;
|
||||||
static QString testCase;
|
static QString testCase;
|
||||||
static QString dataTag;
|
static QString dataTag;
|
||||||
static Result::Type result = Result::INVALID;
|
static Result::Type result = Result::Invalid;
|
||||||
static QString description;
|
static QString description;
|
||||||
static QString file;
|
static QString file;
|
||||||
static int lineNumber = 0;
|
static int lineNumber = 0;
|
||||||
@@ -184,14 +184,14 @@ void TestXmlOutputReader::processOutput()
|
|||||||
className = xmlReader.attributes().value(QStringLiteral("name")).toString();
|
className = xmlReader.attributes().value(QStringLiteral("name")).toString();
|
||||||
QTC_ASSERT(!className.isEmpty(), continue);
|
QTC_ASSERT(!className.isEmpty(), continue);
|
||||||
auto testResult = new TestResult(className);
|
auto testResult = new TestResult(className);
|
||||||
testResult->setResult(Result::MESSAGE_TEST_CASE_START);
|
testResult->setResult(Result::MessageTestCaseStart);
|
||||||
testResult->setDescription(tr("Executing test case %1").arg(className));
|
testResult->setDescription(tr("Executing test case %1").arg(className));
|
||||||
testResultCreated(testResult);
|
testResultCreated(testResult);
|
||||||
} else if (currentTag == QStringLiteral("TestFunction")) {
|
} else if (currentTag == QStringLiteral("TestFunction")) {
|
||||||
testCase = xmlReader.attributes().value(QStringLiteral("name")).toString();
|
testCase = xmlReader.attributes().value(QStringLiteral("name")).toString();
|
||||||
QTC_ASSERT(!testCase.isEmpty(), continue);
|
QTC_ASSERT(!testCase.isEmpty(), continue);
|
||||||
auto testResult = new TestResult();
|
auto testResult = new TestResult();
|
||||||
testResult->setResult(Result::MESSAGE_CURRENT_TEST);
|
testResult->setResult(Result::MessageCurrentTest);
|
||||||
testResult->setDescription(tr("Entering test function %1::%2").arg(className,
|
testResult->setDescription(tr("Entering test function %1::%2").arg(className,
|
||||||
testCase));
|
testCase));
|
||||||
testResultCreated(testResult);
|
testResultCreated(testResult);
|
||||||
@@ -204,7 +204,7 @@ void TestXmlOutputReader::processOutput()
|
|||||||
description.clear();
|
description.clear();
|
||||||
duration.clear();
|
duration.clear();
|
||||||
file.clear();
|
file.clear();
|
||||||
result = Result::INVALID;
|
result = Result::Invalid;
|
||||||
lineNumber = 0;
|
lineNumber = 0;
|
||||||
const QXmlStreamAttributes &attributes = xmlReader.attributes();
|
const QXmlStreamAttributes &attributes = xmlReader.attributes();
|
||||||
result = TestResult::resultFromString(
|
result = TestResult::resultFromString(
|
||||||
@@ -220,19 +220,19 @@ void TestXmlOutputReader::processOutput()
|
|||||||
const double value = attributes.value(QStringLiteral("value")).toDouble();
|
const double value = attributes.value(QStringLiteral("value")).toDouble();
|
||||||
const int iterations = attributes.value(QStringLiteral("iterations")).toInt();
|
const int iterations = attributes.value(QStringLiteral("iterations")).toInt();
|
||||||
description = constructBenchmarkInformation(metric, value, iterations);
|
description = constructBenchmarkInformation(metric, value, iterations);
|
||||||
result = Result::BENCHMARK;
|
result = Result::Benchmark;
|
||||||
} else if (currentTag == QStringLiteral("DataTag")) {
|
} else if (currentTag == QStringLiteral("DataTag")) {
|
||||||
cdataMode = DataTag;
|
cdataMode = DataTag;
|
||||||
} else if (currentTag == QStringLiteral("Description")) {
|
} else if (currentTag == QStringLiteral("Description")) {
|
||||||
cdataMode = Description;
|
cdataMode = Description;
|
||||||
} else if (currentTag == QStringLiteral("QtVersion")) {
|
} else if (currentTag == QStringLiteral("QtVersion")) {
|
||||||
result = Result::MESSAGE_INTERNAL;
|
result = Result::MessageInternal;
|
||||||
cdataMode = QtVersion;
|
cdataMode = QtVersion;
|
||||||
} else if (currentTag == QStringLiteral("QtBuild")) {
|
} else if (currentTag == QStringLiteral("QtBuild")) {
|
||||||
result = Result::MESSAGE_INTERNAL;
|
result = Result::MessageInternal;
|
||||||
cdataMode = QtBuild;
|
cdataMode = QtBuild;
|
||||||
} else if (currentTag == QStringLiteral("QTestVersion")) {
|
} else if (currentTag == QStringLiteral("QTestVersion")) {
|
||||||
result = Result::MESSAGE_INTERNAL;
|
result = Result::MessageInternal;
|
||||||
cdataMode = QTestVersion;
|
cdataMode = QTestVersion;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -277,14 +277,14 @@ void TestXmlOutputReader::processOutput()
|
|||||||
if (!duration.isEmpty()) {
|
if (!duration.isEmpty()) {
|
||||||
auto testResult = new TestResult(className);
|
auto testResult = new TestResult(className);
|
||||||
testResult->setTestCase(testCase);
|
testResult->setTestCase(testCase);
|
||||||
testResult->setResult(Result::MESSAGE_INTERNAL);
|
testResult->setResult(Result::MessageInternal);
|
||||||
testResult->setDescription(tr("Execution took %1 ms.").arg(duration));
|
testResult->setDescription(tr("Execution took %1 ms.").arg(duration));
|
||||||
testResultCreated(testResult);
|
testResultCreated(testResult);
|
||||||
}
|
}
|
||||||
emit increaseProgress();
|
emit increaseProgress();
|
||||||
} else if (currentTag == QStringLiteral("TestCase") && !duration.isEmpty()) {
|
} else if (currentTag == QStringLiteral("TestCase") && !duration.isEmpty()) {
|
||||||
auto testResult = new TestResult(className);
|
auto testResult = new TestResult(className);
|
||||||
testResult->setResult(Result::MESSAGE_TEST_CASE_END);
|
testResult->setResult(Result::MessageTestCaseEnd);
|
||||||
testResult->setDescription(tr("Test execution took %1 ms.").arg(duration));
|
testResult->setDescription(tr("Test execution took %1 ms.").arg(duration));
|
||||||
testResultCreated(testResult);
|
testResultCreated(testResult);
|
||||||
} else if (validEndTags.contains(currentTag.toString())) {
|
} else if (validEndTags.contains(currentTag.toString())) {
|
||||||
|
Reference in New Issue
Block a user