about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-25 12:59:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-25 12:59:12 -0700
commitfa103ca2e8674dd389888d77f9ef60f361a0c704 (patch)
treef9aa4eb7a7d4ff588150614489e672e80b41753a /text.lua
parent299960553037fcaf93b545e85f7601b24c5975d8 (diff)
downloadview.love-fa103ca2e8674dd389888d77f9ef60f361a0c704.tar.gz
couple more tests
Along with the App helpers needed for them.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/text.lua b/text.lua
index 4bdadfb..200ed64 100644
--- a/text.lua
+++ b/text.lua
@@ -95,6 +95,51 @@ function test_draw_text()
   App.screen.check(y, 'ghi', 'F - test_draw_text/screen:3')
 end
 
+function test_draw_wrapping_text()
+  io.write('\ntest_draw_wrapping_text')
+  App.screen.init{width=50, height=60}
+  Lines = load_array{'abc', 'defgh', 'xyz'}
+  Line_width = App.screen.width
+  Cursor1 = {line=1, pos=1}
+  Screen_top1 = {line=1, pos=1}
+  Screen_bottom1 = {}
+  Zoom = 1
+  App.draw()
+  local screen_top_margin = 15  -- pixels
+  local line_height = 15  -- pixels
+  local y = screen_top_margin
+  App.screen.check(y, 'abc', 'F - test_draw_wrapping_text/screen:1')
+  y = y + line_height
+  App.screen.check(y, 'def', 'F - test_draw_wrapping_text/screen:2')
+  y = y + line_height
+  App.screen.check(y, 'gh', 'F - test_draw_wrapping_text/screen:3')
+end
+
+function test_edit_wrapping_text()
+  io.write('\ntest_edit_wrapping_text')
+  App.screen.init{width=50, height=60}
+  Lines = load_array{'abc', 'def', 'xyz'}
+  Line_width = App.screen.width
+  Cursor1 = {line=2, pos=4}
+  Screen_top1 = {line=1, pos=1}
+  Screen_bottom1 = {}
+  Zoom = 1
+  App.run_after_textinput('g')
+  App.run_after_textinput('h')
+  App.run_after_textinput('i')
+  App.run_after_textinput('j')
+  App.run_after_textinput('k')
+  App.run_after_textinput('l')
+  local screen_top_margin = 15  -- pixels
+  local line_height = 15  -- pixels
+  local y = screen_top_margin
+  App.screen.check(y, 'abc', 'F - test_edit_wrapping_text/screen:1')
+  y = y + line_height
+  App.screen.check(y, 'def', 'F - test_edit_wrapping_text/screen:2')
+  y = y + line_height
+  App.screen.check(y, 'ghij', 'F - test_edit_wrapping_text/screen:3')
+end
+
 function test_pagedown()
   io.write('\ntest_pagedown')
   App.screen.init{width=120, height=45}