Merge lines.love

[?]
Jan 21, 2023, 5:55 AM
VESAKVTRLUHUWEQJBGHRMZTMU66QZOIKWJSOYKUM225LNRA5LAKAC

Dependencies

  • [2] 73XNHEKN Merge upstream into main
  • [3] SBCRTDXC Merge lines.love
  • [4] ACTERT22 Merge lines.love
  • [5] ORRSP7FV deduce test names on failures
  • [6] APX2PY6G stop tracking wallclock time
  • [7] PX7DDEMO autosave slightly less aggressively
  • [8] WDMPH4AN drop support for squares
  • [9] BCRJ6MHL Merge upstream into main
  • [10] OEUU62GM Merge upstream into main
  • [11] LNUHQOGH start passing in Editor_state explicitly
  • [12] Y4VYNEGF test: autosave after name/move/delete of point
  • [13] 4PHDQ5L5 correct commit f3abc2cbf2
  • [14] UVJ6OCOE Merge lines.love
  • [15] EMHRPJ3R no, that's not right
  • [16] CZB4CK2R bugfix
  • [17] OWK3U6VD tests for drawing polygons
  • [18] W7JMT5V2 rip out most support for polygons
  • [19] PTICQ76Q Merge lines.love
  • [20] EQP53UQV autosave slightly less aggressively
  • [21] GL4Q5WCV keep text from overflowing right margin
  • [22] BPWFKBXT new test: dragging and dropping a file on lines.love
  • [23] LF7BWEG4 group all editor globals
  • [24] 6SMDSWQ2 Merge lines.love
  • [25] PNGWLAFN Merge upstream into main
  • [26] 3OTESDW6 move drawing.starty into line cache
  • [27] VUVH2XLF Merge upstream into main
  • [28] TGZAJUEF bring back a set of constants
  • [29] 7S6CIN7I Merge upstream into main
  • [30] 7DYUAOI6 test: undo moving point
  • [31] V7LATJC7 bugfix: resize
  • [32] L6XA5EY2 test: moving a point
  • [33] ILOA5BYF separate data structure for each line's cache data
  • [34] KAUD3YIK tests: deleting points/shapes
  • [35] CNCYMM6A make test initializations a little more obvious
  • [36] 4VKEE43Z bugfix
  • [37] IWYLK45K clicking to the right of a line within line width
  • [38] M6TH7VSZ rip out notion of Line_width
  • [39] 7CEOB56D Merge upstream into main
  • [40] CE4LZV4T drop last couple of manual tests
  • [41] CRYGI3LR more drawing tests
  • [42] 4AXV2HG4 all pending manual tests done!
  • [43] YT5P6TO6 bugfix: save previous file when dropping a new one on
  • [44] APYPFFS3 call edit rather than App callbacks in tests
  • [45] 27DROQW2 Merge upstream into main
  • [46] 42LVB4DE test: naming a point
  • [47] TO6Y2G3U more decoupling editor tests from App
  • [48] UHB4GARJ left/right margin -> left/right coordinates
  • [49] H3KWPK3G regression: dropping files on the window
  • [50] 7YVCOPLE Merge upstream into main
  • [51] KKMFQDR4 editing source code from within the app
  • [52] X7IHIK6N Merge upstream into main
  • [53] DRFE3B3Z mouse buttons are integers, not strings
  • [54] LYN3L74W correct commit f3abc2cbf2
  • [55] DDXXXXBR new mode for polygons
  • [56] PTDO2SOT add state arg to schedule_save
  • [57] 2JLVAYHB start decoupling editor tests from App
  • [58] 2WGHUWE6 self-documenting 0 Test_right_margin
  • [*] LXTTOB33 extract a couple of files
  • [*] AMOPICKV bugfix: check after cursor on same line when searching upwards
  • [*] K2X6G75Z start writing some tests for drawings

Change contents

  • replacement in text_tests.lua at line 533
    [6.981][2.2:165]()
    check_eq(Editor_state.cursor1.pos, 15, 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points
    [6.981]
    [6.2]
    check_eq(Editor_state.cursor1.pos, 15, 'cursor') -- one more than the number of UTF-8 code-points
  • edit in text_tests.lua at line 537
    [6.60][6.60:118](),[6.60][6.60:118]()
    io.write('\ntest_click_past_end_of_word_wrapping_line')
  • resurrect zombie in text_tests.lua at line 537
    [6.118][6.118:208](),[6.118][6.118:208]()
    -- display a long line wrapping at a word boundary on a screen of more realistic length
  • edit in text_tests.lua at line 549
    [6.3934][6.541:654](),[6.12631][6.541:654](),[6.541][6.541:654](),[6.3934][6.541:654](),[6.12631][6.541:654](),[6.541][6.541:654]()
    App.screen.check(y, 'the quick brown fox ', 'F - test_click_past_end_of_word_wrapping_line/baseline/screen:1')
  • resurrect zombie in text_tests.lua at line 550
    [5.4361][6.12632:12667](),[6.654][6.12632:12667](),[6.654][6.12632:12667]()
    y = y + Editor_state.line_height
  • resurrect zombie in text_tests.lua at line 553
    [6.301][6.803:843](),[6.1547][6.803:843](),[6.301][6.803:843](),[6.803][6.803:843](),[6.803][6.803:843]()
    -- cursor moves to end of screen line
  • replacement in text_tests.lua at line 554
    [6.843][6.159:256]()
    check_eq(Editor_state.cursor1.pos, 20, 'F - test_click_past_end_of_word_wrapping_line/cursor')
    [6.843]
    [6.4]
    check_eq(Editor_state.cursor1.pos, 20, 'cursor')
  • edit in text_tests.lua at line 1993
    [6.843][5.4362:4413](),[6.843][5.4362:4413](),[6.981][5.4192:4293](),[6.981][5.4192:4293]()
    check_eq(Editor_state.cursor1.pos, 20, 'cursor')
    check_eq(Editor_state.cursor1.pos, 15, 'cursor') -- one more than the number of UTF-8 code-points
  • resolve order conflict in text_tests.lua at line 1993
    [61.756]
  • resurrect zombie in run_tests.lua at line 1
    [6.7][3.15:45](),[6.7][3.15:45](),[6.665][3.447:470](),[6.665][3.447:470]()
    function test_resize_window()
    App.resize(200, 400)
  • edit in run_tests.lua at line 2
    [3.45][3.45:80](),[3.45][3.45:80]()
    io.write('\ntest_resize_window')
  • replacement in run_tests.lua at line 5
    [3.199][3.199:446](),[3.199][3.199:446](),[3.446][6.562:665](),[6.4513][6.562:665](),[6.4513][6.562:665]()
    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')
    check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/left_margin')
    [3.199]
    [3.447]
    check_eq(App.screen.width, 300, 'baseline/width')
    check_eq(App.screen.height, 300, 'baseline/height')
    check_eq(Editor_state.left, Test_margin_left, 'baseline/left_margin')
    check_eq(Editor_state.right, 300 - Test_margin_right, 'baseline/left_margin')
  • edit in run_tests.lua at line 11
    [6.719][3.471:605](),[6.719][3.471:605](),[3.605][6.720:801](),[6.466][6.720:801](),[6.466][6.720:801](),[6.801][3.606:694](),[6.801][3.606:694](),[3.694][6.802:903](),[6.489][6.802:903](),[6.489][6.802:903]()
    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.left, Margin_left, 'F - test_resize_window/left_margin')
    check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')
    check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width')
  • resurrect zombie in run_tests.lua at line 11
    [6.903][3.695:807](),[6.903][3.695:807]()
    -- TODO: how to make assertions about when App.update got past the early exit?
    end
    function test_drop_file()
  • edit in run_tests.lua at line 11
    [6.719]
    [3.695]
    check_eq(App.screen.width, 200, 'width')
    check_eq(App.screen.height, 400, 'height')
    check_eq(Editor_state.left, Margin_left, 'left_margin')
    check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
    check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
  • edit in run_tests.lua at line 20
    [3.807][3.807:838](),[3.807][3.807:838]()
    io.write('\ntest_drop_file')
  • replacement in run_tests.lua at line 40
    [3.1457][3.1457:1749](),[3.1457][3.1457:1749]()
    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')
    [3.1457]
    [3.1749]
    check_eq(#Editor_state.lines, 3, '#lines')
    check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')
    check_eq(Editor_state.lines[2].data, 'def', 'lines:2')
    check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')
  • edit in run_tests.lua at line 48
    [3.1821][3.1821:1867](),[3.1821][3.1821:1867]()
    io.write('\ntest_drop_file_saves_previous')
  • replacement in run_tests.lua at line 73
    [3.2728][3.2728:2813](),[3.2728][3.2728:2813]()
    check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
    [3.2728]
    [3.2813]
    check_eq(App.filesystem['foo'], 'abc\ndef\n', 'check')
  • edit in run_tests.lua at line 75
    [6.719][5.47960:48249](),[6.719][5.47960:48249](),[6.631][5.48250:48466](),[6.631][5.48250:48466](),[6.631][5.48250:48466](),[6.631][5.48250:48466](),[6.631][5.48250:48466](),[6.916][5.48467:48524](),[6.916][5.48467:48524](),[6.916][5.48467:48524]()
    check_eq(App.screen.width, 200, 'width')
    check_eq(App.screen.height, 400, 'height')
    check_eq(Editor_state.left, Margin_left, 'left_margin')
    check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
    check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
    check_eq(#Editor_state.lines, 3, '#lines')
    check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')
    check_eq(Editor_state.lines[2].data, 'def', 'lines:2')
    check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')
    check_eq(App.filesystem['foo'], 'abc\ndef\n', 'check')
  • resolve order conflict in run_tests.lua at line 75
    [3.2817]
  • edit in drawing_tests.lua at line 218
    [6.7377][6.1244:1415](),[6.7377][6.1244:1415](),[6.1415][6.407:407]()
    end
    function test_draw_polygon()
    io.write('\ntest_draw_polygon')
    -- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
  • resurrect zombie in drawing_tests.lua at line 218
    [6.7135][5.52327:52497](),[6.7135][5.52327:52497]()
    check_eq(center.x, 35, 'center:x')
    check_eq(center.y, 36, 'center:y')
    check_eq(arc.start_angle, 0, 'start:angle')
    check_eq(arc.end_angle, math.pi/4, 'end:angle')
  • edit in drawing_tests.lua at line 222
    [5.52497]
    [6.6793]
    end
    function test_draw_polygon()
    -- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
  • resurrect zombie in drawing_tests.lua at line 231
    [6.9886][5.52498:52916](),[6.9886][5.52498:52916](),[6.2037][5.53003:53051](),[6.2037][5.53003:53051]()
    check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
    check_eq(#Editor_state.lines, 2, 'baseline/#lines')
    check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
    check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
    check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
    check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
    check_eq(shape.mode, 'polygon', 'shape_mode')
  • edit in drawing_tests.lua at line 237
    [5.52916]
    [5.53003]
    -- start a stroke
    edit.run_after_mouse_press(Editor_state, Editor_state.left+35, Editor_state.top+Drawing_padding_top+36, 1)
    -- switch to polygon mode
    edit.run_after_text_input(Editor_state, '5')
    edit.run_after_mouse_release(Editor_state, Editor_state.left+55, Editor_state.top+Drawing_padding_top+26, 1)
    local drawing = Editor_state.lines[1]
    check_eq(#drawing.shapes, 1, '#shapes')
    check_eq(#drawing.points, 2, 'vertices')
    local shape = drawing.shapes[1]
  • replacement in drawing_tests.lua at line 247
    [5.53051][5.53051:53094](),[5.53051][5.53051:53094](),[6.2218][5.53095:53149](),[6.2218][5.53095:53149](),[6.2362][5.53150:53206](),[6.2362][5.53150:53206](),[6.2508][5.53207:53263](),[6.2508][5.53207:53263]()
    check_eq(#shape.vertices, 3, 'vertices')
    check_eq(p.x, 5, 'p1:x')
    check_eq(p.y, 6, 'p1:y')
    check_eq(p.x, 65, 'p2:x')
    check_eq(p.y, 36, 'p2:y')
    check_eq(p.x, 35, 'p3:x')
    check_eq(p.y, 26, 'p3:y')
    [5.53051]
    [6.2608]
    check_eq(shape.num_vertices, 5, 'vertices')
  • edit in drawing_tests.lua at line 330
    [6.9967][5.54846:55264](),[6.9967][5.54846:55264](),[6.9967][5.54846:55264](),[6.117638][5.55265:55504](),[6.117638][5.55265:55504](),[6.117638][5.55265:55504](),[6.8850][5.55505:55561](),[6.8850][5.55505:55561](),[6.9006][5.55562:55618](),[6.9006][5.55562:55618](),[6.9162][5.55619:55675](),[6.9162][5.55619:55675](),[6.9318][5.55676:55731](),[6.9318][5.55676:55731]()
    check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
    check_eq(#Editor_state.lines, 2, 'baseline/#lines')
    check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
    check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
    check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
    check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
    check_eq(#drawing.shapes, 1, '#shapes')
    check_eq(#drawing.points, 5, '#points') -- currently includes every point added
    check_eq(drawing.shapes[1].mode, 'square', 'shape_mode')
    check_eq(#drawing.shapes[1].vertices, 4, 'vertices')
    check_eq(p.x, 35, 'p1:x')
    check_eq(p.y, 36, 'p1:y')
    check_eq(p.x, 65, 'p2:x')
    check_eq(p.y, 66, 'p2:y')
    check_eq(p.x, 35, 'p3:x')
    check_eq(p.y, 96, 'p3:y')
    check_eq(p.x, 5, 'p4:x')
    check_eq(p.y, 66, 'p4:y')
  • edit in drawing_tests.lua at line 420
    [6.1938][6.1172:1193](),[6.1938][6.1172:1193](),[6.1193][6.28:28]()
    -- wait until save
  • resurrect zombie in drawing_tests.lua at line 420
    [6.5467][5.56995:57102](),[6.5467][5.56995:57102]()
    check_eq(Editor_state.current_drawing_mode, 'line', 'mode:3')
    check_eq(drawing.pending, {}, 'pending')
  • edit in drawing_tests.lua at line 422
    [5.57102]
    [6.1045]
    -- wait until save
  • edit in drawing_tests.lua at line 429
    [6.119760]
    [6.1248]
    check_eq(p2.x, 26, 'save/x')
    check_eq(p2.y, 44, 'save/y')
  • edit in drawing_tests.lua at line 433
    [6.1253][6.120:120](),[6.119760][5.57103:57165](),[6.119760][5.57103:57165]()
    check_eq(p2.x, 26, 'save/x')
    check_eq(p2.y, 44, 'save/y')
  • resolve order conflict in drawing_tests.lua at line 433
    [6.1253]
    [6.15]
  • edit in drawing_tests.lua at line 479
    [6.1304][6.1236:1260](),[6.1304][6.1236:1260](),[6.1260][6.30:30]()
    -- wait for some time
  • resurrect zombie in drawing_tests.lua at line 479
    [6.12620][5.57644:57758](),[6.12620][5.57644:57758]()
    check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
    check_eq(drawing.shapes[2].mode, 'deleted', 'shape:2')
  • edit in drawing_tests.lua at line 481
    [5.57758]
    [6.1082]
    -- wait for some time
  • resurrect zombie in drawing_tests.lua at line 510
    [6.2499][5.57991:58102](),[6.2499][5.57991:58102]()
    check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
    check_eq(drawing.shapes[2].mode, 'line', 'shape:2')
  • edit in drawing_tests.lua at line 512
    [6.123079][5.58103:58281](),[6.123079][5.58103:58281](),[6.123079][5.58103:58281](),[6.4028][5.58282:58392](),[6.4028][5.58282:58392](),[6.123789][5.58393:58571](),[6.123789][5.58393:58571](),[6.123789][5.58393:58571](),[6.5438][5.58572:58627](),[6.5438][5.58572:58627]()
    check_eq(#drawing.shapes, 1, 'baseline/#shapes')
    check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
    check_eq(#drawing.shapes[1].vertices, 4, 'baseline/vertices')
    check_eq(drawing.shapes[1].mode, 'polygon', 'shape')
    check_eq(#drawing.shapes[1].vertices, 3, 'vertices')
    check_eq(#drawing.shapes, 1, 'baseline/#shapes')
    check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
    check_eq(#drawing.shapes[1].vertices, 3, 'baseline/vertices')
    check_eq(drawing.shapes[1].mode, 'deleted', 'check')
  • edit in drawing_tests.lua at line 600
    [6.1992][6.1367:1388](),[6.1992][6.1367:1388](),[6.1388][6.32:32]()
    -- wait until save
  • resurrect zombie in drawing_tests.lua at line 600
    [6.1821][5.59851:59960](),[6.1821][5.59851:59960]()
    check_eq(Editor_state.next_history, 2, 'next_history')
    check_eq(p2.x, 35, 'x')
    check_eq(p2.y, 36, 'y')
  • edit in drawing_tests.lua at line 603
    [5.59960]
    [6.1156]
    -- wait until save
  • edit in drawing_tests.lua at line 640
    [6.1685][6.1431:1452](),[6.1685][6.1431:1452](),[6.1452][6.34:34]()
    -- wait until save
  • resurrect zombie in drawing_tests.lua at line 640
    [6.1454][5.60317:60482](),[6.1454][5.60317:60482]()
    check_eq(Editor_state.next_history, 3, 'next_history')
    check_eq(drawing.shapes[1].mode, 'line', 'shape:1')
    check_eq(drawing.shapes[2].mode, 'line', 'shape:2')
  • edit in drawing_tests.lua at line 643
    [5.60482]
    [6.1193]
    -- wait until save
  • edit in drawing_tests.lua at line 651
    [6.2215][4.78:78](),[6.9886][6.113029:113295](),[6.1462][6.113029:113295](),[6.9886][6.113029:113295](),[6.1462][6.113029:113295](),[6.1120][6.113425:113589](),[6.3148][6.113425:113589](),[6.27688][6.113425:113589](),[6.3148][6.113425:113589](),[6.27688][6.113425:113589](),[6.113425][6.113425:113589](),[6.1120][6.113425:113589](),[6.3148][6.113425:113589](),[6.27688][6.113425:113589](),[6.1120][6.113425:113589](),[6.113425][6.113425:113589](),[6.113589][6.3994:4014](),[6.113589][6.3994:4014](),[6.4014][6.16:125](),[6.125][6.4136:4164](),[6.4136][6.4136:4164](),[6.4136][6.4136:4164](),[6.4164][4.29:76](),[6.73][6.127:127](),[4.76][6.127:127](),[6.4209][6.127:127](),[6.127][6.128:239](),[6.239][6.113941:113981](),[6.3449][6.113941:113981](),[6.4333][6.113941:113981](),[6.9673][6.113941:113981](),[6.28028][6.113941:113981](),[6.113941][6.113941:113981](),[6.113981][6.4334:4635](),[6.113981][5.52917:53002](),[6.113981][5.52917:53002]()
    check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_polygon/baseline/drawing_mode')
    check_eq(#Editor_state.lines, 2, 'F - test_draw_polygon/baseline/#lines')
    check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_polygon/baseline/mode')
    check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_polygon/baseline/y')
    check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_polygon/baseline/#shapes')
    -- start a stroke
    edit.run_after_mouse_press(Editor_state, Editor_state.left+35, Editor_state.top+Drawing_padding_top+36, 1)
    -- switch to polygon mode
    edit.run_after_text_input(Editor_state, '5')
    edit.run_after_mouse_release(Editor_state, Editor_state.left+55, Editor_state.top+Drawing_padding_top+26, 1)
    local drawing = Editor_state.lines[1]
    check_eq(#drawing.shapes, 1, 'F - test_draw_polygon/#shapes')
    check_eq(#drawing.points, 2, 'F - test_draw_polygon/vertices')
    local shape = drawing.shapes[1]
    check_eq(shape.mode, 'polygon', 'F - test_draw_polygon/shape_mode')
    check_eq(shape.num_vertices, 5, 'F - test_draw_polygon/vertices')
    check_eq(#drawing.shapes, 1, '#shapes')
    check_eq(#drawing.points, 3, 'vertices')
  • resolve order conflict in drawing_tests.lua at line 651
    [6.2215]