Skip to content

Update sGlobalFileName when QStandardPaths TestMode is toggled

Ahmad Samir requested to merge work/ahmad/qstandardpaths-testmode into master

When running unit tests, usually QStandardPaths TestMode is enabled so as not to mess up the config files in the home dir of the dev running the unit tests; sGlobalFileName, a global static, was defined only once, which meant that if KSharedConfig::openConfig() is called before the unit test has had a chance to call QStandardPaths::setTestModeEnabled(true), then sGlobalFileName will go on referring to the wrong kdeglobals file (as can be seen in dfaure's debugging of the issue at [1]). Change the code so as to detect QStandardPaths TestMode status and change sGlobalFileName as needed.

All unit tests still pass.

[1] kio!77 (comment 74124)

Edited by Ahmad Samir

Merge request reports

Loading