test harness now supports copy/paste
[?]
Jun 3, 2022, 1:52 AM
JF5L2BBS7ESMKHNGKLXI2F32GZKET2ICJ4KT2L5BMH3P2L2Y5MRACDependencies
- [2]
6E3HVYWFtest and App helper for mouse clicks - [3]
KWOJ6XHEcut/copy selected text to clipboard - [4]
VJ77YABHmore efficient undo/redo - [5]
GN3IF4WFbugfix: pasting newlines - [6]
CG3264MMmove - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
AD34IX2Zcouple more tests - [*]
3QNOKBFMbeginnings of a test harness - [*]
AVTNUQYRbasic test-enabled framework
Change contents
- edit in text.lua at line 323
endfunction test_insert_newline()io.write('\ntest_insert_newline')-- display a few lines with cursor on bottom lineApp.screen.init{width=25+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Line_width = App.screen.widthCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1local screen_top_margin = 15 -- pixelslocal line_height = math.floor(15*Zoom) -- pixelsApp.draw()local y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_insert_newline/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_insert_newline/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_insert_newline/baseline/screen:3')-- after hitting the enter key the screen scrolls downApp.run_after_keychord('return')check_eq(Screen_top1.line, 1, 'F - test_insert_newline/screen_top')check_eq(Cursor1.line, 2, 'F - test_insert_newline/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_insert_newline/cursor:pos')y = screen_top_marginApp.screen.check(y, 'a', 'F - test_insert_newline/screen:1')y = y + line_heightApp.screen.check(y, 'bc', 'F - test_insert_newline/screen:2')y = y + line_heightApp.screen.check(y, 'def', 'F - test_insert_newline/screen:3') - edit in text.lua at line 357
function test_insert_from_clipboard()io.write('\ntest_insert_from_clipboard')-- display a few lines with cursor on bottom lineApp.screen.init{width=25+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Line_width = App.screen.widthCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1local screen_top_margin = 15 -- pixelslocal line_height = math.floor(15*Zoom) -- pixelsApp.draw()local y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_insert_from_clipboard/baseline/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_insert_from_clipboard/baseline/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_insert_from_clipboard/baseline/screen:3')-- after hitting the enter key the screen scrolls downApp.clipboard = 'xy\nz'App.run_after_keychord('M-v')check_eq(Screen_top1.line, 1, 'F - test_insert_from_clipboard/screen_top')check_eq(Cursor1.line, 2, 'F - test_insert_from_clipboard/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_insert_from_clipboard/cursor:pos')y = screen_top_marginApp.screen.check(y, 'axy', 'F - test_insert_from_clipboard/screen:1')y = y + line_heightApp.screen.check(y, 'zbc', 'F - test_insert_from_clipboard/screen:2')y = y + line_heightApp.screen.check(y, 'def', 'F - test_insert_from_clipboard/screen:3')end - replacement in text.lua at line 1430
love.system.setClipboardText(s)App.setClipboardText(s) - replacement in text.lua at line 1435
love.system.setClipboardText(s)App.setClipboardText(s) - replacement in text.lua at line 1440
local s = love.system.getClipboardText()local s = App.getClipboardText() - edit in app.lua at line 179[11.6979][11.6979]
endApp.clipboard = ''function App.getClipboardText()return App.clipboard - edit in app.lua at line 185[11.6983][11.6983]
function App.setClipboardText(s)App.clipboard = send - edit in app.lua at line 270[9.2791][11.8162]
App.getClipboardText = love.system.getClipboardTextApp.setClipboardText = love.system.setClipboardText