mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget: adjust editor tests to new pos iteration
This commit fixes the expectations of our ligature iteration tests to match the new behavior of the text position iterator. Now the cursor can reach the position after the final glyph on a line, if that glyph is not a newline. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -421,16 +421,13 @@ func TestEditorLigature(t *testing.T) {
|
||||
// Ensure that all runes in the final cluster of a line are properly
|
||||
// decoded when moving to the end of the line. This is a regression test.
|
||||
e.moveEnd(selectionClear)
|
||||
// Because the first line is broken due to line wrapping, the last
|
||||
// rune of the line will not be before the cursor.
|
||||
assertCaret(t, e, 0, 13, len("fflffl fflffl"))
|
||||
// The first line was broken by line wrapping, not a newline character. As such,
|
||||
// the cursor can reach the position after the final glyph (a space).
|
||||
assertCaret(t, e, 0, 14, len("fflffl fflffl "))
|
||||
e.moveLines(1, selectionClear)
|
||||
// Because the space is at the beginning of the second line and
|
||||
// the second line is the final line, there are two more runes
|
||||
// before the cursor than on the first line.
|
||||
assertCaret(t, e, 1, 13, len("fflffl fflffl fflffl fflffl"))
|
||||
e.moveLines(-1, selectionClear)
|
||||
assertCaret(t, e, 0, 13, len("fflffl fflffl"))
|
||||
assertCaret(t, e, 0, 14, len("fflffl fflffl "))
|
||||
|
||||
// Absurdly narrow constraints to force each ligature onto its own line.
|
||||
gtx.Constraints = layout.Exact(image.Pt(10, 10))
|
||||
|
||||
Reference in New Issue
Block a user