diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:51:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:51:51 +0000 |
commit | b0e30ceba2288eab10c6ff7be0ac0cb05a9ed0b7 (patch) | |
tree | 9f1d8a08a8cbd19d28ec2d31027f8a7ccd90de0d /plugins/xsettings/test-wm-button-layout-translations.c | |
parent | Initial commit. (diff) | |
download | gnome-settings-daemon-2eefe53c66f7df8f0f22dd48280dac17d21f713e.tar.xz gnome-settings-daemon-2eefe53c66f7df8f0f22dd48280dac17d21f713e.zip |
Adding upstream version 43.0.upstream/43.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/xsettings/test-wm-button-layout-translations.c')
-rw-r--r-- | plugins/xsettings/test-wm-button-layout-translations.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/xsettings/test-wm-button-layout-translations.c b/plugins/xsettings/test-wm-button-layout-translations.c new file mode 100644 index 0000000..5ab140a --- /dev/null +++ b/plugins/xsettings/test-wm-button-layout-translations.c @@ -0,0 +1,54 @@ +#include <glib.h> + +#include "wm-button-layout-translation.h" + +static void +test_button_layout_translations (void) +{ + static struct { + char *layout; + char *expected; + } tests[] = { + { "", "" }, + { "invalid", "" }, + + { ":", ":" }, + { ":invalid", ":" }, + { "invalid:", ":" }, + { "invalid:invalid", ":" }, + + { "appmenu", "menu" }, + { "appmenu:", "menu:" }, + { ":menu", ":icon" }, + { "appmenu:close", "menu:close" }, + { "appmenu:minimize,maximize,close", "menu:minimize,maximize,close" }, + { "menu,appmenu:minimize,maximize,close", "icon,menu:minimize,maximize,close" }, + + { "close,close,close:close,close,close", "close,close,close:close,close,close" }, + + { "invalid,appmenu:invalid,minimize", "menu:minimize" }, + { "appmenu,invalid:minimize,invalid", "menu:minimize" }, + { "invalidmenu:invalidclose", ":" }, + { "invalid,invalid,invalid:invalid,minimize,maximize,close", ":minimize,maximize,close" }, + }; + int i; + + for (i = 0; i < G_N_ELEMENTS (tests); i++) + { + char *layout = g_strdup (tests[i].layout); + + translate_wm_button_layout_to_gtk (layout); + g_assert_cmpstr (layout, ==, tests[i].expected); + g_free (layout); + } +} + +int +main (int argc, char *argv[]) +{ + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/layout-translations", test_button_layout_translations); + + return g_test_run (); +} |