From 9f62230c380f29d346663db2acf96aba86cafc65 Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Mon, 17 Oct 2022 09:59:41 -0400 Subject: [PATCH] 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 --- widget/editor_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/widget/editor_test.go b/widget/editor_test.go index 76034956..b0aa2313 100644 --- a/widget/editor_test.go +++ b/widget/editor_test.go @@ -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)) -- 2.45.2