aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-29 18:15:15 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-29 18:18:40 +0000
commit956f8995b9b982cdac4b002e0c0f71c84681d18d (patch)
tree5a09826a83d53eef3df5f3c1956661ea4d1d2a3e
parenttest: config: test URL section (diff)
test: config: test cursor section
-rw-r--r--tests/test-config.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test-config.c b/tests/test-config.c
index bac040b5..e97cbcb8 100644
--- a/tests/test-config.c
+++ b/tests/test-config.c
@@ -499,6 +499,32 @@ test_section_url(void)
}
static void
+test_section_cursor(void)
+{
+ struct config conf = {0};
+ struct context ctx = {
+ .conf = &conf, .section = "cursor", .path = "unittest"};
+
+ test_invalid_key(&ctx, &parse_section_cursor, "invalid-key");
+
+ test_enum(
+ &ctx, &parse_section_cursor, "style",
+ 3,
+ (const char *[]){"block", "beam", "underline"},
+ (int []){CURSOR_BLOCK, CURSOR_BEAM, CURSOR_UNDERLINE},
+ (int *)&conf.cursor.style);
+ test_boolean(&ctx, &parse_section_cursor, "blink", &conf.cursor.blink);
+ test_pt_or_px(&ctx, &parse_section_cursor, "beam-thickness",
+ &conf.cursor.beam_thickness);
+ test_pt_or_px(&ctx, &parse_section_cursor, "underline-thickness",
+ &conf.cursor.underline_thickness);
+
+ /* TODO: color (two RRGGBB values) */
+
+ config_free(conf);
+}
+
+static void
test_key_binding(struct context *ctx, bool (*parse_fun)(struct context *ctx),
int action, int max_action, const char *const *map,
struct config_key_binding_list *bindings,
@@ -925,6 +951,7 @@ main(int argc, const char *const *argv)
test_section_bell();
test_section_scrollback();
test_section_url();
+ test_section_cursor();
test_section_key_bindings();
test_section_key_bindings_collisions();
test_section_search_bindings();