Fix tst_qstandardpaths: Mac OSX is a unix, but doesn't use XDG.
Change-Id: I2b4552a162dc9f993e0587ace6e7e3fb4f96571e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
141dbaf496
commit
ae6e7e3d59
@ -50,6 +50,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||||
|
#define Q_XDG_PLATFORM
|
||||||
|
#endif
|
||||||
|
|
||||||
//TESTED_CLASS=QStandardPaths
|
//TESTED_CLASS=QStandardPaths
|
||||||
//TESTED_FILES=qstandardpaths.cpp
|
//TESTED_FILES=qstandardpaths.cpp
|
||||||
|
|
||||||
@ -91,7 +95,7 @@ private:
|
|||||||
|
|
||||||
void tst_qstandardpaths::testDefaultLocations()
|
void tst_qstandardpaths::testDefaultLocations()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_WIN
|
#ifdef Q_XDG_PLATFORM
|
||||||
qputenv("XDG_CONFIG_HOME", QByteArray());
|
qputenv("XDG_CONFIG_HOME", QByteArray());
|
||||||
qputenv("XDG_CONFIG_DIRS", QByteArray());
|
qputenv("XDG_CONFIG_DIRS", QByteArray());
|
||||||
const QString expectedConfHome = QDir::homePath() + QString::fromLatin1("/.config");
|
const QString expectedConfHome = QDir::homePath() + QString::fromLatin1("/.config");
|
||||||
@ -113,7 +117,7 @@ void tst_qstandardpaths::testDefaultLocations()
|
|||||||
|
|
||||||
void tst_qstandardpaths::testCustomLocations()
|
void tst_qstandardpaths::testCustomLocations()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_WIN
|
#ifdef Q_XDG_PLATFORM
|
||||||
setCustomLocations();
|
setCustomLocations();
|
||||||
|
|
||||||
// test writableLocation()
|
// test writableLocation()
|
||||||
@ -140,7 +144,7 @@ void tst_qstandardpaths::testCustomLocations()
|
|||||||
|
|
||||||
void tst_qstandardpaths::testLocateAll()
|
void tst_qstandardpaths::testLocateAll()
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_WIN
|
#ifdef Q_XDG_PLATFORM
|
||||||
const QStringList appsDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "applications", QStandardPaths::LocateDirectory);
|
const QStringList appsDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "applications", QStandardPaths::LocateDirectory);
|
||||||
//qDebug() << appsDirs;
|
//qDebug() << appsDirs;
|
||||||
foreach (const QString &dir, appsDirs)
|
foreach (const QString &dir, appsDirs)
|
||||||
@ -220,7 +224,7 @@ void tst_qstandardpaths::testRuntimeDirectory()
|
|||||||
QVERIFY(!runtimeDir.isEmpty());
|
QVERIFY(!runtimeDir.isEmpty());
|
||||||
|
|
||||||
// Check that it can automatically fix permissions
|
// Check that it can automatically fix permissions
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_XDG_PLATFORM
|
||||||
QFile file(runtimeDir);
|
QFile file(runtimeDir);
|
||||||
const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser;
|
const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser;
|
||||||
const QFile::Permissions additionalPerms = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
|
const QFile::Permissions additionalPerms = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
|
||||||
@ -234,7 +238,7 @@ void tst_qstandardpaths::testRuntimeDirectory()
|
|||||||
|
|
||||||
void tst_qstandardpaths::testCustomRuntimeDirectory()
|
void tst_qstandardpaths::testCustomRuntimeDirectory()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_XDG_PLATFORM
|
||||||
qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp"));
|
qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp"));
|
||||||
// It's very unlikely that /tmp is 0600 or that we can chmod it
|
// It's very unlikely that /tmp is 0600 or that we can chmod it
|
||||||
// The call below outputs
|
// The call below outputs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user