From 4f3e1b60245cdfad203f931d95fd89ce3e2c7862 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 25 May 2018 13:24:03 +0200 Subject: [PATCH] QmlProfiler: Avoid soft asserts and warnings in details rewriter test ProjectExplorer::Project wants an ID and a displayName, and Target wants an IBuildConfigurationFactory that returns a priority >= 0. Give them what they want. Change-Id: Iab539d183669729d0e57505143b462ffa92730ad Reviewed-by: Christian Stenger --- .../tests/qmlprofilerdetailsrewriter_test.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp index f4e9d0e00db..830f1a1e613 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerdetailsrewriter_test.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -63,11 +64,33 @@ public: ProjectExplorer::FileType::Source, false); root->addNode(std::move(fileNode)); setRootProjectNode(std::move(root)); + setDisplayName(file.toString()); + setId("QmlProfilerDetailsRewriterTest.DummyProject"); } bool needsConfiguration() const final { return false; } }; +class DummyBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory +{ +public: + QList availableBuilds(const ProjectExplorer::Target *) const final + { + return QList(); + } + + QList availableSetups(const ProjectExplorer::Kit *, + const QString &) const final + { + return QList(); + } + + int priority(const ProjectExplorer::Kit *, const QString &) const final + { + return 0; + } +}; + QmlProfilerDetailsRewriterTest::QmlProfilerDetailsRewriterTest(QObject *parent) : QObject(parent) { connect(&m_rewriter, &QmlProfilerDetailsRewriter::eventDetailsChanged, @@ -78,6 +101,9 @@ QmlProfilerDetailsRewriterTest::QmlProfilerDetailsRewriterTest(QObject *parent) void QmlProfilerDetailsRewriterTest::testMissingModelManager() { + DummyBuildConfigurationFactory factory; + Q_UNUSED(factory); + seedRewriter(); delete m_modelManager; m_modelManager = nullptr; @@ -99,6 +125,9 @@ void QmlProfilerDetailsRewriterTest::testMissingModelManager() void QmlProfilerDetailsRewriterTest::testRequestDetailsForLocation() { + DummyBuildConfigurationFactory factory; + Q_UNUSED(factory); + seedRewriter(); QVERIFY(!m_rewriterDone); bool found1 = false; @@ -147,6 +176,9 @@ void QmlProfilerDetailsRewriterTest::testRequestDetailsForLocation() void QmlProfilerDetailsRewriterTest::testGetLocalFile() { + DummyBuildConfigurationFactory factory; + Q_UNUSED(factory); + seedRewriter(); QCOMPARE(m_rewriter.getLocalFile("notthere.qml"), QString()); QCOMPARE(m_rewriter.getLocalFile("Test.qml"),