about summary refs log tree commit diff stats
path: root/text_tests.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-14 07:30:47 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-14 08:01:53 -0700
commit9b0577f79eb87be1d2f3a8af09dc9830b14e63c1 (patch)
treeb65eab0dea6ff678fb8f0ec9e6ae9f7671bc1a63 /text_tests.lua
parent5b6171cf02e4dce0d872cba768daf85a1a24dd5f (diff)
downloadtext.love-9b0577f79eb87be1d2f3a8af09dc9830b14e63c1.tar.gz
bugfix: UTF-8 in compute_fragments
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 93e953c..8aa7085 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -109,6 +109,24 @@ function test_draw_text_wrapping_within_word()
   App.screen.check(y, 'jk', 'F - test_draw_text_wrapping_within_word/screen:3')
 end
 
+function test_draw_wrapping_text_containing_non_ascii()
+  -- draw a long line containing non-ASCII
+  io.write('\ntest_draw_wrapping_text_containing_non_ascii')
+  App.screen.init{width=60, height=60}
+  Lines = load_array{'madam I’m adam', 'xyz'}  -- notice the non-ASCII apostrophe
+  Line_width = App.screen.width
+  Cursor1 = {line=1, pos=1}
+  Screen_top1 = {line=1, pos=1}
+  Screen_bottom1 = {}
+  App.draw()
+  local y = Margin_top
+  App.screen.check(y, 'mada', 'F - test_draw_wrapping_text_containing_non_ascii/screen:1')
+  y = y + Line_height
+  App.screen.check(y, 'm I’', 'F - test_draw_wrapping_text_containing_non_ascii/screen:2')
+  y = y + Line_height
+  App.screen.check(y, 'm ad', 'F - test_draw_wrapping_text_containing_non_ascii/screen:3')
+end
+
 function test_edit_wrapping_text()
   io.write('\ntest_edit_wrapping_text')
   App.screen.init{width=50, height=60}