Audacity 3.2.0
Functions
SettingsWXTests.cpp File Reference
#include <catch2/catch.hpp>
#include "SettingsTestsCommon.h"
#include <wx/fileconf.h>
#include "SettingsWX.h"
Include dependency graph for SettingsWXTests.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("SettingsWX implementations test", "")
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "SettingsWX implementations test"  ,
""   
)

Definition at line 6 of file SettingsWXTests.cpp.

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}
void TestRW(audacity::BasicSettings &settings)
void TestGroups(audacity::BasicSettings &settings)
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

References GlobalHook< ApplicationSettings, std::unique_ptr< BasicSettings >()>::Call(), settings(), TestGroups(), and TestRW().

Here is the call graph for this function: