diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2023-03-17 22:29:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2023-03-17 22:30:46 -0700 |
commit | eca407cf00072a61660045cf08def0350058f572 (patch) | |
tree | a8d3f4ae2489e04aed3eba3b6d721642f6b43abd /source_text_tests.lua | |
parent | 4dbc097f835218bc44dd1d96134294a0bc5ce725 (diff) | |
parent | 6709b394fba8dbc8cdfaaf3a9461e79ce7b0c2e0 (diff) | |
download | text.love-eca407cf00072a61660045cf08def0350058f572.tar.gz |
Merge lines.love
Diffstat (limited to 'source_text_tests.lua')
-rw-r--r-- | source_text_tests.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source_text_tests.lua b/source_text_tests.lua index 2385325..7a7d71c 100644 --- a/source_text_tests.lua +++ b/source_text_tests.lua @@ -1251,6 +1251,28 @@ function test_up_arrow_scrolls_up_by_one_line() App.screen.check(y, 'ghi', 'screen:3') end +function test_up_arrow_scrolls_up_by_one_line_skipping_drawing() + -- display lines 3/4/5 with a drawing just off screen at line 2 + App.screen.init{width=120, height=60} + Editor_state = edit.initialize_test_state() + Editor_state.lines = load_array{'abc', '```lines', '```', 'def', 'ghi', 'jkl'} + Text.redraw_all(Editor_state) + Editor_state.cursor1 = {line=3, pos=1} + Editor_state.screen_top1 = {line=3, pos=1} + Editor_state.screen_bottom1 = {} + edit.draw(Editor_state) + local y = Editor_state.top + App.screen.check(y, 'def', 'baseline/screen:1') + y = y + Editor_state.line_height + App.screen.check(y, 'ghi', 'baseline/screen:2') + y = y + Editor_state.line_height + App.screen.check(y, 'jkl', 'baseline/screen:3') + -- after hitting the up arrow the screen scrolls up to previous text line + edit.run_after_keychord(Editor_state, 'up') + check_eq(Editor_state.screen_top1.line, 1, 'screen_top') + check_eq(Editor_state.cursor1.line, 1, 'cursor') +end + function test_up_arrow_scrolls_up_by_one_screen_line() -- display lines starting from second screen line of a line App.screen.init{width=Editor_state.left+30, height=60} |