forked from qt-creator/qt-creator
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 <christian.stenger@qt.io>
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
@@ -63,11 +64,33 @@ public:
|
|||||||
ProjectExplorer::FileType::Source, false);
|
ProjectExplorer::FileType::Source, false);
|
||||||
root->addNode(std::move(fileNode));
|
root->addNode(std::move(fileNode));
|
||||||
setRootProjectNode(std::move(root));
|
setRootProjectNode(std::move(root));
|
||||||
|
setDisplayName(file.toString());
|
||||||
|
setId("QmlProfilerDetailsRewriterTest.DummyProject");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsConfiguration() const final { return false; }
|
bool needsConfiguration() const final { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DummyBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *) const final
|
||||||
|
{
|
||||||
|
return QList<ProjectExplorer::BuildInfo *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *,
|
||||||
|
const QString &) const final
|
||||||
|
{
|
||||||
|
return QList<ProjectExplorer::BuildInfo *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
int priority(const ProjectExplorer::Kit *, const QString &) const final
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
QmlProfilerDetailsRewriterTest::QmlProfilerDetailsRewriterTest(QObject *parent) : QObject(parent)
|
QmlProfilerDetailsRewriterTest::QmlProfilerDetailsRewriterTest(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
connect(&m_rewriter, &QmlProfilerDetailsRewriter::eventDetailsChanged,
|
connect(&m_rewriter, &QmlProfilerDetailsRewriter::eventDetailsChanged,
|
||||||
@@ -78,6 +101,9 @@ QmlProfilerDetailsRewriterTest::QmlProfilerDetailsRewriterTest(QObject *parent)
|
|||||||
|
|
||||||
void QmlProfilerDetailsRewriterTest::testMissingModelManager()
|
void QmlProfilerDetailsRewriterTest::testMissingModelManager()
|
||||||
{
|
{
|
||||||
|
DummyBuildConfigurationFactory factory;
|
||||||
|
Q_UNUSED(factory);
|
||||||
|
|
||||||
seedRewriter();
|
seedRewriter();
|
||||||
delete m_modelManager;
|
delete m_modelManager;
|
||||||
m_modelManager = nullptr;
|
m_modelManager = nullptr;
|
||||||
@@ -99,6 +125,9 @@ void QmlProfilerDetailsRewriterTest::testMissingModelManager()
|
|||||||
|
|
||||||
void QmlProfilerDetailsRewriterTest::testRequestDetailsForLocation()
|
void QmlProfilerDetailsRewriterTest::testRequestDetailsForLocation()
|
||||||
{
|
{
|
||||||
|
DummyBuildConfigurationFactory factory;
|
||||||
|
Q_UNUSED(factory);
|
||||||
|
|
||||||
seedRewriter();
|
seedRewriter();
|
||||||
QVERIFY(!m_rewriterDone);
|
QVERIFY(!m_rewriterDone);
|
||||||
bool found1 = false;
|
bool found1 = false;
|
||||||
@@ -147,6 +176,9 @@ void QmlProfilerDetailsRewriterTest::testRequestDetailsForLocation()
|
|||||||
|
|
||||||
void QmlProfilerDetailsRewriterTest::testGetLocalFile()
|
void QmlProfilerDetailsRewriterTest::testGetLocalFile()
|
||||||
{
|
{
|
||||||
|
DummyBuildConfigurationFactory factory;
|
||||||
|
Q_UNUSED(factory);
|
||||||
|
|
||||||
seedRewriter();
|
seedRewriter();
|
||||||
QCOMPARE(m_rewriter.getLocalFile("notthere.qml"), QString());
|
QCOMPARE(m_rewriter.getLocalFile("notthere.qml"), QString());
|
||||||
QCOMPARE(m_rewriter.getLocalFile("Test.qml"),
|
QCOMPARE(m_rewriter.getLocalFile("Test.qml"),
|
||||||
|
|||||||
Reference in New Issue
Block a user