diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-06-20 10:48:35 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-06-20 10:48:35 -0700 |
commit | 3be413602a59ed735a33712380cedbdb8f5603df (patch) | |
tree | b10cae2e3be410359c1ec66b08c349463d7f5db6 /text_tests.lua | |
parent | 9aa7577446ff484b6a2d6713637bfbafe931f458 (diff) | |
download | text.love-3be413602a59ed735a33712380cedbdb8f5603df.tar.gz |
bugfix: typing should delete highlighted text
The test harness now also mimics real usage more precisely.
Diffstat (limited to 'text_tests.lua')
-rw-r--r-- | text_tests.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua index f835d8d..95fbd78 100644 --- a/text_tests.lua +++ b/text_tests.lua @@ -204,6 +204,23 @@ function test_edit_after_click_resets_selection() check_nil(Selection1.line, 'F - test_edit_after_click_resets_selection') end +function test_edit_deletes_selection() + io.write('\ntest_edit_deletes_selection') + -- display a line of text with some part selected + App.screen.init{width=80, height=80} + Lines = load_array{'abc'} + Line_width = 75 + Cursor1 = {line=1, pos=1} + Selection1 = {line=1, pos=2} + Screen_top1 = {line=1, pos=1} + Screen_bottom1 = {} + App.draw() + -- press a key + App.run_after_textinput('x') + -- selected text is deleted and replaced with the key + check_eq(Lines[1].data, 'xbc', 'F - test_edit_deletes_selection') +end + function test_edit_wrapping_text() io.write('\ntest_edit_wrapping_text') App.screen.init{width=50, height=60} |