mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
tests: config: colors: verify loaded color is correct
This commit is contained in:
parent
5406ae3355
commit
b24a9a59b9
1 changed files with 26 additions and 0 deletions
|
|
@ -399,6 +399,16 @@ test_color(struct context *ctx, bool (*parse_fun)(struct context *ctx),
|
|||
BUG("[%s].%s=%s: failed to parse",
|
||||
ctx->section, ctx->key, ctx->value);
|
||||
}
|
||||
|
||||
uint32_t color = input[i].color;
|
||||
if (alpha_allowed && strlen(input[i].option_string) == 6)
|
||||
color |= 0xff000000;
|
||||
|
||||
if (*ptr != color) {
|
||||
BUG("[%s].%s=%s: expected 0x%08x, got 0x%08x",
|
||||
ctx->section, ctx->key, ctx->value,
|
||||
color, *ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -445,6 +455,18 @@ test_two_colors(struct context *ctx, bool (*parse_fun)(struct context *ctx),
|
|||
BUG("[%s].%s=%s: failed to parse",
|
||||
ctx->section, ctx->key, ctx->value);
|
||||
}
|
||||
|
||||
if (*ptr1 != input[i].color1) {
|
||||
BUG("[%s].%s=%s: expected 0x%08x, got 0x%08x",
|
||||
ctx->section, ctx->key, ctx->value,
|
||||
input[i].color1, *ptr1);
|
||||
}
|
||||
|
||||
if (*ptr2 != input[i].color2) {
|
||||
BUG("[%s].%s=%s: expected 0x%08x, got 0x%08x",
|
||||
ctx->section, ctx->key, ctx->value,
|
||||
input[i].color2, *ptr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -720,6 +742,10 @@ test_section_colors(void)
|
|||
&conf.colors.search_box.match.fg,
|
||||
&conf.colors.search_box.match.bg);
|
||||
|
||||
test_two_colors(&ctx, &parse_section_colors, "cursor", false,
|
||||
&conf.colors.cursor.text,
|
||||
&conf.colors.cursor.cursor);
|
||||
|
||||
test_enum(&ctx, &parse_section_colors, "alpha-mode", 3,
|
||||
(const char *[]){"default", "matching", "all"},
|
||||
(int []){ALPHA_MODE_DEFAULT, ALPHA_MODE_MATCHING, ALPHA_MODE_ALL},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue