mirror of
https://github.com/baketnk/frame-yap.git
synced 2026-10-06 06:00:04 +02:00
Add configurable seamless animated panel gradient
This commit is contained in:
1 parent
1e45134755
commit
94b747bb04
13 files changed
+309
-46
No files matched your search
@@ -49,6 +49,9 @@ int main(int argc, char** argv) {
|
||||
assert(!load_config(path).clock_24h);
|
||||
assert(load_config(path).date_format == DateFormat::MonthDayYear);
|
||||
assert(load_config(path).wrist.width == .30f);
|
||||
assert(load_config(path).gradient.enabled);
|
||||
assert(load_config(path).gradient.period_seconds == 30.f);
|
||||
assert(load_config(path).gradient.strength == .12f);
|
||||
auto example = load_config(std::filesystem::path(argv[1]) / "config.example.json");
|
||||
assert(example.buttons.at("ptt") == "/user/hand/right/input/x");
|
||||
assert(example.buttons.at("quick_chat") == "/user/hand/right/input/y");
|
||||
@@ -62,6 +65,7 @@ int main(int argc, char** argv) {
|
||||
assert(!example.lock_layout);
|
||||
assert(!example.clock_24h && example.date_format == DateFormat::MonthDayYear);
|
||||
assert(example.wrist.y == .18f && example.wrist.z == .089f);
|
||||
assert(example.gradient.enabled && example.gradient.period_seconds == 30.f && example.gradient.strength == .12f);
|
||||
std::filesystem::create_directories(path.parent_path());
|
||||
assert(save_backend(path, "fixture_cpu"));
|
||||
assert(load_config(path).backend == "fixture_cpu");
|
||||
@@ -203,6 +207,26 @@ int main(int argc, char** argv) {
|
||||
R"({"wrist":{"x":1e999}})"}) {
|
||||
put(path, invalid); fails([&] { load_config(path); });
|
||||
}
|
||||
put(path, R"({"gradient":{"enabled":false,"period_seconds":45.5,"strength":0.2}})");
|
||||
auto gradient = load_config(path).gradient;
|
||||
assert(!gradient.enabled && gradient.period_seconds == 45.5f && gradient.strength == .2f);
|
||||
assert(save_auto_insert(path, true)); // unrelated settings retain the effect
|
||||
assert(load_config(path).gradient.period_seconds == 45.5f);
|
||||
put(path, R"({"gradient":{"strength":0}})");
|
||||
assert(load_config(path).gradient.enabled && load_config(path).gradient.period_seconds == 30.f);
|
||||
assert(load_config(path).gradient.strength == 0.f);
|
||||
put(path, R"({"gradient":{"period_seconds":5,"strength":0.3}})");
|
||||
assert(load_config(path).gradient.period_seconds == 5.f && load_config(path).gradient.strength == .3f);
|
||||
put(path, R"({"gradient":{"period_seconds":300}})");
|
||||
assert(load_config(path).gradient.period_seconds == 300.f);
|
||||
for (auto invalid : {R"({"gradient":true})", R"({"gradient":{"enabled":1}})",
|
||||
R"({"gradient":{"enabled":"false"}})", R"({"gradient":{"period_seconds":0}})",
|
||||
R"({"gradient":{"period_seconds":301}})", R"({"gradient":{"period_seconds":1e99}})",
|
||||
R"({"gradient":{"period_seconds":true}})", R"({"gradient":{"strength":-0.1}})",
|
||||
R"({"gradient":{"strength":0.31}})", R"({"gradient":{"strength":1e99}})",
|
||||
R"({"gradient":{"strength":"0.1"}})", R"({"gradient":{"unknown":1}})"}) {
|
||||
put(path, invalid); fails([&] { load_config(path); });
|
||||
}
|
||||
put(path, R"({"theme":{"background":"#123ABC","accent":"#abcdef","frame_end":"#010203"},"font":"/nonexistent/face.ttf","buttons":{"ptt":"/user/hand/left/input/y","cancel":"/user/hand/right/input/b","right_grip":""}})");
|
||||
auto config = load_config(path);
|
||||
assert((config.theme.background == Rgba{0x12, 0x3a, 0xbc, 255}));
|
||||
|
||||
Reference in new issue
Block a user