override mouse state lookups in tests

[?]
Jun 12, 2022, 3:26 PM
JFFUF5ALUWPDM7IEDEZVAYG2SVXO334STONRGKVB3QKY2TT5QGBQC

Dependencies

  • [2] PTT4K4EU use the provided args everywhere
  • [3] VCMS2CWT bugfix: escape key to hide online help
  • [4] H4K2GFIL experiment: give up on changing shape mode
  • [5] F3OOGMME switch freehand hotkey to eliminate conflict with search
  • [6] WSXSEZQ2 switch circles to 'o' to avoid conflicting with copy
  • [7] RMKMPFT5 fix a corner case when selecting text
  • [8] JAXPXLEB set current_drawing_index with current_drawing
  • [9] G3C4FKPR bugfix: missed fixing a callsite
  • [10] IDG26SXK bugfix in commit e51ce12969
  • [11] BTKAW76L rename
  • [12] G6OYAYHU paste in text with M-v
  • [13] 3RGHOJ25 DRY some code
  • [14] 65XHTZEK regression: couldn't do many drawing operations because line.y was reset
  • [15] LXTTOB33 extract a couple of files
  • [16] YJGADSGK delete unused arg
  • [17] 6DE7RBZ6 move mouse_released events to Drawing
  • [18] 2ENZW7TV select text using mouse drag
  • [19] AD34IX2Z couple more tests
  • [20] 2MA33THZ few more transitions between shapes
  • [21] HOSPP2AN crisp font rendering
  • [22] SN2QONLI autosave on cut/paste
  • [23] NZKYPBSK check for scroll when just typing
  • [24] NYQ7HD4D move
  • [25] 6E3HVYWF test and App helper for mouse clicks
  • [26] NQWWTGXR switch undo/redo to ctrl- hotkeys
  • [27] Z4XRNDTR find text
  • [28] ZLJGZYQG select text with shift + mouseclick
  • [29] 6UZ2JNZE yet another key conflict
  • [30] R6GUSTBY default font size and line-height
  • [31] YCDYGEZU include drawing index in a few places
  • [32] PFT5Y2ZY move
  • [33] VC2CU2GG faster paste
  • [34] BLWAYPKV extract a module
  • [35] VHQCNMAR several more modules
  • [36] 7OUJM7DL one missing transition between shape modes
  • [37] BYG5CEMV support for naming points
  • [38] XRLJDW3W casting about for more helpers to extract..
  • [39] SRVDX4I5 local var
  • [40] JF5L2BBS test harness now supports copy/paste
  • [41] 4QQBMWLL regression: typing uppercase letters in text
  • [42] WIDXZBNW experiment: extremely precise scrolling on paste
  • [43] T7IWZFL4 more precise scroll on paste
  • [44] LUNH47XX make text and drawings the same width
  • [45] 7SFHSB47 rename
  • [46] XNFTJHC4 split keyboard handling between Text and Drawing
  • [47] JCSLDGAH beginnings of support for multiple shapes
  • [48] NP7PIUBT bugfix: restore state after C-f (find)
  • [49] FHSZYAZ2 more precise search highlighting
  • [50] R22PA3XR fix a second BSOD in #4 :/
  • [51] YTSPVDZH first successful pagedown test, first bug found by test
  • [52] 252M2QMD forgot to move this special case out
  • [53] AJB4LFRB try to maintain a reasonable line width
  • [54] TVM2WIHH bugfix: autosave and undo in a couple of cases
  • [55] RT6EV6OP delegate update events to drawings
  • [56] WAR3HXHT test both ways of selecting text with mouse
  • [57] SR7L4QPZ revert previous commit
  • [58] 3TCZ7ADH move
  • [59] WTDKUACN rectangle and square shapes
  • [60] LS55YKGW switch copy/paste to ctrl- hotkeys
  • [61] 2ZYV7D3W handle tab characters
  • [62] HIKLULFQ extract a function
  • [63] VFJEVPPO bugfix: function names
  • [64] AVTNUQYR basic test-enabled framework
  • [65] DLQMM265 scroll past first page
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] OTIBCAUJ love2d scaffold
  • [*] 3QNOKBFM beginnings of a test harness

Change contents

  • replacement in text_tests.lua at line 174
    [11.6031][11.6031:6100]()
    App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1')
    [11.6031]
    [11.6100]
    App.run_after_mouse_release(screen_left_margin+8,Margin_top+5, '1')
  • replacement in text_tests.lua at line 193
    [11.40][11.40:107]()
    App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1')
    [11.40]
    [11.107]
    App.run_after_mouse_press(screen_left_margin+8,Margin_top+5, '1')
  • replacement in text_tests.lua at line 195
    [11.144][11.144:226]()
    App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1')
    [11.144]
    [11.376]
    App.run_after_mouse_release(screen_left_margin+20,Margin_top+Line_height+5, '1')
  • replacement in text_tests.lua at line 214
    [11.610][11.610:746]()
    App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1')
    App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1')
    [11.610]
    [11.746]
    App.run_after_mouse_press(screen_left_margin+8,Margin_top+5, '1')
    App.run_after_mouse_release(screen_left_margin+8,Margin_top+5, '1')
  • replacement in text_tests.lua at line 217
    [11.792][11.792:994]()
    App.keypress('lshift')
    App.run_after_mousepress(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1')
    App.keyrelease('lshift')
    [11.792]
    [11.1131]
    App.fake_key_press('lshift')
    App.run_after_mouse_press(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouse_release(screen_left_margin+20,Margin_top+Line_height+5, '1')
    App.fake_key_release('lshift')
  • replacement in text_tests.lua at line 239
    [7.475][7.475:611]()
    App.run_after_mousepress(screen_left_margin+8,Margin_top+5, '1')
    App.run_after_mouserelease(screen_left_margin+8,Margin_top+5, '1')
    [7.475]
    [7.611]
    App.run_after_mouse_press(screen_left_margin+8,Margin_top+5, '1')
    App.run_after_mouse_release(screen_left_margin+8,Margin_top+5, '1')
  • replacement in text_tests.lua at line 242
    [7.663][7.663:838]()
    App.keypress('lshift')
    App.run_after_mousepress(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouserelease(screen_left_margin+20,Margin_top+Line_height+5, '1')
    [7.663]
    [7.838]
    App.fake_key_press('lshift')
    App.run_after_mouse_press(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouse_release(screen_left_margin+20,Margin_top+Line_height+5, '1')
  • replacement in text_tests.lua at line 246
    [7.889][7.889:1090]()
    App.keypress('lshift')
    App.run_after_mousepress(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouserelease(screen_left_margin+8,Margin_top+Line_height+5, '1')
    App.keyrelease('lshift')
    [7.889]
    [7.1090]
    App.fake_key_press('lshift')
    App.run_after_mouse_press(screen_left_margin+20,Margin_top+5, '1')
    App.run_after_mouse_release(screen_left_margin+8,Margin_top+Line_height+5, '1')
    App.fake_key_release('lshift')
  • replacement in text_tests.lua at line 887
    [11.33047][11.33047:33130]()
    App.run_after_mouserelease(screen_left_margin+8,Margin_top+Line_height*2+5, '1')
    [11.33047]
    [11.33130]
    App.run_after_mouse_release(screen_left_margin+8,Margin_top+Line_height*2+5, '1')
  • replacement in text.lua at line 139
    [11.28][11.69:113](),[11.69][11.69:113]()
    if love.mouse.isDown('1') then return end
    [11.28]
    [11.1]
    if App.mouse_down('1') then return end
  • replacement in select.lua at line 16
    [11.44671][11.44671:44704]()
    if love.mouse.isDown('1') then
    [11.44671]
    [11.44704]
    if App.mouse_down('1') then
  • replacement in select.lua at line 87
    [11.46079][11.46079:46148]()
    local line,pos = Text.to_pos(love.mouse.getX(), love.mouse.getY())
    [11.46079]
    [11.46148]
    local line,pos = Text.to_pos(App.mouse_x(), App.mouse_y())
  • replacement in main.lua at line 449
    [11.265][11.3819:3882](),[11.646][11.3819:3882](),[11.1992][11.3819:3882](),[11.4816][11.3819:3882](),[11.3819][11.3819:3882]()
    elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then
    [11.1992]
    [11.426]
    elseif App.mouse_down('1') or chord:sub(1,2) == 'C-' then
  • replacement in main.lua at line 458
    [11.217][11.3:62](),[10.233][11.3:62](),[11.5015][11.3:62]()
    elseif chord == 'escape' and love.mouse.isDown('1') then
    [10.233]
    [9.8]
    elseif chord == 'escape' and App.mouse_down('1') then
  • replacement in main.lua at line 463
    [3.11][3.11:74]()
    elseif chord == 'escape' and not love.mouse.isDown('1') then
    [3.11]
    [3.74]
    elseif chord == 'escape' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 8
    [11.66][11.179:234](),[11.179][11.179:234]()
    local pmx,pmy = love.mouse.getX(), love.mouse.getY()
    [11.66]
    [11.316]
    local pmx,pmy = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 18
    [11.598][11.598:663]()
    if love.mouse.isDown('1') and love.keyboard.isDown('h') then
    [11.598]
    [11.663]
    if App.mouse_down('1') and love.keyboard.isDown('h') then
  • replacement in drawing.lua at line 119
    [11.1944][2.10:104]()
    local mx,my = Drawing.coord(love.mouse.getX()-left), Drawing.coord(love.mouse.getY()-top)
    [11.1944]
    [11.2082]
    local mx,my = Drawing.coord(App.mouse_x()-left), Drawing.coord(App.mouse_y()-top)
  • replacement in drawing.lua at line 126
    [11.2327][2.105:199]()
    local mx,my = Drawing.coord(love.mouse.getX()-left), Drawing.coord(love.mouse.getY()-top)
    [11.2327]
    [11.2465]
    local mx,my = Drawing.coord(App.mouse_x()-left), Drawing.coord(App.mouse_y()-top)
  • replacement in drawing.lua at line 146
    [11.3256][11.3256:3372]()
    love.graphics.line(Drawing.pixels(prev.x)+left,Drawing.pixels(prev.y)+top, love.mouse.getX(),love.mouse.getY())
    [11.3256]
    [11.1853]
    love.graphics.line(Drawing.pixels(prev.x)+left,Drawing.pixels(prev.y)+top, App.mouse_x(),App.mouse_y())
  • replacement in drawing.lua at line 148
    [11.1893][11.1893:1950]()
    local pmx,pmy = love.mouse.getX(), love.mouse.getY()
    [11.1893]
    [11.1950]
    local pmx,pmy = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 162
    [11.2973][11.2973:3030]()
    local pmx,pmy = love.mouse.getX(), love.mouse.getY()
    [11.2973]
    [11.3030]
    local pmx,pmy = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 177
    [11.3457][2.200:294]()
    local mx,my = Drawing.coord(love.mouse.getX()-left), Drawing.coord(love.mouse.getY()-top)
    [11.3457]
    [11.3555]
    local mx,my = Drawing.coord(App.mouse_x()-left), Drawing.coord(App.mouse_y()-top)
  • replacement in drawing.lua at line 182
    [11.3715][11.3715:3810]()
    love.graphics.circle('line', cx,cy, geom.dist(cx,cy, love.mouse.getX(),love.mouse.getY()))
    [11.3715]
    [11.3810]
    love.graphics.circle('line', cx,cy, geom.dist(cx,cy, App.mouse_x(),App.mouse_y()))
  • replacement in drawing.lua at line 185
    [11.3892][2.295:389]()
    local mx,my = Drawing.coord(love.mouse.getX()-left), Drawing.coord(love.mouse.getY()-top)
    [11.3892]
    [11.3990]
    local mx,my = Drawing.coord(App.mouse_x()-left), Drawing.coord(App.mouse_y()-top)
  • replacement in drawing.lua at line 235
    [11.254][11.254:339]()
    local x, y = love.mouse.getX(), love.mouse.getY()
    if love.mouse.isDown('1') then
    [11.254]
    [11.339]
    local x, y = App.mouse_x(), App.mouse_y()
    if App.mouse_down('1') then
  • replacement in drawing.lua at line 239
    [11.433][11.433:565]()
    table.insert(drawing.pending.points, {x=Drawing.coord(love.mouse.getX()-16), y=Drawing.coord(love.mouse.getY()-drawing.y)})
    [11.433]
    [11.565]
    table.insert(drawing.pending.points, {x=Drawing.coord(App.mouse_x()-16), y=Drawing.coord(App.mouse_y()-drawing.y)})
  • replacement in drawing.lua at line 286
    [11.1032][11.1032:1122]()
    love.mouse.setPosition(16+Drawing.pixels(p2.x), drawing.y+Drawing.pixels(p2.y))
    [11.1032]
    [11.1122]
    App.mouse_move(16+Drawing.pixels(p2.x), drawing.y+Drawing.pixels(p2.y))
  • replacement in drawing.lua at line 352
    [11.5258][5.104:160]()
    if chord == 'C-p' and not love.mouse.isDown('1') then
    [11.5258]
    [11.5820]
    if chord == 'C-p' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 354
    [11.5858][11.5858:5918]()
    elseif chord == 'C-g' and not love.mouse.isDown('1') then
    [11.5858]
    [11.5918]
    elseif chord == 'C-g' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 356
    [11.5955][11.5955:6009]()
    elseif love.mouse.isDown('1') and chord == 'g' then
    [11.5955]
    [11.6009]
    elseif App.mouse_down('1') and chord == 'g' then
  • replacement in drawing.lua at line 371
    [11.6652][11.6407:6467]()
    elseif chord == 'C-r' and not love.mouse.isDown('1') then
    [11.6652]
    [11.6467]
    elseif chord == 'C-r' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 373
    [11.6506][11.6506:6560]()
    elseif love.mouse.isDown('1') and chord == 'r' then
    [11.6506]
    [11.6560]
    elseif App.mouse_down('1') and chord == 'r' then
  • replacement in drawing.lua at line 388
    [11.7207][11.7207:7267]()
    elseif chord == 'C-s' and not love.mouse.isDown('1') then
    [11.7207]
    [11.7267]
    elseif chord == 'C-s' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 390
    [11.7303][11.7303:7357]()
    elseif love.mouse.isDown('1') and chord == 's' then
    [11.7303]
    [11.7357]
    elseif App.mouse_down('1') and chord == 's' then
  • replacement in drawing.lua at line 409
    [11.7998][11.7998:8167]()
    elseif love.mouse.isDown('1') and chord == 'p' and (Current_drawing_mode == 'polygon' or Current_drawing_mode == 'rectangle' or Current_drawing_mode == 'square') then
    [11.7998]
    [11.163]
    elseif App.mouse_down('1') and chord == 'p' and (Current_drawing_mode == 'polygon' or Current_drawing_mode == 'rectangle' or Current_drawing_mode == 'square') then
  • replacement in drawing.lua at line 411
    [11.211][11.6790:6888](),[11.6790][11.6790:6888]()
    local mx,my = Drawing.coord(love.mouse.getX()-16), Drawing.coord(love.mouse.getY()-drawing.y)
    [11.211]
    [11.6888]
    local mx,my = Drawing.coord(App.mouse_x()-16), Drawing.coord(App.mouse_y()-drawing.y)
  • replacement in drawing.lua at line 414
    [11.6992][6.186:246]()
    elseif chord == 'C-o' and not love.mouse.isDown('1') then
    [11.6992]
    [11.7052]
    elseif chord == 'C-o' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 416
    [11.7088][11.7088:7179]()
    elseif love.mouse.isDown('1') and chord == 'a' and Current_drawing_mode == 'circle' then
    [11.7088]
    [11.212]
    elseif App.mouse_down('1') and chord == 'a' and Current_drawing_mode == 'circle' then
  • replacement in drawing.lua at line 419
    [11.7258][11.7258:7356]()
    local mx,my = Drawing.coord(love.mouse.getX()-16), Drawing.coord(love.mouse.getY()-drawing.y)
    [11.7258]
    [11.7356]
    local mx,my = Drawing.coord(App.mouse_x()-16), Drawing.coord(App.mouse_y()-drawing.y)
  • replacement in drawing.lua at line 424
    [11.7608][6.247:301]()
    elseif love.mouse.isDown('1') and chord == 'o' then
    [11.7608]
    [11.7662]
    elseif App.mouse_down('1') and chord == 'o' then
  • replacement in drawing.lua at line 435
    [11.8206][11.8206:8260]()
    elseif love.mouse.isDown('1') and chord == 'l' then
    [11.8206]
    [11.8260]
    elseif App.mouse_down('1') and chord == 'l' then
  • replacement in drawing.lua at line 446
    [11.8788][4.11:71]()
    elseif chord == 'C-l' and not love.mouse.isDown('1') then
    [11.8788]
    [11.8817]
    elseif chord == 'C-l' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 448
    [11.8974][11.8974:9028]()
    elseif love.mouse.isDown('1') and chord == 'm' then
    [11.8851]
    [11.9028]
    elseif App.mouse_down('1') and chord == 'm' then
  • replacement in drawing.lua at line 461
    [11.9641][11.9641:9701]()
    elseif chord == 'C-m' and not love.mouse.isDown('1') then
    [11.9641]
    [11.9701]
    elseif chord == 'C-m' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 463
    [11.9866][11.9866:9926]()
    elseif chord == 'C-s' and not love.mouse.isDown('1') then
    [11.9740]
    [11.9926]
    elseif chord == 'C-s' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 468
    [11.10036][11.213:273]()
    elseif chord == 'C-u' and not love.mouse.isDown('1') then
    [11.10036]
    [8.16]
    elseif chord == 'C-u' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 479
    [11.10365][11.10365:10419]()
    elseif love.mouse.isDown('1') and chord == 'v' then
    [11.10365]
    [8.138]
    elseif App.mouse_down('1') and chord == 'v' then
  • replacement in drawing.lua at line 490
    [11.1826][11.1826:1886]()
    elseif chord == 'C-n' and not love.mouse.isDown('1') then
    [11.1826]
    [8.260]
    elseif chord == 'C-n' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 503
    [11.10688][11.10688:10748]()
    elseif chord == 'C-d' and not love.mouse.isDown('1') then
    [11.10688]
    [11.546]
    elseif chord == 'C-d' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 526
    [11.11429][11.11429:11489]()
    elseif chord == 'C-h' and not love.mouse.isDown('1') then
    [11.11429]
    [11.11489]
    elseif chord == 'C-h' and not App.mouse_down('1') then
  • replacement in drawing.lua at line 583
    [11.19112][11.19112:19164]()
    local x, y = love.mouse.getX(), love.mouse.getY()
    [11.19112]
    [11.605]
    local x, y = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 597
    [11.19530][11.19530:19586]()
    local x, y = love.mouse.getX(), love.mouse.getY()
    [11.19530]
    [11.702]
    local x, y = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 614
    [11.20133][11.20133:20189]()
    local x, y = love.mouse.getX(), love.mouse.getY()
    [11.20133]
    [11.820]
    local x, y = App.mouse_x(), App.mouse_y()
  • replacement in drawing.lua at line 631
    [11.20728][11.20728:20784]()
    local x, y = love.mouse.getX(), love.mouse.getY()
    [11.20728]
    [11.938]
    local x, y = App.mouse_x(), App.mouse_y()
  • edit in app.lua at line 135
    [11.2328]
    [11.2328]
    App.fake_key_pressed = {}
    App.fake_mouse_state = {x=-1, y=-1}
  • replacement in app.lua at line 191
    [11.1976][11.1976:2058]()
    App.modifier_keys = {}
    function App.keypress(key)
    App.modifier_keys[key] = true
    [11.1976]
    [11.2058]
    App.fake_key_pressed = {}
    function App.fake_key_press(key)
    App.fake_key_pressed[key] = true
    end
    function App.fake_key_release(key)
    App.fake_key_pressed[key] = nil
  • replacement in app.lua at line 198
    [11.2062][11.2062:2122]()
    function App.keyrelease(key)
    App.modifier_keys[key] = nil
    [11.2062]
    [11.2122]
    function App.modifier_down(key)
    return App.fake_key_pressed[key]
  • replacement in app.lua at line 202
    [11.2127][11.2127:2191]()
    function App.modifier_down(key)
    return App.modifier_keys[key]
    [11.2127]
    [11.2948]
    App.fake_mouse_state = {x=-1, y=-1} -- x,y always set
    function App.fake_mouse_press(x,y, button)
    App.fake_mouse_state.x = x
    App.fake_mouse_state.y = y
    App.fake_mouse_state[button] = true
    end
    function App.fake_mouse_release(x,y, button)
    App.fake_mouse_state.x = x
    App.fake_mouse_state.y = y
    App.fake_mouse_state[button] = nil
    end
    function App.mouse_move(x,y)
    App.fake_mouse_state.x = x
    App.fake_mouse_state.y = y
    end
    function App.mouse_down(button)
    return App.fake_mouse_state[button]
    end
    function App.mouse_x()
    return App.fake_mouse_state.x
    end
    function App.mouse_y()
    return App.fake_mouse_state.y
  • replacement in app.lua at line 239
    [11.755][11.755:802]()
    function App.run_after_mousepress(x,y, button)
    [11.755]
    [11.802]
    function App.run_after_mouse_press(x,y, button)
    App.fake_mouse_press(x,y, button)
  • replacement in app.lua at line 246
    [11.722][11.722:771]()
    function App.run_after_mouserelease(x,y, button)
    [11.722]
    [11.771]
    function App.run_after_mouse_release(x,y, button)
    App.fake_mouse_release(x,y, button)
  • replacement in app.lua at line 314
    [11.2236][11.2236:2262]()
    App.modifier_keys = nil
    [11.2236]
    [11.7943]
    App.fake_key_pressed = nil
    App.fake_key_press = nil
    App.fake_key_release = nil
    App.fake_mouse_state = nil
    App.fake_mouse_press = nil
    App.fake_mouse_release = nil
  • edit in app.lua at line 329
    [11.2306]
    [11.8162]
    App.mouse_move = love.mouse.setPosition
    App.mouse_down = love.mouse.isDown
    App.mouse_x = love.mouse.getX
    App.mouse_y = love.mouse.getY