diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-03-27 16:19:29 +0200 |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2012-03-27 19:22:48 +0200 |
commit | d236fe2214340164bec4f34cb27dea4a634ee0de (patch) | |
tree | cda4ebbcc91717b37e5a2dbccb9ee46c2a1d3885 /tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp | |
parent | 2b17b0235b70f89d15d3b91a14c3297d38377f94 (diff) | |
parent | cbc883da6910b3357a4e03d0e2dfa841da1a03e8 (diff) |
Merge master into api_changes
Conflicts:
src/corelib/global/qisenum.h
src/dbus/qdbusconnection_p.h
src/widgets/kernel/qwidget.cpp
tests/auto/other/qaccessibility/tst_qaccessibility.cpp
Change-Id: I85102515d5fec835832cc20ffdc5c1ba578bd01d
Diffstat (limited to 'tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp')
-rw-r--r-- | tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp index 0ad37c21e8..618587356b 100644 --- a/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp +++ b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp @@ -57,12 +57,11 @@ private slots: void cleanup(); void openUrl(); void handlers(); + void testDataLocation(); }; tst_qdesktopservices::tst_qdesktopservices() { - QCoreApplication::setOrganizationName("Nokia"); - QCoreApplication::setApplicationName("tst_qdesktopservices"); } tst_qdesktopservices::~tst_qdesktopservices() @@ -117,5 +116,37 @@ void tst_qdesktopservices::handlers() QCOMPARE(barHandler.lastHandledUrl.toString(), barUrl.toString()); } +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#define Q_XDG_PLATFORM +#endif + +void tst_qdesktopservices::testDataLocation() +{ + // This is the one point where QDesktopServices and QStandardPaths differ. + // QDesktopServices on unix returns "data"/orgname/appname for DataLocation, for Qt4 compat. + // And the appname in qt4 defaulted to empty, not to argv[0]. + { + const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); + const QString app = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#ifdef Q_XDG_PLATFORM + QCOMPARE(app, base + "/data//"); // as ugly as in Qt4 +#else + QCOMPARE(app, base); +#endif + } + QCoreApplication::instance()->setOrganizationName("Qt"); + QCoreApplication::instance()->setApplicationName("QtTest"); + { + const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); + const QString app = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#ifdef Q_XDG_PLATFORM + QCOMPARE(app, base + "/data/Qt/QtTest"); +#else + QCOMPARE(app, base + "/Qt/QtTest"); +#endif + } +} + QTEST_MAIN(tst_qdesktopservices) + #include "tst_qdesktopservices.moc" |