1#include <catch2/catch.hpp>
3#include <wx/fileconf.h>
8 std::shared_ptr<wxConfigBase> config
9 = std::make_unique<wxFileConfig>(wxEmptyString,
11 "wx-settings-test.cfg",
13 wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
15 wxConfigBase::Set(config.get());
18 [&] {
return std::make_unique<SettingsWX>(config); }
21 SECTION(
"Application settings read/write")
27 SECTION(
"Application settings groups")
33 SECTION(
"Application settings persistance")
39 settings->Write(
"Application Settings/Property1",
"string");
40 settings->Write(
"Application Settings/Component1/Property1", 1);
41 settings->Write(
"Application Settings/Component1/Property2",
true);
42 settings->Write(
"Application Settings/Component2/Property1", 3.0);
47 REQUIRE(
settings->Read(
"Application Settings/Property1") ==
"string");
48 REQUIRE(
settings->Read(
"Application Settings/Component1/Property1", 0) == 1);
49 REQUIRE(
settings->Read(
"Application Settings/Component1/Property2",
false) ==
true);
50 REQUIRE(
settings->Read(
"Application Settings/Component2/Property1", 0.0) == 3.0);
void TestRW(audacity::BasicSettings &settings)
void TestGroups(audacity::BasicSettings &settings)
TEST_CASE("SettingsWX implementations test", "")
static Settings & settings()
static result_type Call(Arguments &&...arguments)
Null check of the installed function is done for you.
typename GlobalVariable< ApplicationSettings, const std::function< std::unique_ptr< BasicSettings > >, nullptr, Options... >::Scope Scope