Fix running the dialognativetest without installing
Reviewed by David Edmundson
This commit is contained in:
parent
0e859870a9
commit
72ff860ef0
@ -20,10 +20,38 @@
|
|||||||
#include "dialognativetest.h"
|
#include "dialognativetest.h"
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
|
|
||||||
|
void copyPath(const QString &src, const QString &dst)
|
||||||
|
{
|
||||||
|
QDir dir(src);
|
||||||
|
Q_ASSERT(dir.exists());
|
||||||
|
|
||||||
|
foreach (const auto &d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||||
|
QString dst_path = dst + QLatin1Char('/') + d;
|
||||||
|
dir.mkpath(dst_path);
|
||||||
|
copyPath(src + QLatin1Char('/') + d, dst_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const auto &f, dir.entryList(QDir::Files)) {
|
||||||
|
QFile::copy(src + QLatin1Char('/') + f, dst + QLatin1Char('/') + f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogNativeTest::initTestCase()
|
void DialogNativeTest::initTestCase()
|
||||||
{
|
{
|
||||||
QStandardPaths::setTestModeEnabled(true);
|
QStandardPaths::setTestModeEnabled(true);
|
||||||
|
{
|
||||||
|
const auto qttestPath = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).constFirst();
|
||||||
|
Q_ASSERT(!qttestPath.isEmpty());
|
||||||
|
QDir themePath(qttestPath + QLatin1String("/plasma/desktoptheme/default"));
|
||||||
|
|
||||||
|
auto data = QFINDTESTDATA("../src/desktoptheme/breeze/metadata.desktop");
|
||||||
|
QFileInfo f(data);
|
||||||
|
QVERIFY(f.dir().mkpath(themePath.path()));
|
||||||
|
|
||||||
|
copyPath(f.dir().filePath("default.gzipped"), themePath.path());
|
||||||
|
QFile::copy(f.dir().filePath("metadata.desktop"), themePath.filePath("metadata.desktop"));
|
||||||
|
}
|
||||||
|
|
||||||
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
m_cacheDir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
||||||
m_cacheDir.removeRecursively();
|
m_cacheDir.removeRecursively();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user