couple more tests

[?]
May 25, 2022, 7:59 PM
AD34IX2ZSGYGU3LGY2IZOZNKD4HRQOYJVG5UWMWLXJZJSM62FFOAC

Dependencies

  • [2] 4RUI5X52 a few tests for pageup, and a bugfix
  • [3] 2C7CTIQY make space for multiple kinds of width
  • [4] A2TQYJ6J .
  • [5] BLWAYPKV extract a module
  • [6] RCDVDFJQ comment
  • [7] BYG5CEMV support for naming points
  • [8] IYW7X3WL left/right cursor movement, deleting characters
  • [9] 6PUNJS5B backspace
  • [10] MGOQ5XAV start uppercasing globals
  • [11] DAENUOGV eliminate assumptions that line length == size in bytes
  • [12] SVJZZDC3 snapshot - no, that's all wrong
  • [13] OTIBCAUJ love2d scaffold
  • [14] AVQ5MC5D finish uppercasing all globals
  • [15] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [16] VVXVV2D2 change data model; text can now have metadata
  • [17] 6LJZN727 handle chords
  • [18] G77XIN7M selecting a stroke
  • [19] IRV65LZP fold variables for screen dimensions into the app framework
  • [20] OIB2QPRC start remembering where the cursor is drawn in px
  • [21] AVTNUQYR basic test-enabled framework
  • [22] MNWHXPBL more lightweight; select just the stroke at the mouse
  • [23] YKRF5V3Z starting to load/save
  • [24] KJKKASHZ reduce ambitions a bit: page up/down need not start screen from the middle of a line
  • [25] 3QNOKBFM beginnings of a test harness
  • [26] VHQCNMAR several more modules
  • [27] JCSLDGAH beginnings of support for multiple shapes
  • [28] XX7G2FFJ intermingle freehand line drawings with text
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] QYIFOHW3 first test!
  • [*] YTSPVDZH first successful pagedown test, first bug found by test
  • [*] PGZJ6NAT ensure Filename is writable when opened outside a terminal

Change contents

  • edit in text.lua at line 98
    [31.681]
    [32.198]
    function test_draw_wrapping_text()
    io.write('\ntest_draw_wrapping_text')
    App.screen.init{width=50, height=60}
    Lines = load_array{'abc', 'defgh', 'xyz'}
    Line_width = App.screen.width
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    App.draw()
    local screen_top_margin = 15 -- pixels
    local line_height = 15 -- pixels
    local y = screen_top_margin
    App.screen.check(y, 'abc', 'F - test_draw_wrapping_text/screen:1')
    y = y + line_height
    App.screen.check(y, 'def', 'F - test_draw_wrapping_text/screen:2')
    y = y + line_height
    App.screen.check(y, 'gh', 'F - test_draw_wrapping_text/screen:3')
    end
    function test_edit_wrapping_text()
    io.write('\ntest_edit_wrapping_text')
    App.screen.init{width=50, height=60}
    Lines = load_array{'abc', 'def', 'xyz'}
    Line_width = App.screen.width
    Cursor1 = {line=2, pos=4}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    Zoom = 1
    App.run_after_textinput('g')
    App.run_after_textinput('h')
    App.run_after_textinput('i')
    App.run_after_textinput('j')
    App.run_after_textinput('k')
    App.run_after_textinput('l')
    local screen_top_margin = 15 -- pixels
    local line_height = 15 -- pixels
    local y = screen_top_margin
    App.screen.check(y, 'abc', 'F - test_edit_wrapping_text/screen:1')
    y = y + line_height
    App.screen.check(y, 'def', 'F - test_edit_wrapping_text/screen:2')
    y = y + line_height
    App.screen.check(y, 'ghij', 'F - test_edit_wrapping_text/screen:3')
    end
  • replacement in main.lua at line 15
    [3.22][3.764:914]()
    function App.initialize(arg)
    love.keyboard.setTextInput(true) -- bring up keyboard on touch screen
    love.keyboard.setKeyRepeat(true)
    -- globals
    [3.22]
    [3.1]
    -- run in both tests and a real run
    function App.initialize_globals()
  • edit in main.lua at line 59
    [3.59][3.1238:1239](),[3.69][3.1238:1239](),[3.74][3.1238:1239](),[3.76][3.1238:1239](),[3.183][3.1238:1239](),[3.264][3.1238:1239](),[3.287][3.1238:1239](),[3.520][3.1238:1239](),[3.1883][3.1238:1239](),[3.9198][3.1238:1239](),[3.14][3.1238:1239](),[3.1239][3.915:973](),[3.973][3.4:64](),[3.64][3.1039:1091](),[3.1039][3.1039:1091](),[3.1091][3.65:204](),[3.204][2.4101:4217]()
    -- maximize window
    love.window.setMode(0, 0) -- maximize
    App.screen.width, App.screen.height = love.window.getMode()
    -- shrink slightly to account for window decoration
    App.screen.width = App.screen.width-100
    App.screen.height = App.screen.height-100
    love.window.setMode(App.screen.width, App.screen.height)
    --? App.screen.width = 120
    --? App.screen.height = 200
    --? love.window.setMode(App.screen.width, App.screen.height)
  • edit in main.lua at line 72
    [33.63]
    [3.47]
    end -- App.initialize_globals
    function App.initialize(arg)
    love.keyboard.setTextInput(true) -- bring up keyboard on touch screen
    love.keyboard.setKeyRepeat(true)
    -- maximize window
    love.window.setMode(0, 0) -- maximize
    App.screen.width, App.screen.height = love.window.getMode()
    -- shrink slightly to account for window decoration
    App.screen.width = App.screen.width-100
    App.screen.height = App.screen.height-100
    love.window.setMode(App.screen.width, App.screen.height)
    --? App.screen.width = 120
    --? App.screen.height = 200
    --? love.window.setMode(App.screen.width, App.screen.height)
  • replacement in file.lua at line 32
    [3.16016][3.16016:16057]()
    local outfile = io.open(filename, 'w')
    [3.16016]
    [3.16057]
    local outfile = App.open_for_writing(filename)
  • edit in app.lua at line 18
    [3.2343]
    [3.2343]
    if App.initialize_globals then App.initialize_globals() end
  • edit in app.lua at line 133
    [3.5970]
    [3.5970]
    App.filesystem = {}
    if App.initialize_globals then App.initialize_globals() end
  • edit in app.lua at line 203
    [3.7391]
    [3.7391]
    end
    -- fake files
    function App.open_for_writing(filename)
    App.filesystem[filename] = ''
    return {
    write = function(self, s)
    App.filesystem[filename] = App.filesystem[filename]..s
    end,
    close = function(self)
    end
    }
  • edit in app.lua at line 246
    [3.7911]
    [3.7911]
    App.filesystem = nil
  • edit in app.lua at line 248
    [3.7943]
    [3.7943]
    App.run_after_keychord = nil
  • edit in app.lua at line 254
    [3.8162]
    [3.8162]
    App.open_for_writing = function(filename) return io.open(filename, 'w') end