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/session.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
#include <QLibraryInfo>
|
||||
#include <QTest>
|
||||
@@ -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<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)
|
||||
{
|
||||
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"),
|
||||
|
||||
Reference in New Issue
Block a user