Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2018-02-20 16:29:45 +0300
committerOlivier Goffart <olivier@woboq.com>2018-02-21 13:28:31 +0300
commit7897b386b6ca7080ac59b2be58e2d5028aa740ff (patch)
treef36833cdd70b4f24d6af01cd8c0c4e0b900853b4 /test/testutility.cpp
parent159899d3ba43b3f899c0d09415a5d194c2b6152b (diff)
Utility::fsCasePreserving: remove UNIT_TESTING ifdef
Since the release package will be build with unit test, we don't want to query the env variable at every call to fsCasePreserving. So only test the env variable at startup. And the testutility can still change the value. (The env variable is still used from t8.pl and maybe smashbox) Issue #6318
Diffstat (limited to 'test/testutility.cpp')
-rw-r--r--test/testutility.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/testutility.cpp b/test/testutility.cpp
index 112efda73..20fb0a458 100644
--- a/test/testutility.cpp
+++ b/test/testutility.cpp
@@ -11,6 +11,10 @@
using namespace OCC::Utility;
+namespace OCC {
+OCSYNC_EXPORT extern bool fsCasePreserving_override;
+}
+
class TestUtility : public QObject
{
Q_OBJECT
@@ -150,12 +154,12 @@ private slots:
void testFsCasePreserving()
{
- qputenv("OWNCLOUD_TEST_CASE_PRESERVING", "1");
+ QVERIFY(isMac() || isWindows() ? fsCasePreserving() : ! fsCasePreserving());
+ QScopedValueRollback<bool> scope(OCC::fsCasePreserving_override);
+ OCC::fsCasePreserving_override = 1;
QVERIFY(fsCasePreserving());
- qputenv("OWNCLOUD_TEST_CASE_PRESERVING", "0");
+ OCC::fsCasePreserving_override = 0;
QVERIFY(! fsCasePreserving());
- qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING");
- QVERIFY(isMac() || isWindows() ? fsCasePreserving() : ! fsCasePreserving());
}
void testFileNamesEqual()
@@ -178,13 +182,12 @@ private slots:
QVERIFY(fileNamesEqual(a+"/test", b+"/test")); // both exist
QVERIFY(fileNamesEqual(a+"/test/TESTI", b+"/test/../test/TESTI")); // both exist
- qputenv("OWNCLOUD_TEST_CASE_PRESERVING", "1");
+ QScopedValueRollback<bool> scope(OCC::fsCasePreserving_override, true);
QVERIFY(fileNamesEqual(a+"/test", b+"/TEST")); // both exist
QVERIFY(!fileNamesEqual(a+"/test", b+"/test/TESTI")); // both are different
dir.remove();
- qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING");
}
void testSanitizeForFileName_data()