From 53a4f14e8801b0018a7ecf607a91aaa190f1bc41 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Mar 2021 20:25:22 -0500 Subject: markup tests: Remove an _ This is in preparation for adding some tests that will check accel handling. --- tests/markups/valid-12.expected | 2 +- tests/markups/valid-12.markup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/markups/valid-12.expected b/tests/markups/valid-12.expected index 39c8c4e4..b6587ee8 100644 --- a/tests/markups/valid-12.expected +++ b/tests/markups/valid-12.expected @@ -1,5 +1,5 @@ overline -overline_color +overline-color single-line double-line error-line diff --git a/tests/markups/valid-12.markup b/tests/markups/valid-12.markup index 4822024d..360944d0 100644 --- a/tests/markups/valid-12.markup +++ b/tests/markups/valid-12.markup @@ -1,5 +1,5 @@ overline -overline_color +overline-color single-line double-line error-line -- cgit v1.2.1 From 565c111c430410e0858b577fc97721659c407d0d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Mar 2021 20:25:45 -0500 Subject: markup tests: Pass accel_marker='_' And print out the accel_char if we get one back. This will let us add tests for accel functionality. --- tests/markup-parse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/markup-parse.c b/tests/markup-parse.c index 5f1454a1..2ee8c85e 100644 --- a/tests/markup-parse.c +++ b/tests/markup-parse.c @@ -47,11 +47,12 @@ test_file (const gchar *filename, GString *string) gboolean ret; char *str; int start, end; + gunichar accel = 0; g_file_get_contents (filename, &contents, &length, &error); g_assert_no_error (error); - ret = pango_parse_markup (contents, length, 0, &attrs, &text, NULL, &error); + ret = pango_parse_markup (contents, length, '_', &attrs, &text, &accel, &error); g_free (contents); if (ret) @@ -74,6 +75,12 @@ test_file (const gchar *filename, GString *string) pango_attr_list_unref (attrs); pango_font_description_free (desc); g_free (text); + + if (accel) + { + g_string_append (string, "\n\n---\n\n"); + g_string_append_unichar (string, accel); + } } else { -- cgit v1.2.1 From 283f646dd7ac44d0c0d7b12d15bd2f6a4346c8f5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Mar 2021 20:59:49 -0500 Subject: markup-parse: Make generating files more convenient Don't print extraneous output when we are generating an .expected file. --- tests/markup-parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/markup-parse.c b/tests/markup-parse.c index 2ee8c85e..9f081ab7 100644 --- a/tests/markup-parse.c +++ b/tests/markup-parse.c @@ -146,20 +146,20 @@ main (int argc, char *argv[]) g_setenv ("LC_ALL", "C", TRUE); setlocale (LC_ALL, ""); - g_test_init (&argc, &argv, NULL); - /* allow to easily generate expected output for new test cases */ - if (argc > 1) + if (argc > 1 && argv[1][0] != '-') { GString *string; string = g_string_sized_new (0); test_file (argv[1], string); - g_test_message ("%s", string->str); + g_print ("%s", string->str); return 0; } + g_test_init (&argc, &argv, NULL); + path = g_test_build_filename (G_TEST_DIST, "markups", NULL); dir = g_dir_open (path, 0, &error); g_free (path); -- cgit v1.2.1 From 2ec635ae28261418313156e21b1eeed42d28f056 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Mar 2021 21:00:57 -0500 Subject: markup tests: Add tests for parsing accels Add tests that test some of the corner cases handled in the previous commit. --- tests/markups/valid-13.expected | 21 +++++++++++++++++++++ tests/markups/valid-13.markup | 1 + tests/markups/valid-14.expected | 24 ++++++++++++++++++++++++ tests/markups/valid-14.markup | 1 + tests/markups/valid-15.expected | 10 ++++++++++ tests/markups/valid-15.markup | 0 tests/meson.build | 3 +++ 7 files changed, 60 insertions(+) create mode 100644 tests/markups/valid-13.expected create mode 100644 tests/markups/valid-13.markup create mode 100644 tests/markups/valid-14.expected create mode 100644 tests/markups/valid-14.markup create mode 100644 tests/markups/valid-15.expected create mode 100644 tests/markups/valid-15.markup (limited to 'tests') diff --git a/tests/markups/valid-13.expected b/tests/markups/valid-13.expected new file mode 100644 index 00000000..c63a71c4 --- /dev/null +++ b/tests/markups/valid-13.expected @@ -0,0 +1,21 @@ +abc def + + +--- + +range 0 4 +range 4 5 +[4,5]underline=3 +range 5 2147483647 + + +--- + +[0:4] (null) Normal +[4:5] (null) Normal +[5:2147483647] (null) Normal + + +--- + +d \ No newline at end of file diff --git a/tests/markups/valid-13.markup b/tests/markups/valid-13.markup new file mode 100644 index 00000000..45ccaefb --- /dev/null +++ b/tests/markups/valid-13.markup @@ -0,0 +1 @@ +abc _def diff --git a/tests/markups/valid-14.expected b/tests/markups/valid-14.expected new file mode 100644 index 00000000..4aa87977 --- /dev/null +++ b/tests/markups/valid-14.expected @@ -0,0 +1,24 @@ +abc def _x_ + + +--- + +range 0 1 +[0,1]underline=3 +range 1 4 +range 4 5 +[4,5]underline=3 +range 5 2147483647 + + +--- + +[0:1] (null) Normal +[1:4] (null) Normal +[4:5] (null) Normal +[5:2147483647] (null) Normal + + +--- + +a \ No newline at end of file diff --git a/tests/markups/valid-14.markup b/tests/markups/valid-14.markup new file mode 100644 index 00000000..52466786 --- /dev/null +++ b/tests/markups/valid-14.markup @@ -0,0 +1 @@ +_abc _def __x_ diff --git a/tests/markups/valid-15.expected b/tests/markups/valid-15.expected new file mode 100644 index 00000000..77032f87 --- /dev/null +++ b/tests/markups/valid-15.expected @@ -0,0 +1,10 @@ + + +--- + +range 0 2147483647 + + +--- + +[0:2147483647] (null) Normal diff --git a/tests/markups/valid-15.markup b/tests/markups/valid-15.markup new file mode 100644 index 00000000..e69de29b diff --git a/tests/meson.build b/tests/meson.build index bdccd55d..ccd2541e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -91,6 +91,9 @@ test_markups_data = [ 'markups/valid-10', 'markups/valid-11', 'markups/valid-12', + 'markups/valid-13', + 'markups/valid-14', + 'markups/valid-15', ] test_breaks_data = [ -- cgit v1.2.1