From ae6e7e3d59439008e7369da8083f4e5c4f6f980a Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 3 Nov 2011 19:12:53 +0100 Subject: Fix tst_qstandardpaths: Mac OSX is a unix, but doesn't use XDG. Change-Id: I2b4552a162dc9f993e0587ace6e7e3fb4f96571e Reviewed-by: Thiago Macieira --- .../auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 00f52fb8d1..d8b22ae134 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -50,6 +50,10 @@ #include #endif +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#define Q_XDG_PLATFORM +#endif + //TESTED_CLASS=QStandardPaths //TESTED_FILES=qstandardpaths.cpp @@ -91,7 +95,7 @@ private: void tst_qstandardpaths::testDefaultLocations() { -#ifndef Q_OS_WIN +#ifdef Q_XDG_PLATFORM qputenv("XDG_CONFIG_HOME", QByteArray()); qputenv("XDG_CONFIG_DIRS", QByteArray()); const QString expectedConfHome = QDir::homePath() + QString::fromLatin1("/.config"); @@ -113,7 +117,7 @@ void tst_qstandardpaths::testDefaultLocations() void tst_qstandardpaths::testCustomLocations() { -#ifndef Q_OS_WIN +#ifdef Q_XDG_PLATFORM setCustomLocations(); // test writableLocation() @@ -140,7 +144,7 @@ void tst_qstandardpaths::testCustomLocations() void tst_qstandardpaths::testLocateAll() { -#ifndef Q_OS_WIN +#ifdef Q_XDG_PLATFORM const QStringList appsDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "applications", QStandardPaths::LocateDirectory); //qDebug() << appsDirs; foreach (const QString &dir, appsDirs) @@ -220,7 +224,7 @@ void tst_qstandardpaths::testRuntimeDirectory() QVERIFY(!runtimeDir.isEmpty()); // Check that it can automatically fix permissions -#ifdef Q_OS_UNIX +#ifdef Q_XDG_PLATFORM QFile file(runtimeDir); const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser; const QFile::Permissions additionalPerms = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner; @@ -234,7 +238,7 @@ void tst_qstandardpaths::testRuntimeDirectory() void tst_qstandardpaths::testCustomRuntimeDirectory() { -#ifdef Q_OS_UNIX +#ifdef Q_XDG_PLATFORM qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp")); // It's very unlikely that /tmp is 0600 or that we can chmod it // The call below outputs -- cgit v1.2.3