Fix ProjectExplorerPlugin::testProject_setup()

The absolute test paths must be in the right format for the host
platform, i.e. have a drive letter on Windows.

Change-Id: Ibf08a9e8a8b1f9ee1bb19d5307205b53012049b5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2019-01-23 15:12:21 +01:00
parent de8ef0c066
commit e5a5d38c20

View File

@@ -912,15 +912,25 @@ void Project::setPreferredKitPredicate(const Kit::Predicate &predicate)
} // namespace ProjectExplorer } // namespace ProjectExplorer
#include <utils/hostosinfo.h>
#include <QTest> #include <QTest>
#include <QSignalSpy> #include <QSignalSpy>
namespace ProjectExplorer { namespace ProjectExplorer {
const Utils::FileName TEST_PROJECT_PATH = Utils::FileName::fromString("/tmp/foobar/baz.project"); static Utils::FileName constructTestPath(const char *basePath)
const Utils::FileName TEST_PROJECT_NONEXISTING_FILE = Utils::FileName::fromString("/tmp/foobar/nothing.cpp"); {
const Utils::FileName TEST_PROJECT_CPP_FILE = Utils::FileName::fromString("/tmp/foobar/main.cpp"); Utils::FileName drive;
const Utils::FileName TEST_PROJECT_GENERATED_FILE = Utils::FileName::fromString("/tmp/foobar/generated.foo"); if (Utils::HostOsInfo::isWindowsHost())
drive = Utils::FileName::fromString("C:");
return drive + QLatin1String(basePath);
}
const Utils::FileName TEST_PROJECT_PATH = constructTestPath("/tmp/foobar/baz.project");
const Utils::FileName TEST_PROJECT_NONEXISTING_FILE = constructTestPath("/tmp/foobar/nothing.cpp");
const Utils::FileName TEST_PROJECT_CPP_FILE = constructTestPath("/tmp/foobar/main.cpp");
const Utils::FileName TEST_PROJECT_GENERATED_FILE = constructTestPath("/tmp/foobar/generated.foo");
const QString TEST_PROJECT_MIMETYPE = "application/vnd.test.qmakeprofile"; const QString TEST_PROJECT_MIMETYPE = "application/vnd.test.qmakeprofile";
const QString TEST_PROJECT_DISPLAYNAME = "testProjectFoo"; const QString TEST_PROJECT_DISPLAYNAME = "testProjectFoo";
const char TEST_PROJECT_ID[] = "Test.Project.Id"; const char TEST_PROJECT_ID[] = "Test.Project.Id";