couple of tests for cursor down
[?]
May 23, 2022, 5:56 PM
S5VCAFKYBM35HF3SI4MCAQROWBRUC7YHWJMKWC6GWTTV5PHUCEFACDependencies
- [2]
U7M4M2F7bugfix: don't rely on Screen_bottom1 while scrolling - [3]
AVQ5MC5Dfinish uppercasing all globals - [4]
Y6FTGOHJsimpler - [5]
XX7G2FFJintermingle freehand line drawings with text - [6]
IRV65LZPfold variables for screen dimensions into the app framework - [7]
UWNHC4AAredo y computations - [8]
2POFQQLWkeep cursor on screen when pressing 'down' - [9]
2RXZ3PGObeginning of a new approach to scroll+wrap - [10]
YTSPVDZHfirst successful pagedown test, first bug found by test - [11]
DLQMM265scroll past first page - [12]
7IKRRESBlonger names for indices in long loops - [13]
QYIFOHW3first test! - [14]
OTIBCAUJlove2d scaffold - [15]
ESETRNLBbugfix: printing the first part of a line at the bottom made it seem non-wrapping - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- replacement in text.lua at line 127
function test_pagedown_skip_drawings()print('test_pagedown_skip_drawings')function test_pagedown_skips_drawings()print('test_pagedown_skips_drawings') - replacement in text.lua at line 135
check_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skip_drawings/baseline/lines')check_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skips_drawings/baseline/lines') - replacement in text.lua at line 148
App.screen.check(y, 'abc', 'F - test_pagedown_skip_drawings/baseline/screen:1')App.screen.check(y, 'abc', 'F - test_pagedown_skips_drawings/baseline/screen:1') - replacement in text.lua at line 152
print('test: top:', Screen_top1.line)--? print('test: top:', Screen_top1.line) - replacement in text.lua at line 154
App.screen.check(y, 'def', 'F - test_pagedown_skip_drawings/screen:1')App.screen.check(y, 'def', 'F - test_pagedown_skips_drawings/screen:1')endfunction test_down_arrow_moves_cursor()print('test_down_arrow_moves_cursor')App.screen.init{width=120, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Line_width = 120Cursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1local screen_top_margin = 15 -- pixelslocal line_height = math.floor(15*Zoom) -- pixels-- initially the first three lines are displayedApp.draw()local y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_down_arrow_moves_cursor/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_down_arrow_moves_cursor/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_down_arrow_moves_cursor/baseline/screen:3')-- after hitting the down arrow the screen is unchangedApp.run_after_keychord('down')y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_down_arrow_moves_cursor/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_down_arrow_moves_cursor/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_down_arrow_moves_cursor/screen:3')-- but the cursor moves down by 1 linecheck_eq(Cursor1.line, 2, 'F - test_down_arrow_moves_cursor/cursor')endfunction test_down_arrow_scrolls_down_by_one_line()print('test_down_arrow_scrolls_down_by_one_line')-- display the first three lines with the cursor on the bottom lineApp.screen.init{width=120, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Line_width = 120Cursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1local screen_top_margin = 15 -- pixelslocal line_height = math.floor(15*Zoom) -- pixelsApp.draw()local y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_down_arrow_scrolls_down_by_one_line/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_down_arrow_scrolls_down_by_one_line/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_down_arrow_scrolls_down_by_one_line/baseline/screen:3')-- after hitting the down arrow the screen scrolls down by one lineApp.run_after_keychord('down')y = screen_top_marginApp.screen.check(y, 'def', 'F - test_down_arrow_scrolls_down_by_one_line/screen:1')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_down_arrow_scrolls_down_by_one_line/screen:2')y = y + line_heightApp.screen.check(y, 'jkl', 'F - test_down_arrow_scrolls_down_by_one_line/screen:3') - replacement in main.lua at line 125
print(y, line_index, line)--? print(y, line_index, line) - replacement in main.lua at line 128
print('a')--? print('a')