diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-11-14 11:15:40 +0200 |
---|---|---|
committer | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2016-11-14 11:17:13 +0200 |
commit | 9c09ca9e42c7a7f39bf279adcb14ae1691a409bc (patch) | |
tree | 4a3e10324aa97692fb57e13d4a9870edc7d3e35b /src/plugins/autotest/quick | |
parent | 1a2f649b70c67380d29cdececbce3fad1b97dfca (diff) | |
parent | b5f587efb540cff5f51052a6e30be3139d8b930d (diff) | |
download | qt-creator-9c09ca9e42c7a7f39bf279adcb14ae1691a409bc.tar.gz |
Merge remote-tracking branch 'origin/4.2'
Change-Id: Ia98031eb87f1859c3736faa0cdd8b655e8a50689
Diffstat (limited to 'src/plugins/autotest/quick')
-rw-r--r-- | src/plugins/autotest/quick/quicktest_utils.cpp | 77 | ||||
-rw-r--r-- | src/plugins/autotest/quick/quicktest_utils.h | 49 |
2 files changed, 83 insertions, 43 deletions
diff --git a/src/plugins/autotest/quick/quicktest_utils.cpp b/src/plugins/autotest/quick/quicktest_utils.cpp new file mode 100644 index 0000000000..2e7c4f1594 --- /dev/null +++ b/src/plugins/autotest/quick/quicktest_utils.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#include "quicktest_utils.h" +#include "../testframeworkmanager.h" +#include "../testtreeitem.h" + +#include <utils/qtcassert.h> + +#include <QByteArrayList> + +namespace Autotest { +namespace Internal { +namespace QuickTestUtils { + +static const QByteArrayList valid = {"QUICK_TEST_MAIN", "QUICK_TEST_OPENGL_MAIN"}; + +bool isQuickTestMacro(const QByteArray ¯o) +{ + return valid.contains(macro); +} + +QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files) +{ + QHash<QString, QString> result; + TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); + QTC_ASSERT(rootNode, return result); + + if (files.isEmpty()) + return result; + + for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { + const TestTreeItem *child = rootNode->childItem(row); + const QString &file = child->filePath(); + if (!file.isEmpty() && files.contains(file)) { + const QString &proFile = child->proFile(); + if (!proFile.isEmpty()) + result.insert(file, proFile); + } + for (int subRow = 0, subCount = child->childCount(); subRow < subCount; ++subRow) { + const TestTreeItem *grandChild = child->childItem(subRow); + const QString &file = grandChild->filePath(); + if (!file.isEmpty() && files.contains(file)) { + const QString &proFile = grandChild->proFile(); + if (!proFile.isEmpty()) + result.insert(file, proFile); + } + } + } + return result; +} + +} // namespace QuickTestUtils +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/quick/quicktest_utils.h b/src/plugins/autotest/quick/quicktest_utils.h index f7a17ad538..af5cfdb7bf 100644 --- a/src/plugins/autotest/quick/quicktest_utils.h +++ b/src/plugins/autotest/quick/quicktest_utils.h @@ -25,54 +25,17 @@ #pragma once -#include "../testframeworkmanager.h" +#include <QHash> -#include <utils/qtcassert.h> - -#include <QByteArrayList> +namespace Core { class Id; } namespace Autotest { namespace Internal { +namespace QuickTestUtils { -class QuickTestUtils -{ -public: - static bool isQuickTestMacro(const QByteArray ¯o) - { - static const QByteArrayList valid = {"QUICK_TEST_MAIN", "QUICK_TEST_OPENGL_MAIN"}; - return valid.contains(macro); - } - - static QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files) - { - QHash<QString, QString> result; - TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id); - QTC_ASSERT(rootNode, return result); - - if (files.isEmpty()) - return result; - - for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) { - const TestTreeItem *child = rootNode->childItem(row); - const QString &file = child->filePath(); - if (!file.isEmpty() && files.contains(file)) { - const QString &proFile = child->proFile(); - if (!proFile.isEmpty()) - result.insert(file, proFile); - } - for (int subRow = 0, subCount = child->childCount(); subRow < subCount; ++subRow) { - const TestTreeItem *grandChild = child->childItem(subRow); - const QString &file = grandChild->filePath(); - if (!file.isEmpty() && files.contains(file)) { - const QString &proFile = grandChild->proFile(); - if (!proFile.isEmpty()) - result.insert(file, proFile); - } - } - } - return result; - } -}; +bool isQuickTestMacro(const QByteArray ¯o); +QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringList &files); +} // namespace QuickTestUtils } // namespace Internal } // namespace Autotest |