diff options
author | David Faure <faure@kde.org> | 2012-03-20 18:01:20 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-28 00:51:32 +0200 |
commit | e5d549552614f89dd73b29fc3ee4710f65bb1e57 (patch) | |
tree | 0f1480eb7c25a7dc48e5248463daf02d4f36f6c5 /tests | |
parent | df43b9a06a73759ba74f23d9c3e91bd0347d1026 (diff) |
Make QCoreApplication::applicationName() default to argv[0]
This makes it more useful in all the Qt apps that don't set it,
given that it's used internally by QTemporaryFile, QTemporaryDir,
QStandardPaths, QDBus, QAccessibleApplication, etc.
Qt4 compatibility in the deprecated QDesktopServices is preserved,
no fallback there.
Change-Id: I584463507cf917a3720793c6bd45d07c60f8356c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 14 | ||||
-rw-r--r-- | tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp | 3 |
2 files changed, 6 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index a6eabbbed6..e9af29494b 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -186,18 +186,12 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. - { - const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - const QString app = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - QCOMPARE(base, app); - } + const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/tst_qstandardpaths"); QCoreApplication::instance()->setApplicationName("QtTest"); - { - const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - const QString app = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - QCOMPARE(app, base + "/Qt/QtTest"); - } + QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/QtTest"); #ifdef Q_XDG_PLATFORM setDefaultLocations(); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 84d723ca61..f4aefb2726 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -121,7 +121,8 @@ void tst_QCoreApplication::qAppName() int argc = 1; char *argv[] = { const_cast<char*>("tst_qcoreapplication") }; QCoreApplication app(argc, argv); - QVERIFY(!::qAppName().isEmpty()); + QCOMPARE(::qAppName(), QString::fromLatin1("tst_qcoreapplication")); + QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1("tst_qcoreapplication")); } void tst_QCoreApplication::argc() |