test and App helper for mouse clicks

[?]
May 25, 2022, 8:38 PM
6E3HVYWFP3JLJ3DJ5BH4WGJUXQV5MDCBCE5GH3SXRHRQZOG4VJLQC

Dependencies

  • [2] AD34IX2Z couple more tests
  • [3] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [4] DLQMM265 scroll past first page
  • [5] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [6] DXT4QTAH a few more integer coordinates
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] YTSPVDZH first successful pagedown test, first bug found by test
  • [*] 3QNOKBFM beginnings of a test harness
  • [*] AVTNUQYR basic test-enabled framework

Change contents

  • edit in text.lua at line 143
    [2.1492]
    [9.198]
    function test_move_cursor_using_mouse()
    io.write('\ntest_move_cursor_using_mouse')
    App.screen.init{width=50, height=60}
    Lines = load_array{'abc', 'def', 'xyz'}
    Line_width = App.screen.width
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    App.draw() -- populate line.y for each line in Lines
    local screen_top_margin = 15 -- pixels
    local screen_left_margin = 25 -- pixels
    App.run_after_mousepress(screen_left_margin+8,screen_top_margin+5, '1')
    check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')
    check_eq(Cursor1.pos, 2, 'F - test_move_cursor_using_mouse/cursor:pos')
    end
  • replacement in text.lua at line 1000
    [3.433][3.180:214]()
    if x < 16 then return false end
    [3.433]
    [3.214]
    if x < 25 then return false end
  • edit in app.lua at line 185
    [9.3047]
    [11.7039]
    App.screen.contents = {}
    App.draw()
    end
    function App.run_after_mousepress(x,y, button)
    App.mousepressed(x,y, button)