Merge lines.love

[?]
Sep 7, 2022, 5:18 PM
SBCRTDXCUKVH2W67BU6SYDMFU6NDI3W5R3OILKGICETU43CITY6AC

Dependencies

  • [2] LXW73CJ3 Merge lines.love
  • [3] 2WGHUWE6 self-documenting 0 Test_right_margin
  • [4] CE4LZV4T drop last couple of manual tests
  • [5] 27DROQW2 Merge upstream into main
  • [6] 7YVCOPLE Merge upstream into main
  • [7] 5BJCYYHN convert videos to gif so they render inline on GitHub
  • [8] BLWAYPKV extract a module
  • [9] FS2ITYYH record a known issue
  • [10] V366JSXA videos
  • [11] 7CEOB56D Merge upstream into main
  • [12] X7IHIK6N Merge upstream into main
  • [13] V7LATJC7 bugfix: resize
  • [14] 73OCE2MC after much struggle, a brute-force undo
  • [15] 4YDBYBA4 clean up memory leak experiments
  • [16] R5QXEHUI somebody stop me
  • [17] VHQCNMAR several more modules
  • [18] TLOAPLBJ add a license
  • [19] CNCYMM6A make test initializations a little more obvious
  • [20] AVTNUQYR basic test-enabled framework
  • [21] VXORMHME delete experimental REPL
  • [22] XX7G2FFJ intermingle freehand line drawings with text
  • [23] RSZD5A7G forgot to add json.lua
  • [24] BULPIBEG beginnings of a module for the text editor
  • [25] TVCPXAAU rename
  • [26] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [27] OEUU62GM Merge upstream into main
  • [28] 3QNOKBFM beginnings of a test harness
  • [29] OGUV4HSA remove some memory leaks from rendered fragments
  • [30] 7M5PGWKU drop last couple of manual tests
  • [31] 2L5MEZV3 experiment: new edit namespace
  • [32] LXTTOB33 extract a couple of files
  • [33] K2X6G75Z start writing some tests for drawings
  • [34] 6LJZN727 handle chords
  • [35] VUVH2XLF Merge upstream into main
  • [36] OTIBCAUJ love2d scaffold
  • [37] KMSL74GA support selections in the source editor
  • [38] 7XKWT5Y5 correct location of the line width slider
  • [39] T4FRZSYL delete an ancient, unused file
  • [40] 6SMDSWQ2 Merge lines.love
  • [41] D2GCFTTT clean up repl functionality
  • [42] KKMFQDR4 editing source code from within the app
  • [43] 66X36NZN a little more prose describing manual_tests

Change contents

  • file deletion: run_tests.lua (----------)main_tests.lua (----------)
    [4.2][2.14:51](),[2.51][4.7:7](),[4.2][4.1125:1163](),[4.1163][4.7:7]()
    function test_resize_window()
    io.write('\ntest_resize_window')
    check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')
    App.resize(200, 400)
    check_eq(App.screen.width, 200, 'F - test_resize_window/width')
    check_eq(App.screen.height, 400, 'F - test_resize_window/height')
    check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')
    check_eq(Editor_state.width, 200-Test_margin_left-Margin_right, 'F - test_resize_window/drawing_width')
    -- TODO: how to make assertions about when App.update got past the early exit?
    end
    end
    function test_drop_file()
    io.write('\ntest_drop_file')
    App.filesystem['foo'] = 'abc\ndef\nghi\n'
    local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
    return 'foo'
    end,
    open = function(self)
    self.opened = true
    end,
    lines = function(self)
    assert(self.opened)
    return App.filesystem['foo']:gmatch('[^\n]+')
    end,
    close = function(self)
    self.opened = false
    end,
    }
    App.filedropped(fake_dropped_file)
    end
    function test_drop_file_saves_previous()
    io.write('\ntest_drop_file_saves_previous')
    -- initially editing a file called foo that hasn't been saved to filesystem yet
    -- now drag a new file bar from the filesystem
    App.filesystem['bar'] = 'abc\ndef\nghi\n'
    local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
    return 'bar'
    end,
    open = function(self)
    self.opened = true
    end,
    lines = function(self)
    assert(self.opened)
    return App.filesystem['bar']:gmatch('[^\n]+')
    end,
    close = function(self)
    self.opened = false
    end,
    }
    App.filedropped(fake_dropped_file)
    -- filesystem now contains a file called foo
    check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
    Editor_state.lines = load_array{'abc', 'def'}
    Editor_state.filename = 'foo'
    schedule_save(Editor_state)
    App.screen.init{width=Editor_state.left+300, height=300}
    check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')
    check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
    check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
    check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
    edit.draw(Editor_state)
    App.screen.init{width=Editor_state.left+300, height=300}
    Editor_state = edit.initialize_test_state()
    check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/left_margin')
    -- ugly; right margin switches from 0 after resize
    check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin')
    Editor_state.filename = 'foo'
    check_eq(App.screen.width, 300, 'F - test_resize_window/baseline/width')
    App.screen.init{width=300, height=300}
    Editor_state = edit.initialize_test_state()
  • file un-deletion: run_tests.lua (----------)run_tests.lua (----------)
    [4.1163][4.7:7](),[4.178042][4.7:7](),[4.2][4.178005:178042](),[4.2][4.178005:178042]()
  • resurrect zombie in run_tests.lua at line 1
    [4.4513][3.562:665](),[4.4513][3.562:665](),[4.4513][3.562:665](),[4.332][3.666:719](),[4.332][3.666:719](),[4.466][3.720:801](),[4.466][3.720:801](),[4.466][3.720:801](),[4.489][3.802:903](),[4.489][3.802:903](),[4.489][3.802:903]()
    check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/left_margin')
    -- ugly; resize switches to real, non-test margins
    check_eq(Editor_state.left, Margin_left, 'F - test_resize_window/left_margin')
    check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width')
  • edit in run_tests.lua at line 1
    [4.7]
    [3.562]
    function test_resize_window()
    io.write('\ntest_resize_window')
    App.screen.init{width=300, height=300}
    Editor_state = edit.initialize_test_state()
    Editor_state.filename = 'foo'
    check_eq(App.screen.width, 300, 'F - test_resize_window/baseline/width')
    check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')
    check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin')
  • edit in run_tests.lua at line 10
    [3.665]
    [3.666]
    App.resize(200, 400)
  • edit in run_tests.lua at line 12
    [3.719]
    [3.720]
    check_eq(App.screen.width, 200, 'F - test_resize_window/width')
    check_eq(App.screen.height, 400, 'F - test_resize_window/height')
  • edit in run_tests.lua at line 15
    [3.801]
    [3.802]
    check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')
  • edit in run_tests.lua at line 17
    [3.903]
    -- TODO: how to make assertions about when App.update got past the early exit?
    end
    function test_drop_file()
    io.write('\ntest_drop_file')
    App.screen.init{width=Editor_state.left+300, height=300}
    Editor_state = edit.initialize_test_state()
    App.filesystem['foo'] = 'abc\ndef\nghi\n'
    local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
    return 'foo'
    end,
    open = function(self)
    self.opened = true
    end,
    lines = function(self)
    assert(self.opened)
    return App.filesystem['foo']:gmatch('[^\n]+')
    end,
    close = function(self)
    self.opened = false
    end,
    }
    App.filedropped(fake_dropped_file)
    check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')
    check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
    check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
    check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
    edit.draw(Editor_state)
    end
    function test_drop_file_saves_previous()
    io.write('\ntest_drop_file_saves_previous')
    App.screen.init{width=Editor_state.left+300, height=300}
    -- initially editing a file called foo that hasn't been saved to filesystem yet
    Editor_state.lines = load_array{'abc', 'def'}
    Editor_state.filename = 'foo'
    schedule_save(Editor_state)
    -- now drag a new file bar from the filesystem
    App.filesystem['bar'] = 'abc\ndef\nghi\n'
    local fake_dropped_file = {
    opened = false,
    getFilename = function(self)
    return 'bar'
    end,
    open = function(self)
    self.opened = true
    end,
    lines = function(self)
    assert(self.opened)
    return App.filesystem['bar']:gmatch('[^\n]+')
    end,
    close = function(self)
    self.opened = false
    end,
    }
    App.filedropped(fake_dropped_file)
    -- filesystem now contains a file called foo
    check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
    end