Web lists-archives.com

Re: How to temporarily change KConfig-data for a unit test?

On 13.02.2018 15:42, Aleix Pol wrote:
On Tue, Feb 13, 2018 at 1:14 PM, Michael Heidelbach <ottwolt@xxxxxxxxx> wrote:

Currently I'm working on baloo-widgets. For a unit test I need to
temporarily change KConfig data.

My approach would be like this:


     KConfig config("baloofileinformationrc", KConfig::NoGlobals);
     KConfigGroup settings = config.group("Show");

         set everything to true here.

Revert the changes incleanupTestCase();

How is this done most efficiently and without messing too much with
Ideally you should QStandardPaths::setTestModeEnabled(true), then you
can do as you please with config files which should end up in

Works like a charm, thank you.