mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
test: multi-bar config with includes
This commit is contained in:
parent
9f3b34e4d9
commit
8912bd3ed0
@ -76,3 +76,37 @@ TEST_CASE("Load simple config with include", "[config]") {
|
||||
REQUIRE(configs.empty());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Load multiple bar config with include", "[config]") {
|
||||
waybar::Config conf;
|
||||
conf.load("test/config/include-multi.json");
|
||||
|
||||
SECTION("bar config with sole include") {
|
||||
auto data = conf.getOutputConfigs("OUT-0", "Fake ouptut #0");
|
||||
REQUIRE(data.size() == 1);
|
||||
REQUIRE(data[0]["height"].asInt() == 20);
|
||||
}
|
||||
|
||||
SECTION("bar config with output and include") {
|
||||
auto data = conf.getOutputConfigs("OUT-1", "Fake output #1");
|
||||
REQUIRE(data.size() == 1);
|
||||
REQUIRE(data[0]["height"].asInt() == 21);
|
||||
}
|
||||
|
||||
SECTION("bar config with output override") {
|
||||
auto data = conf.getOutputConfigs("OUT-2", "Fake output #2");
|
||||
REQUIRE(data.size() == 1);
|
||||
REQUIRE(data[0]["height"].asInt() == 22);
|
||||
}
|
||||
|
||||
SECTION("multiple levels of include") {
|
||||
auto data = conf.getOutputConfigs("OUT-3", "Fake output #3");
|
||||
REQUIRE(data.size() == 1);
|
||||
REQUIRE(data[0]["height"].asInt() == 23);
|
||||
}
|
||||
|
||||
auto& data = conf.getConfig();
|
||||
REQUIRE(data.isArray());
|
||||
REQUIRE(data.size() == 4);
|
||||
REQUIRE(data[0]["output"].asString() == "OUT-0");
|
||||
}
|
||||
|
9
test/config/include-multi-0.json
Normal file
9
test/config/include-multi-0.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{
|
||||
"output": "OUT-0",
|
||||
"height": 20
|
||||
},
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
]
|
8
test/config/include-multi-1.json
Normal file
8
test/config/include-multi-1.json
Normal file
@ -0,0 +1,8 @@
|
||||
[
|
||||
{},
|
||||
{
|
||||
"height": 21
|
||||
},
|
||||
{},
|
||||
{}
|
||||
]
|
9
test/config/include-multi-2.json
Normal file
9
test/config/include-multi-2.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{},
|
||||
{},
|
||||
{
|
||||
"output": "OUT-1",
|
||||
"height": 22
|
||||
},
|
||||
{}
|
||||
]
|
8
test/config/include-multi-3-0.json
Normal file
8
test/config/include-multi-3-0.json
Normal file
@ -0,0 +1,8 @@
|
||||
[
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{
|
||||
"height": 23
|
||||
}
|
||||
]
|
9
test/config/include-multi-3.json
Normal file
9
test/config/include-multi-3.json
Normal file
@ -0,0 +1,9 @@
|
||||
[
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{
|
||||
"output": "OUT-3",
|
||||
"include": "test/config/include-multi-3-0.json"
|
||||
}
|
||||
]
|
16
test/config/include-multi.json
Normal file
16
test/config/include-multi.json
Normal file
@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"include": "test/config/include-multi-0.json"
|
||||
},
|
||||
{
|
||||
"output": "OUT-1",
|
||||
"include": "test/config/include-multi-1.json"
|
||||
},
|
||||
{
|
||||
"output": "OUT-2",
|
||||
"include": "test/config/include-multi-2.json"
|
||||
},
|
||||
{
|
||||
"include": "test/config/include-multi-3.json"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user