blob: af0a6eaa46c4f068b882566228b57041ef4fc52d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "gtestframework.h"
#include "../autotesttr.h"
#include "gtesttreeitem.h"
#include "gtestparser.h"
#include <QRegularExpression>
namespace Autotest {
namespace Internal {
static GTestSettings *g_settings;
GTestFramework::GTestFramework()
: ITestFramework(true)
{
g_settings = &m_settings;
}
ITestParser *GTestFramework::createTestParser()
{
return new GTestParser(this);
}
ITestTreeItem *GTestFramework::createRootNode()
{
return new GTestTreeItem(this, displayName(), {}, ITestTreeItem::Root);
}
const char *GTestFramework::name() const
{
return GTest::Constants::FRAMEWORK_NAME;
}
QString GTestFramework:: displayName() const
{
return Tr::tr(GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY);
}
unsigned GTestFramework::priority() const
{
return GTest::Constants::FRAMEWORK_PRIORITY;
}
QString GTestFramework::currentGTestFilter()
{
return g_settings->gtestFilter.value();
}
QString GTestFramework::groupingToolTip() const
{
return Tr::tr("Enable or disable grouping of test cases by folder or "
"GTest filter.\nSee also Google Test settings.");
}
GTest::Constants::GroupMode GTestFramework::groupMode()
{
return GTest::Constants::GroupMode(g_settings->groupMode.itemValue().toInt());
}
QStringList GTestFramework::testNameForSymbolName(const QString &symbolName) const
{
static const QRegularExpression r("^(.+::)?((DISABLED_)?.+?)_((DISABLED_)?.+)_Test::TestBody$");
const QRegularExpressionMatch match = r.match(symbolName);
if (!match.hasMatch())
return {};
return { match.captured(2), match.captured(4) };
}
} // namespace Internal
} // namespace Autotest
|