couple of tests for cursor down

[?]
May 23, 2022, 5:56 PM
S5VCAFKYBM35HF3SI4MCAQROWBRUC7YHWJMKWC6GWTTV5PHUCEFAC

Dependencies

  • [2] U7M4M2F7 bugfix: don't rely on Screen_bottom1 while scrolling
  • [3] AVQ5MC5D finish uppercasing all globals
  • [4] Y6FTGOHJ simpler
  • [5] XX7G2FFJ intermingle freehand line drawings with text
  • [6] IRV65LZP fold variables for screen dimensions into the app framework
  • [7] UWNHC4AA redo y computations
  • [8] 2POFQQLW keep cursor on screen when pressing 'down'
  • [9] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [10] YTSPVDZH first successful pagedown test, first bug found by test
  • [11] DLQMM265 scroll past first page
  • [12] 7IKRRESB longer names for indices in long loops
  • [13] QYIFOHW3 first test!
  • [14] OTIBCAUJ love2d scaffold
  • [15] ESETRNLB bugfix: printing the first part of a line at the bottom made it seem non-wrapping
  • [*] BULPIBEG beginnings of a module for the text editor

Change contents

  • replacement in text.lua at line 127
    [3.1045][3.1045:1123]()
    function test_pagedown_skip_drawings()
    print('test_pagedown_skip_drawings')
    [3.1045]
    [3.1123]
    function test_pagedown_skips_drawings()
    print('test_pagedown_skips_drawings')
  • replacement in text.lua at line 135
    [2.282][3.1336:1423](),[3.1336][3.1336:1423]()
    check_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skip_drawings/baseline/lines')
    [2.282]
    [3.1423]
    check_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skips_drawings/baseline/lines')
  • replacement in text.lua at line 148
    [3.1765][3.1765:1847]()
    App.screen.check(y, 'abc', 'F - test_pagedown_skip_drawings/baseline/screen:1')
    [3.1765]
    [3.1847]
    App.screen.check(y, 'abc', 'F - test_pagedown_skips_drawings/baseline/screen:1')
  • replacement in text.lua at line 152
    [3.1939][2.641:681]()
    print('test: top:', Screen_top1.line)
    [3.1939]
    [3.1939]
    --? print('test: top:', Screen_top1.line)
  • replacement in text.lua at line 154
    [3.1980][3.1980:2053]()
    App.screen.check(y, 'def', 'F - test_pagedown_skip_drawings/screen:1')
    [3.1980]
    [3.2148]
    App.screen.check(y, 'def', 'F - test_pagedown_skips_drawings/screen:1')
    end
    function 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 = 120
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    local screen_top_margin = 15 -- pixels
    local line_height = math.floor(15*Zoom) -- pixels
    -- initially the first three lines are displayed
    App.draw()
    local y = screen_top_margin
    App.screen.check(y, 'abc', 'F - test_down_arrow_moves_cursor/baseline/screen:1')
    y = y + line_height
    App.screen.check(y, 'def', 'F - test_down_arrow_moves_cursor/baseline/screen:2')
    y = y + line_height
    App.screen.check(y, 'ghi', 'F - test_down_arrow_moves_cursor/baseline/screen:3')
    -- after hitting the down arrow the screen is unchanged
    App.run_after_keychord('down')
    y = screen_top_margin
    App.screen.check(y, 'abc', 'F - test_down_arrow_moves_cursor/screen:1')
    y = y + line_height
    App.screen.check(y, 'def', 'F - test_down_arrow_moves_cursor/screen:2')
    y = y + line_height
    App.screen.check(y, 'ghi', 'F - test_down_arrow_moves_cursor/screen:3')
    -- but the cursor moves down by 1 line
    check_eq(Cursor1.line, 2, 'F - test_down_arrow_moves_cursor/cursor')
    end
    function 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 line
    App.screen.init{width=120, height=60}
    Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
    Line_width = 120
    Cursor1 = {line=3, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    local screen_top_margin = 15 -- pixels
    local line_height = math.floor(15*Zoom) -- pixels
    App.draw()
    local y = screen_top_margin
    App.screen.check(y, 'abc', 'F - test_down_arrow_scrolls_down_by_one_line/baseline/screen:1')
    y = y + line_height
    App.screen.check(y, 'def', 'F - test_down_arrow_scrolls_down_by_one_line/baseline/screen:2')
    y = y + line_height
    App.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 line
    App.run_after_keychord('down')
    y = screen_top_margin
    App.screen.check(y, 'def', 'F - test_down_arrow_scrolls_down_by_one_line/screen:1')
    y = y + line_height
    App.screen.check(y, 'ghi', 'F - test_down_arrow_scrolls_down_by_one_line/screen:2')
    y = y + line_height
    App.screen.check(y, 'jkl', 'F - test_down_arrow_scrolls_down_by_one_line/screen:3')
  • replacement in main.lua at line 125
    [3.44][2.989:1020]()
    print(y, line_index, line)
    [3.44]
    [3.2297]
    --? print(y, line_index, line)
  • replacement in main.lua at line 128
    [3.404][2.1021:1036]()
    print('a')
    [3.404]
    [3.9247]
    --? print('a')