lots more tests
[?]
Jun 14, 2022, 4:26 PM
DSLD74DK3P6J2VAFCYF5BGTHZ637QTW3PDHOUHFACDZU66YNM3IACDependencies
- [2]
KOTI3MFGbugfix in previous commit - [3]
YW5324Q3bugfix: cut (C-x) without first selecting anything - [4]
CPZGQT72go through and fix similar issues - [5]
C42QQZSFanother piece of support for line wrapping in cursor up - [6]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [7]
Y36LOGR5bugfix: show cursor when past end of line - [8]
FEEGTRGQbugfix: duplicate character on enter - [9]
EX3GRC2Kbugfix typo - [10]
2XLZCWZCbugfix: rectangles and squares are now saved - [11]
F63Q4OV7several bugfixes - [12]
MGT5FTJ3first stab at supporting wrapping in cursor up - [13]
BYG5CEMVsupport for naming points - [14]
5L7K4GBDclicking to the right of a wrapped line - [15]
K464QQR4more defensive resize handling - [16]
5Q6NIG66bugfix - [17]
SVJZZDC3snapshot - no, that's all wrong - [*]
LXTTOB33extract a couple of files
Change contents
- edit in text_tests.lua at line 4
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')endfunction 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 textcheck_eq(#Lines, 2, 'F - test_click_to_create_drawing/#lines')check_eq(Cursor1.line, 2, 'F - test_click_to_create_drawing/cursor')endfunction 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 drawingApp.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]
endfunction test_insert_newline_at_start_of_line()io.write('\ntest_insert_newline_at_start_of_line')-- display a lineApp.screen.init{width=25+30, height=60}Lines = load_array{'abc'}Line_width = App.screen.widthCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}-- hitting the enter key splits the lineApp.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]
endfunction test_backspace_past_line_boundary()io.write('\ntest_backspace_past_line_boundary')-- position cursor at start of a (non-first) lineApp.screen.init{width=25+30, height=60}Lines = load_array{'abc', 'def'}Line_width = App.screen.widthCursor1 = {line=2, pos=1}-- backspace joins with previous lineApp.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 = 1first line is a drawing -> cursor_line = 2click on text -> cursor movesclick on first character of text -> cursor on first character of textclick to right of text -> cursor past end of lineclick to right of wrapped text -> cursor on final character of lineclick on drawing -> cursor doesn't movecursor past end of line -> renderscreate drawing -> cursor bumps down below drawingbackspacecursor_pos == 0, previous line is a drawing -> delete drawing, cursor still visible at start of linecursor_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](∅→∅)
entercursor_pos == 0 -> insert empty line above current linescrolling:given moby dick, a file containing all text:page up moves top line on screen to bottompage down moves bottom line on screen to topcursor remains on screencursor 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 lineif 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
clipboard:cut/copy without making a selection