QmlProfiler: Use a predictable kit in the QmlProfilerTool test

We may not have a valid kit at all, and then the test would fail.

Change-Id: Ie2613e67309121f0df847e76668bc433fd88c315
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2018-02-19 09:49:40 +01:00
parent 38064c97b0
commit 41017d1bbd

View File

@@ -26,6 +26,9 @@
#include "qmlprofilertool_test.h"
#include "fakedebugserver.h"
#include <coreplugin/icore.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitmanager.h>
#include <projectexplorer/runconfiguration.h>
#include <qmlprofiler/qmlprofilerattachdialog.h>
#include <qmlprofiler/qmlprofilerclientmanager.h>
@@ -41,6 +44,14 @@ namespace Internal {
void QmlProfilerToolTest::testAttachToWaitingApplication()
{
ProjectExplorer::Kit *newKit = new ProjectExplorer::Kit("fookit");
ProjectExplorer::KitManager *kitManager = ProjectExplorer::KitManager::instance();
QVERIFY(kitManager);
QVERIFY(kitManager->registerKit(newKit));
QSettings *settings = Core::ICore::settings();
QVERIFY(settings);
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), newKit->id().toSetting());
QmlProfilerTool profilerTool;
QTcpServer server;
QUrl serverUrl = Utils::urlFromLocalHostAndFreePort();