diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-12 16:46:03 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-13 14:00:29 +0000 |
commit | 468521b062ce4c4769cce0dfac16850ac6939ac0 (patch) | |
tree | a1ed14f69859316472b554527583d4ffb399802e /src/plugins/qmlprofiler/tests | |
parent | 6361152de2cca0515a38f39832f37aad9b0f6d62 (diff) |
QmlProfiler: Add test for attach dialog
Change-Id: I040ef23f780e361037386a92444fcf45aded7a3f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/tests')
-rw-r--r-- | src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.cpp | 64 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.h | 45 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/tests/tests.pri | 6 |
3 files changed, 113 insertions, 2 deletions
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.cpp new file mode 100644 index 00000000000..8571207bf5f --- /dev/null +++ b/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.cpp @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** 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 "qmlprofilerattachdialog_test.h" +#include "projectexplorer/kitmanager.h" +#include "projectexplorer/kit.h" +#include <QtTest> + +namespace QmlProfiler { +namespace Internal { + +QmlProfilerAttachDialogTest::QmlProfilerAttachDialogTest(QObject *parent) : QObject(parent) +{ +} + +void QmlProfilerAttachDialogTest::testAccessors() +{ + QmlProfilerAttachDialog dialog; + + int port = dialog.port(); + QVERIFY(port >= 0); + QVERIFY(port < 65536); + + dialog.setPort(4444); + QCOMPARE(dialog.port(), 4444); + + ProjectExplorer::Kit *kit = dialog.kit(); + QVERIFY(kit); + + ProjectExplorer::Kit *newKit = new ProjectExplorer::Kit("dings"); + ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance(); + QVERIFY(kitManager); + QVERIFY(kitManager->registerKit(newKit)); + + dialog.setKitId("dings"); + QCOMPARE(dialog.kit(), newKit); + + kitManager->deregisterKit(newKit); +} + +} // namespace Internal +} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.h b/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.h new file mode 100644 index 00000000000..d6ff7bab550 --- /dev/null +++ b/src/plugins/qmlprofiler/tests/qmlprofilerattachdialog_test.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#pragma once + +#include <qmlprofiler/qmlprofilerattachdialog.h> +#include <QObject> + +namespace QmlProfiler { +namespace Internal { + +class QmlProfilerAttachDialogTest : public QObject +{ + Q_OBJECT +public: + explicit QmlProfilerAttachDialogTest(QObject *parent = 0); + +private slots: + void testAccessors(); +}; + +} // namespace Internal +} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/tests/tests.pri b/src/plugins/qmlprofiler/tests/tests.pri index 84a8b2e5ecc..983a5cbe70e 100644 --- a/src/plugins/qmlprofiler/tests/tests.pri +++ b/src/plugins/qmlprofiler/tests/tests.pri @@ -11,7 +11,8 @@ SOURCES += \ $$PWD/qmleventlocation_test.cpp \ $$PWD/qmleventtype_test.cpp \ $$PWD/qmlnote_test.cpp \ - $$PWD/qmlprofileranimationsmodel_test.cpp + $$PWD/qmlprofileranimationsmodel_test.cpp \ + $$PWD/qmlprofilerattachdialog_test.cpp HEADERS += \ $$PWD/debugmessagesmodel_test.h \ @@ -26,4 +27,5 @@ HEADERS += \ $$PWD/qmleventlocation_test.h \ $$PWD/qmleventtype_test.h \ $$PWD/qmlnote_test.h \ - $$PWD/qmlprofileranimationsmodel_test.h + $$PWD/qmlprofileranimationsmodel_test.h \ + $$PWD/qmlprofilerattachdialog_test.h |