blob: d5ffc26038fbc8a09ecfd51d10686a6d5fd3f7b9 (
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
|
// 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 "quicktest_utils.h"
#include "../testframeworkmanager.h"
#include "../testtreeitem.h"
#include <utils/qtcassert.h>
#include <QByteArrayList>
using namespace Utils;
namespace Autotest {
namespace Internal {
namespace QuickTestUtils {
bool isQuickTestMacro(const QByteArray ¯o)
{
static const QByteArrayList valid = {"QUICK_TEST_MAIN", "QUICK_TEST_OPENGL_MAIN",
"QUICK_TEST_MAIN_WITH_SETUP"};
return valid.contains(macro);
}
QHash<FilePath, FilePath> proFilesForQmlFiles(ITestFramework *framework,
const QSet<FilePath> &files)
{
QHash<FilePath, FilePath> result;
TestTreeItem *rootNode = framework->rootNode();
QTC_ASSERT(rootNode, return result);
if (files.isEmpty())
return result;
rootNode->forFirstLevelChildItems([&result, &files](TestTreeItem *child) {
const FilePath &file = child->filePath();
if (!file.isEmpty() && files.contains(file)) {
const FilePath &proFile = child->proFile();
if (!proFile.isEmpty())
result.insert(file, proFile);
}
child->forFirstLevelChildItems([&result, &files](TestTreeItem *grandChild) {
const FilePath &file = grandChild->filePath();
if (!file.isEmpty() && files.contains(file)) {
const FilePath &proFile = grandChild->proFile();
if (!proFile.isEmpty())
result.insert(file, proFile);
}
});
});
return result;
}
} // namespace QuickTestUtils
} // namespace Internal
} // namespace Autotest
|