lots more tests

[?]
Jun 14, 2022, 4:26 PM
DSLD74DK3P6J2VAFCYF5BGTHZ637QTW3PDHOUHFACDZU66YNM3IAC

Dependencies

  • [2] KOTI3MFG bugfix in previous commit
  • [3] YW5324Q3 bugfix: cut (C-x) without first selecting anything
  • [4] CPZGQT72 go through and fix similar issues
  • [5] C42QQZSF another piece of support for line wrapping in cursor up
  • [6] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing
  • [7] Y36LOGR5 bugfix: show cursor when past end of line
  • [8] FEEGTRGQ bugfix: duplicate character on enter
  • [9] EX3GRC2K bugfix typo
  • [10] 2XLZCWZC bugfix: rectangles and squares are now saved
  • [11] F63Q4OV7 several bugfixes
  • [12] MGT5FTJ3 first stab at supporting wrapping in cursor up
  • [13] BYG5CEMV support for naming points
  • [14] 5L7K4GBD clicking to the right of a wrapped line
  • [15] K464QQR4 more defensive resize handling
  • [16] 5Q6NIG66 bugfix
  • [17] SVJZZDC3 snapshot - no, that's all wrong
  • [*] LXTTOB33 extract a couple of files

Change contents

  • edit in text_tests.lua at line 4
    [2.3]
    [2.3]
    function test_initial_state()
    io.write('\ntest_initial_state')
    App.screen.init{width=120, height=60}
    Lines = load_array{}
    App.draw()
    check_eq(#Lines, 1, 'F - test_initial_state/#lines')
    check_eq(Cursor1.line, 1, 'F - test_initial_state/cursor:line')
    check_eq(Cursor1.pos, 1, 'F - test_initial_state/cursor:pos')
    check_eq(Screen_top1.line, 1, 'F - test_initial_state/screen_top:line')
    check_eq(Screen_top1.pos, 1, 'F - test_initial_state/screen_top:pos')
    end
    function test_click_to_create_drawing()
    io.write('\ntest_click_to_create_drawing')
    App.screen.init{width=120, height=60}
    Lines = load_array{}
    App.draw()
    App.run_after_mouse_click(8,Margin_top+8, 1)
    -- cursor skips drawing to always remain on text
    check_eq(#Lines, 2, 'F - test_click_to_create_drawing/#lines')
    check_eq(Cursor1.line, 2, 'F - test_click_to_create_drawing/cursor')
    end
    function test_backspace_to_delete_drawing()
    io.write('\ntest_backspace_to_delete_drawing')
    -- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
    App.screen.init{width=120, height=60}
    Lines = load_array{'```lines', '```', ''}
    -- cursor is on text as always (outside tests this will get initialized correctly)
    Cursor1.line = 2
    -- backspacing deletes the drawing
    App.run_after_keychord('backspace')
    check_eq(#Lines, 1, 'F - test_backspace_to_delete_drawing/#lines')
    check_eq(Cursor1.line, 1, 'F - test_backspace_to_delete_drawing/cursor')
    end
  • edit in text_tests.lua at line 239
    [19.4366]
    [19.4366]
    end
    function test_insert_newline_at_start_of_line()
    io.write('\ntest_insert_newline_at_start_of_line')
    -- display a line
    App.screen.init{width=25+30, height=60}
    Lines = load_array{'abc'}
    Line_width = App.screen.width
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    -- hitting the enter key splits the line
    App.run_after_keychord('return')
    check_eq(Cursor1.line, 2, 'F - test_insert_newline_at_start_of_line/cursor:line')
    check_eq(Cursor1.pos, 1, 'F - test_insert_newline_at_start_of_line/cursor:pos')
    check_eq(Lines[1].data, '', 'F - test_insert_newline_at_start_of_line/data:1')
    check_eq(Lines[2].data, 'abc', 'F - test_insert_newline_at_start_of_line/data:2')
  • edit in text_tests.lua at line 1071
    [19.35921]
    [19.35921]
    end
    function test_backspace_past_line_boundary()
    io.write('\ntest_backspace_past_line_boundary')
    -- position cursor at start of a (non-first) line
    App.screen.init{width=25+30, height=60}
    Lines = load_array{'abc', 'def'}
    Line_width = App.screen.width
    Cursor1 = {line=2, pos=1}
    -- backspace joins with previous line
    App.run_after_keychord('backspace')
    check_eq(Lines[1].data, 'abcdef', "F - test_backspace_past_line_boundary")
  • edit in manual_tests at line 8
    [4.1406][5.2:76](),[5.1][5.2:76](),[5.76][5.2:32](),[5.32][5.167:237](),[5.237][5.540:658](),[5.237][5.32:72](),[5.658][5.32:72](),[5.32][5.32:72](),[5.72][5.146:181](),[5.72][5.76:326](),[5.181][5.76:326](),[5.76][5.76:326](),[5.326][5.2:3]()
    file load:
    cursor_line = 1
    first line is a drawing -> cursor_line = 2
    click on text -> cursor moves
    click on first character of text -> cursor on first character of text
    click to right of text -> cursor past end of line
    click to right of wrapped text -> cursor on final character of line
    click on drawing -> cursor doesn't move
    cursor past end of line -> renders
    create drawing -> cursor bumps down below drawing
    backspace
    cursor_pos == 0, previous line is a drawing -> delete drawing, cursor still visible at start of line
    cursor_pos == 0, previous line is text -> join lines, cursor still at same character
  • edit in manual_tests at line 12
    [5.59][5.2:67](),[5.90][5.2:67](),[5.326][5.2:67](),[5.67][5.1138:1441](),[5.1441][5.1660:1733](),[5.1733][5.597:687](),[5.1511][5.597:687](),[5.687][5.1511:1613](),[5.1511][5.1511:1613](),[5.1613][5.1734:1809]()
    enter
    cursor_pos == 0 -> insert empty line above current line
    scrolling:
    given moby dick, a file containing all text:
    page up moves top line on screen to bottom
    page down moves bottom line on screen to top
    cursor remains on screen
    cursor remains on text line
    'up' arrow with cursor at top of screen scrolls up one line (drawings still fully in or out)
    if cursor line wrapped before, it scrolls up by only one screen line
    if previous line (above top of screen) wrapped, it scrolls up by only one screen line
    'down' arrow with cursor at bottom of screen scrolls down one line (drawings still fully in or out)
    if cursor line wrapped before, it scrolls down by only one screen line
  • edit in manual_tests at line 16
    [5.128][5.7:8](),[5.8][3.97:146]()
    clipboard:
    cut/copy without making a selection