Commit Graph

31 Commits

Author SHA1 Message Date
David Faure
44d48862c0 QStandardPaths: add GenericConfigLocation
This is what ConfigLocation was meant to be. A directory shared by all
applications. Unfortunately when I wrote the fallback on Windows,
I picked DataLocation (which is app-specific) instead of
GenericDataLocation (which is shared between apps). This makes it
impossible to have config files shared between apps, e.g. for libraries.
It also makes ConfigLocation quite inconsistent (on Windows one cannot
use it to load another app's config file, while it works everywhere else).

All this is fixed by GenericConfigLocation, which is shared between apps.

Change-Id: I23a755131061d4fea01e13dd1038fbd8ef333a5d
Reviewed-by: Alex Richardson <arichardson.kde@googlemail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-11-05 19:08:08 +01:00
Frederik Gladhorn
04acfea2d2 Fix QStandardPath test on some linuxes
On one suse box I have both /usr/bin/sh and /bin/sh which means that the
test should prefer the one first in the path instead of random order.

Change-Id: Ie94bf8404479fa42a36a8ee45e09986114693871
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-10-02 11:11:23 +02:00
Thiago Macieira
131b3e5dca QStandardPaths: add a test that just dumps the values
Change-Id: I79bcc1974988b3d712a40e89a3ec4aeb7be1fb5e
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
2013-09-14 03:20:25 +02:00
Thiago Macieira
73251f22f3 Add a Qt-API style QStandardPaths::setTestModeEnabled
QStandardPaths::enableTestMode has a verb in the imperative ("enable")
as the core word in the name. That indicates an action. The function
should not have had a parameter.

Instead, add a Qt-style setXXXEnabled function.

[ChangeLog][QtCore][QStandardPaths] QStandardPaths::enableTestMode is
deprecated and is replaced by QStandardPaths::setTestModeEnabled.

Change-Id: Ib26ad72d7c635890d2cb22ae9d44cbda08a6f17c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: David Faure (KDE) <faure@kde.org>
2013-08-09 21:25:24 +02:00
Friedemann Kleint
cd1e245877 QStandardPaths: Use forward slash consistently.
Task-number: QTBUG-29249

Change-Id: I027f9ae18544dc47e1378214244487c8a5ae704c
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-02-27 09:24:33 +01:00
Sergio Ahumada
48e0c4df23 Update copyright year in Digia's license headers
Change-Id: Ic804938fc352291d011800d21e549c10acac66fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-01-18 09:07:35 +01:00
Friedemann Kleint
0e8a2788d8 Fix Windows: QStandardPath::findExecutable() to check suffixes.
Append the Windows executables suffixes from the PATHEXT
environment variable.

The previous code had a bug since the 'break' statement
bailed out of the inner loop only.

Factor search code out into a separate functions, avoiding
repeated invocations of list.constEnd() and variable
assignments in the old code.

Add a static function that is called on Unix and on Windows
for executable names with a suffix.

Call another function applying a candidate list of suffixes
in case an executable name without a suffix is passed.

Lower case the extensions from PATHEXT, streamline code.

Split up the test, add a _data() slot for clarity.

Task-number: QTBUG-27457
Change-Id: I2bf34de52aeadddd3b937ad1e22191c3c850fd26
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-10-08 17:21:35 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 19:20:11 +02:00
David Faure
a23da5fd6b Add bool QStandardPaths::isTestModeEnabled()
Library code might need to know this, e.g. when calling an external
process, to give it the right configuration. (For instance when
ksycoca code calls kbuildsycoca to recreate the DB at the right place).

Change-Id: I343ddefff816586f9d391973c08ff1e1ad86bf0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-09 13:48:13 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.

Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-01 15:37:46 +02:00
Rohan McGovern
360797208b Removed CONFIG+=parallel_test from suspected parallel-unsafe tests
These tests have failed a parallel stress test and may contribute to
instability in test runs.

Change-Id: I2c4456ad7d3846c2262a0ba714ab8f0c9a05c597
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-05-22 05:09:01 +02:00
Lars Knoll
9bd0323551 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	configure
	src/corelib/io/qurl.cpp
	src/gui/kernel/qwindow.cpp
	src/tools/moc/generator.cpp
	src/widgets/kernel/qwidget_qpa.cpp
	src/widgets/styles/qstyle.h
	src/widgets/widgets/qtabbar.cpp
	tests/auto/corelib/codecs/utf8/tst_utf8.cpp

Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
2012-04-16 12:04:34 +02:00
Oswald Buddenhagen
143c4d3e13 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	configure
	src/widgets/styles/qwindowsxpstyle.cpp
	tests/auto/gui/kernel/qwindow/qwindow.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp

Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
2012-04-10 15:31:45 +02:00
Rafael Roquetto
00f3299e8b Blackberry OS implementation of QStandardPaths
Change-Id: I31427b896ca691de7071da17af4863d16348df7b
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-04-10 10:38:10 +02:00
David Faure
4a11611c8a Fix unittest for QStandardPaths::enableTestMode
It was confusing DataLocation and GenericDataLocation, and the same
for CacheLocation and GenericCacheLocation. The test was passing in
the api_changes branch because these were giving the same result
(empty app name), but the QCoreApplication::applicationName fix in master
makes these different, so the bug in the test showed up after merging.

Change-Id: I80ef6883c96cfd02b8c277d9d686717028d396bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-05 10:15:21 +02:00
David Faure
a5a80da223 Allow auto tests to stay away from the user's configuration.
QStandardPaths now knows a "test mode" which changes writable locations
to point to test directories, in order to prevent auto tests from reading from
or writing to the current user's configuration.

This affects the locations into which test programs might write files:
GenericDataLocation, DataLocation, ConfigLocation,
GenericCacheLocation, CacheLocation.
Other locations are not affected.

Change-Id: I29606c2e74714360edd871a8c387a5c1ef7d1f54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-03-28 11:22:11 +02:00
David Faure
e5d5495526 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>
2012-03-28 00:51:32 +02:00
David Faure
5ec5ce3549 Return all expected paths in QStandardPaths::standardLocations
ApplicationsLocation and DataLocation were returning only the local path,
rather than system paths + local path.

Change-Id: I653d14e5bbe1e08c5fa1ecd5a6106336d1cd0369
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-22 13:29:27 +01:00
Kurt Korbatits
805d895978 Fixed qstandardpaths unittest to handle being run as root
- testCustomRuntimeDirectory test skips if run as root

Change-Id: Idcc2a1db5d8a96b2ec0248b8b1c392fffc0b2e11
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-02-09 06:53:10 +01:00
Kurt Korbatits
c0dd519f88 Fixed qstandardpaths unittest to check before using first()
- Added check to testLocateAll() to check count() before calling
  first().

Change-Id: I04e93c1f913972b26c517f2bbd08760f9898cc7a
Reviewed-by: Kurt Korbatits  <kurt.korbatits@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-31 04:24:04 +01:00
Jason McDonald
5635823e17 Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 03:54:59 +01:00
Jason McDonald
629d6eda5c Update contact information in license headers.
Replace Nokia contact email address with Qt Project website.

Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-23 04:04:33 +01:00
Jason McDonald
1fdfc2abfe Update copyright year in license headers.
Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 06:36:56 +01:00
Jason McDonald
e3640d1bdd Remove TESTED_CLASS/TESTED_FILES comments from tests.
These comments were mostly empty or inaccurate.  Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.

Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-06 02:19:25 +01:00
Rohan McGovern
3385fb91e1 Fixed installation of corelib tests
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and
replaced them with TESTDATA where appropriate.

In .cpp files, removed SRCDIR and relative paths to testdata and
replaced them with the QFINDTESTDATA macro where appropriate.

Modified test helper apps/libs to install themselves under the test
they relate to.

This change allows corelib tests to be correctly installed, along with
their testdata, via `make install'.

Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-01 09:12:52 +01:00
Jason McDonald
578e6d6834 Cleanup corelib autotests
Remove various disabled and/or non-helpful debugging code.

Any test diagnostics that are useful should be part of the regular test
output, as the CI system cannot switch on commented-out code when there
is a test failure.  Diagnostics should also be informative -- simply
printing the value of a variable with no other information about what is
being printed (or why it is being printed) is not informative.

Change-Id: I21a6c2121be86001bb57e80f426507b6e619ee9e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-14 07:33:57 +01:00
Jason McDonald
94fc875079 Cleanup corelib autotests
Tidy the autotest .pro files.  Most autotest .pro files should look like
this:

CONFIG += testcase
TARGET = tst_something
QT = core testlib
SOURCES = tst_something.cpp

Change-Id: I877c2194e9fa9dd13478d117895e1e255a948ad7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-11 02:45:05 +01:00
Jason McDonald
e8f7fccf22 Cleanup corelib autotests
Remove redundant empty constructors, destructors and test functions.

Change-Id: Idb51368895e67ec3fc0345a9a5d33d77730c051b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-07 13:26:41 +01:00
David Faure
272d20ce27 QStandardPaths: add DownloadLocation.
Only properly implemented on unix (XDG), falls back to Document location
on Mac and Windows, because not easily available with the current API
being used by either one.

Change-Id: Id269f0e3c4e3a68e19205de96c0b39980fde80ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-04 10:54:54 +01:00
David Faure
ae6e7e3d59 Fix tst_qstandardpaths: Mac OSX is a unix, but doesn't use XDG.
Change-Id: I2b4552a162dc9f993e0587ace6e7e3fb4f96571e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-04 10:53:41 +01:00
David Faure
03fd37cdf4 Add the missing unittest
Change-Id: I2384d9de7b9ef409db521087670070bd5afc85ff
Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
2011-10-23 00:57:10 +02:00