diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-09 14:57:57 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-09 15:11:18 -0400 |
commit | 903c9bf4b0ee86038c5fa4b430a2ceff71d621b9 (patch) | |
tree | c062a51949e0707c3b2628b984daa9902b9e9d81 /tests/test-bidi.c | |
parent | 587c159a8b835a84f4ee5ec731052b2dc3c02aee (diff) | |
download | pango-903c9bf4b0ee86038c5fa4b430a2ceff71d621b9.tar.gz |
Fix corner cases around line ends
pango_layout_index_to_line_and_extents needs to
return a run rect even if the line has no non-empty
runs. Failing to do so was causing cursors at the
end of lines to have a height of 0 or 1, which is
not what we want.
Add a testcase.
Diffstat (limited to 'tests/test-bidi.c')
-rw-r--r-- | tests/test-bidi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test-bidi.c b/tests/test-bidi.c index 7a137518..995decb2 100644 --- a/tests/test-bidi.c +++ b/tests/test-bidi.c @@ -346,6 +346,7 @@ test_move_cursor_para (void) { "你好 Hello שלום Γειά σας", 60 }, { "你好 Hello שלום Γειά σας", 80 }, { "line 1
line 2
line 3\nline 4\r\nline 5", -1 }, // various separators + { "some text, some more text,\n\n even more text", 60 }, }; PangoLayout *layout; PangoRectangle pos, old_pos; @@ -395,9 +396,12 @@ test_move_cursor_para (void) pango_layout_line_get_extents (line, NULL, &ext); pango_layout_get_cursor_pos (layout, index, &pos, NULL); + // assert that we are either moving to the right // or jumping to the next line g_assert_true (pos.y > ext.y + ext.height || pos.x > old_pos.x); + // no invisible cursors, please + g_assert_true (pos.height > 1024); } } |