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-12 10:46:25 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-12 10:59:42 -0700
commit26640c9101c68f504a552e131e35dd9063172c45 (patch)
treef122ee691fd9b972e5c57de3828c3b2a8a573832 /text_tests.lua
parent4f6478483306bcd1f1b8aa033134b20c4a116aad (diff)
downloadlines.love-26640c9101c68f504a552e131e35dd9063172c45.tar.gz
new test
For commit e4e12c77ad which fixed a regression caused by commit
24a0d162ef.
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 6b92153..440cec7 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -23,6 +23,23 @@ function test_press_ctrl()
   App.run_after_keychord('C-m')
 end
 
+function test_click_with_mouse()
+  io.write('\ntest_click')
+  -- display two lines with cursor on one of them
+  App.screen.init{width=50, height=80}
+  Lines = load_array{'abc', 'def'}
+  Line_width = App.screen.width
+  Cursor1 = {line=2, pos=1}
+  Screen_top1 = {line=1, pos=1}
+  Screen_bottom1 = {}
+  -- click on the other line
+  local screen_left_margin = 25  -- pixels
+  App.draw()
+  App.run_after_mouse_click(screen_left_margin+8,Margin_top+5, '1')
+  -- cursor moves
+  check_eq(Cursor1.line, 1, 'F - test_click/cursor')
+end
+
 function test_draw_text()
   io.write('\ntest_draw_text')
   App.screen.init{width=120, height=60}