Audacity 3.2.0
SettingsWXTests.cpp
Go to the documentation of this file.
1#include <catch2/catch.hpp>
3#include <wx/fileconf.h>
4#include "SettingsWX.h"
5
6TEST_CASE("SettingsWX implementations test", "")
7{
8 std::shared_ptr<wxConfigBase> config
9 = std::make_unique<wxFileConfig>(wxEmptyString,
10 wxEmptyString,
11 "wx-settings-test.cfg",
12 wxEmptyString,
13 wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
14
15 wxConfigBase::Set(config.get());
16
18 [&] { return std::make_unique<SettingsWX>(config); }
19 };
20
21 SECTION("Application settings read/write")
22 {
25 }
26
27 SECTION("Application settings groups")
28 {
31 }
32
33 SECTION("Application settings persistance")
34 {
35 {
37 settings->Clear();
38
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);
43 }
44
45 {
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);
51 }
52 }
53}
54
55
void TestRW(audacity::BasicSettings &settings)
void TestGroups(audacity::BasicSettings &settings)
TEST_CASE("SettingsWX implementations test", "")
static Settings & settings()
Definition: TrackInfo.cpp:51
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