aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-10-26 14:22:41 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-10-26 14:25:57 +0000
commit02fff24b4fa27c500a964148d54f793ddc1df1cb (patch)
treedb4099744b665abd3e00a9e36bc8f3c6f2f46f23 /tests
parentadd CCACHE_DISABLE=1 to pgo.sh to avoid errors when ccache is enabled (diff)
config: improve validation of color values, default alpha to 0xff
Reject color values that aren't in either RGB, or ARGB format. That is, color values that aren't hexadecimal numbers with either 6 or 8 digits. Also, if a color value is allowed to have an alpha component, and the user left it out, default to 0xff (opaque) rather than 0x00 (fully transparent). Closes #1526
Diffstat (limited to 'tests')
-rw-r--r--tests/test-config.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test-config.c b/tests/test-config.c
index 666f4689..95abf1a4 100644
--- a/tests/test-config.c
+++ b/tests/test-config.c
@@ -426,6 +426,10 @@ test_color(struct context *ctx, bool (*parse_fun)(struct context *ctx),
{"ffffff", 0xffffff},
{"ffffffff", 0xffffffff, !alpha_allowed},
{"aabbccdd", 0xaabbccdd, !alpha_allowed},
+ {"00", 0, true},
+ {"0000", 0, true},
+ {"00000", 0, true},
+ {"000000000", 0, true},
{"unittest-invalid-color", 0, true},
};