make test initializations a little more obvious
This commit is contained in:
parent
fc6b602342
commit
2884f872d8
|
@ -5,7 +5,7 @@
|
|||
function test_creating_drawing_saves()
|
||||
io.write('\ntest_creating_drawing_saves')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.filename = 'foo'
|
||||
Editor_state.lines = load_array{}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -25,8 +25,8 @@ function test_draw_line()
|
|||
io.write('\ntest_draw_line')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -69,8 +69,8 @@ end
|
|||
function test_draw_horizontal_line()
|
||||
io.write('\ntest_draw_horizontal_line')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'manhattan'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -97,8 +97,8 @@ end
|
|||
function test_draw_circle()
|
||||
io.write('\ntest_draw_circle')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -126,8 +126,8 @@ function test_cancel_stroke()
|
|||
io.write('\ntest_cancel_stroke')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -148,8 +148,8 @@ end
|
|||
function test_keys_do_not_affect_shape_when_mouse_up()
|
||||
io.write('\ntest_keys_do_not_affect_shape_when_mouse_up')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -164,8 +164,8 @@ end
|
|||
function test_draw_circle_mid_stroke()
|
||||
io.write('\ntest_draw_circle_mid_stroke')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -192,8 +192,8 @@ end
|
|||
function test_draw_arc()
|
||||
io.write('\ntest_draw_arc')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'circle'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -223,8 +223,8 @@ 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)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
edit.draw(Editor_state)
|
||||
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_polygon/baseline/drawing_mode')
|
||||
|
@ -261,8 +261,8 @@ end
|
|||
function test_draw_rectangle()
|
||||
io.write('\ntest_draw_rectangle')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
edit.draw(Editor_state)
|
||||
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle/baseline/drawing_mode')
|
||||
|
@ -305,8 +305,8 @@ end
|
|||
function test_draw_rectangle_intermediate()
|
||||
io.write('\ntest_draw_rectangle_intermediate')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
edit.draw(Editor_state)
|
||||
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle_intermediate/baseline/drawing_mode')
|
||||
|
@ -341,8 +341,8 @@ end
|
|||
function test_draw_square()
|
||||
io.write('\ntest_draw_square')
|
||||
-- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
edit.draw(Editor_state)
|
||||
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_square/baseline/drawing_mode')
|
||||
|
@ -385,8 +385,8 @@ function test_name_point()
|
|||
io.write('\ntest_name_point')
|
||||
-- create a drawing with a line
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -428,8 +428,8 @@ function test_move_point()
|
|||
io.write('\ntest_move_point')
|
||||
-- create a drawing with a line
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -485,8 +485,8 @@ function test_move_point_on_manhattan_line()
|
|||
io.write('\ntest_move_point_on_manhattan_line')
|
||||
-- create a drawing with a manhattan line
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'manhattan'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -511,8 +511,8 @@ function test_delete_lines_at_point()
|
|||
io.write('\ntest_delete_lines_at_point')
|
||||
-- create a drawing with two lines connected at a point
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -540,8 +540,8 @@ end
|
|||
function test_delete_line_under_mouse_pointer()
|
||||
io.write('\ntest_delete_line_under_mouse_pointer')
|
||||
-- create a drawing with two lines connected at a point
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -564,8 +564,8 @@ end
|
|||
function test_delete_point_from_polygon()
|
||||
io.write('\ntest_delete_point_from_polygon')
|
||||
-- create a drawing with two lines connected at a point
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -595,8 +595,8 @@ end
|
|||
function test_delete_point_from_polygon()
|
||||
io.write('\ntest_delete_point_from_polygon')
|
||||
-- create a drawing with two lines connected at a point
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -623,8 +623,8 @@ function test_undo_name_point()
|
|||
io.write('\ntest_undo_name_point')
|
||||
-- create a drawing with a line
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -671,8 +671,8 @@ function test_undo_move_point()
|
|||
io.write('\ntest_undo_move_point')
|
||||
-- create a drawing with a line
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
@ -721,8 +721,8 @@ function test_undo_delete_point()
|
|||
io.write('\ntest_undo_delete_point')
|
||||
-- create a drawing with two lines connected at a point
|
||||
Editor_state.filename = 'foo'
|
||||
App.screen.init{width=Margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
App.screen.init{width=Test_margin_left+256, height=300} -- drawing coordinates 1:1 with pixels
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
Editor_state.current_drawing_mode = 'line'
|
||||
edit.draw(Editor_state)
|
||||
|
|
24
edit.lua
24
edit.lua
|
@ -28,7 +28,7 @@ require 'icons'
|
|||
edit = {}
|
||||
|
||||
-- run in both tests and a real run
|
||||
function edit.initialize_state(top, left, right) -- currently always draws to bottom of screen
|
||||
function edit.initialize_state(top, left, right, font_height, line_height) -- currently always draws to bottom of screen
|
||||
local result = {
|
||||
-- a line is either text or a drawing
|
||||
-- a text is a table with:
|
||||
|
@ -88,11 +88,9 @@ function edit.initialize_state(top, left, right) -- currently always draws to b
|
|||
current_drawing_mode = 'line',
|
||||
previous_drawing_mode = nil, -- extra state for some ephemeral modes like moving/deleting/naming points
|
||||
|
||||
-- these default values are important for tests
|
||||
font_height = 14,
|
||||
line_height = 15,
|
||||
-- widest possible character width
|
||||
em = App.newText(love.graphics.getFont(), 'm'),
|
||||
font_height = font_height,
|
||||
line_height = line_height,
|
||||
em = App.newText(love.graphics.getFont(), 'm'), -- widest possible character width
|
||||
|
||||
top = top,
|
||||
left = left,
|
||||
|
@ -452,7 +450,19 @@ end
|
|||
function edit.key_released(State, key, scancode)
|
||||
end
|
||||
|
||||
--== copy some App methods for tests
|
||||
--== some methods for tests
|
||||
|
||||
Test_margin_left = 25
|
||||
|
||||
function edit.initialize_test_state()
|
||||
-- if you change these values, tests will start failing
|
||||
return edit.initialize_state(
|
||||
15, -- top margin
|
||||
Test_margin_left,
|
||||
App.screen.width, -- right margin = 0
|
||||
14, -- font height assuming default LÖVE font
|
||||
15) -- line height
|
||||
end
|
||||
|
||||
-- all textinput events are also keypresses
|
||||
-- TODO: handle chords of multiple keys
|
||||
|
|
15
main.lua
15
main.lua
|
@ -71,24 +71,19 @@ function App.initialize(arg)
|
|||
end
|
||||
|
||||
function load_settings()
|
||||
-- maximize window to determine maximum allowable dimensions
|
||||
love.window.setMode(0, 0) -- maximize
|
||||
App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
|
||||
--
|
||||
local settings = json.decode(love.filesystem.read('config'))
|
||||
love.window.setPosition(settings.x, settings.y, settings.displayindex)
|
||||
love.graphics.setFont(love.graphics.newFont(settings.font_height))
|
||||
-- maximize window to determine maximum allowable dimensions
|
||||
App.screen.width, App.screen.height, App.screen.flags = love.window.getMode()
|
||||
-- set up desired window dimensions
|
||||
love.window.setPosition(settings.x, settings.y, settings.displayindex)
|
||||
App.screen.flags.resizable = true
|
||||
App.screen.flags.minwidth = math.min(App.screen.width, 200)
|
||||
App.screen.flags.minheight = math.min(App.screen.width, 200)
|
||||
App.screen.width, App.screen.height = settings.width, settings.height
|
||||
love.window.setMode(App.screen.width, App.screen.height, App.screen.flags)
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, settings.font_height, math.floor(settings.font_height*1.3))
|
||||
Editor_state.filename = settings.filename
|
||||
Editor_state.font_height = settings.font_height
|
||||
love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
|
||||
Editor_state.line_height = math.floor(Editor_state.font_height*1.3)
|
||||
Editor_state.em = App.newText(love.graphics.getFont(), 'm')
|
||||
Editor_state.screen_top1 = settings.screen_top
|
||||
Editor_state.cursor1 = settings.cursor
|
||||
end
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
function test_resize_window()
|
||||
io.write('\ntest_resize_window')
|
||||
App.screen.init{width=300, height=300}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.filename = 'foo'
|
||||
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, Margin_left, 'F - test_resize_window/baseline/left_margin')
|
||||
check_eq(Editor_state.left, Test_margin_left, 'F - test_resize_window/baseline/left_margin')
|
||||
App.resize(200, 400)
|
||||
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.left, Test_margin_left, 'F - test_resize_window/left_margin')
|
||||
-- ugly; right margin switches from 0 after resize
|
||||
check_eq(Editor_state.right, 200-Margin_right, 'F - test_resize_window/right_margin')
|
||||
check_eq(Editor_state.width, 200-Margin_right-Margin_left, 'F - test_resize_window/drawing_width')
|
||||
check_eq(Editor_state.width, 200-Test_margin_left-Margin_right, 'F - test_resize_window/drawing_width')
|
||||
-- TODO: how to make assertions about when App.update got past the early exit?
|
||||
end
|
||||
|
||||
|
|
186
text_tests.lua
186
text_tests.lua
|
@ -3,7 +3,7 @@
|
|||
function test_initial_state()
|
||||
io.write('\ntest_initial_state')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{}
|
||||
edit.draw(Editor_state)
|
||||
check_eq(#Editor_state.lines, 1, 'F - test_initial_state/#lines')
|
||||
|
@ -16,7 +16,7 @@ end
|
|||
function test_click_to_create_drawing()
|
||||
io.write('\ntest_click_to_create_drawing')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{}
|
||||
edit.draw(Editor_state)
|
||||
edit.run_after_mouse_click(Editor_state, 8,Editor_state.top+8, 1)
|
||||
|
@ -29,7 +29,7 @@ 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}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'```lines', '```', ''}
|
||||
-- cursor is on text as always (outside tests this will get initialized correctly)
|
||||
Editor_state.cursor1.line = 2
|
||||
|
@ -42,7 +42,7 @@ end
|
|||
function test_insert_first_character()
|
||||
io.write('\ntest_insert_first_character')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{}
|
||||
edit.draw(Editor_state)
|
||||
edit.run_after_textinput(Editor_state, 'a')
|
||||
|
@ -54,7 +54,7 @@ function test_press_ctrl()
|
|||
io.write('\ntest_press_ctrl')
|
||||
-- press ctrl while the cursor is on text
|
||||
App.screen.init{width=50, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{''}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -65,7 +65,7 @@ end
|
|||
function test_move_left()
|
||||
io.write('\ntest_move_left')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'a'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -76,7 +76,7 @@ end
|
|||
function test_move_right()
|
||||
io.write('\ntest_move_right')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'a'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -87,7 +87,7 @@ end
|
|||
function test_move_left_to_previous_line()
|
||||
io.write('\ntest_move_left_to_previous_line')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -99,7 +99,7 @@ end
|
|||
function test_move_right_to_next_line()
|
||||
io.write('\ntest_move_right_to_next_line')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def'}
|
||||
Editor_state.cursor1 = {line=1, pos=4} -- past end of line
|
||||
edit.draw(Editor_state)
|
||||
|
@ -111,7 +111,7 @@ end
|
|||
function test_move_to_start_of_word()
|
||||
io.write('\ntest_move_to_start_of_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=3}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -122,7 +122,7 @@ end
|
|||
function test_move_to_start_of_previous_word()
|
||||
io.write('\ntest_move_to_start_of_previous_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=4} -- at the space between words
|
||||
edit.draw(Editor_state)
|
||||
|
@ -133,7 +133,7 @@ end
|
|||
function test_skip_to_previous_word()
|
||||
io.write('\ntest_skip_to_previous_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=5} -- at the start of second word
|
||||
edit.draw(Editor_state)
|
||||
|
@ -144,7 +144,7 @@ end
|
|||
function test_skip_past_tab_to_previous_word()
|
||||
io.write('\ntest_skip_past_tab_to_previous_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def\tghi'}
|
||||
Editor_state.cursor1 = {line=1, pos=10} -- within third word
|
||||
edit.draw(Editor_state)
|
||||
|
@ -155,7 +155,7 @@ end
|
|||
function test_skip_multiple_spaces_to_previous_word()
|
||||
io.write('\ntest_skip_multiple_spaces_to_previous_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=6} -- at the start of second word
|
||||
edit.draw(Editor_state)
|
||||
|
@ -166,7 +166,7 @@ end
|
|||
function test_move_to_start_of_word_on_previous_line()
|
||||
io.write('\ntest_move_to_start_of_word_on_previous_line')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def', 'ghi'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -178,7 +178,7 @@ end
|
|||
function test_move_past_end_of_word()
|
||||
io.write('\ntest_move_past_end_of_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -189,7 +189,7 @@ end
|
|||
function test_skip_to_next_word()
|
||||
io.write('\ntest_skip_to_next_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=4} -- at the space between words
|
||||
edit.draw(Editor_state)
|
||||
|
@ -200,7 +200,7 @@ end
|
|||
function test_skip_past_tab_to_next_word()
|
||||
io.write('\ntest_skip_past_tab_to_next_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc\tdef'}
|
||||
Editor_state.cursor1 = {line=1, pos=1} -- at the space between words
|
||||
edit.draw(Editor_state)
|
||||
|
@ -211,7 +211,7 @@ end
|
|||
function test_skip_multiple_spaces_to_next_word()
|
||||
io.write('\ntest_skip_multiple_spaces_to_next_word')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=4} -- at the start of second word
|
||||
edit.draw(Editor_state)
|
||||
|
@ -222,7 +222,7 @@ end
|
|||
function test_move_past_end_of_word_on_next_line()
|
||||
io.write('\ntest_move_past_end_of_word_on_next_line')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def', 'ghi'}
|
||||
Editor_state.cursor1 = {line=1, pos=8}
|
||||
edit.draw(Editor_state)
|
||||
|
@ -235,7 +235,7 @@ function test_click_with_mouse()
|
|||
io.write('\ntest_click_with_mouse')
|
||||
-- display two lines with cursor on one of them
|
||||
App.screen.init{width=50, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -252,7 +252,7 @@ function test_click_with_mouse_on_empty_line()
|
|||
io.write('\ntest_click_with_mouse_on_empty_line')
|
||||
-- display two lines with the first one empty
|
||||
App.screen.init{width=50, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'', 'def'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -267,7 +267,7 @@ end
|
|||
function test_draw_text()
|
||||
io.write('\ntest_draw_text')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -284,7 +284,7 @@ end
|
|||
function test_draw_wrapping_text()
|
||||
io.write('\ntest_draw_wrapping_text')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'defgh', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -301,7 +301,7 @@ end
|
|||
function test_draw_word_wrapping_text()
|
||||
io.write('\ntest_draw_word_wrapping_text')
|
||||
App.screen.init{width=60, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -319,7 +319,7 @@ function test_draw_text_wrapping_within_word()
|
|||
-- arrange a screen line that needs to be split within a word
|
||||
io.write('\ntest_draw_text_wrapping_within_word')
|
||||
App.screen.init{width=60, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abcd e fghijk', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -337,7 +337,7 @@ function test_draw_wrapping_text_containing_non_ascii()
|
|||
-- draw a long line containing non-ASCII
|
||||
io.write('\ntest_draw_wrapping_text_containing_non_ascii')
|
||||
App.screen.init{width=60, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'madam I’m adam', 'xyz'} -- notice the non-ASCII apostrophe
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -355,7 +355,7 @@ function test_click_on_wrapping_line()
|
|||
io.write('\ntest_click_on_wrapping_line')
|
||||
-- display a wrapping line
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
-- 12345678901234
|
||||
Editor_state.lines = load_array{"madam I'm adam"}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
|
@ -378,7 +378,7 @@ function test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen()
|
|||
io.write('\ntest_click_on_wrapping_line_rendered_from_partway_at_top_of_screen')
|
||||
-- display a wrapping line from its second screen line
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
-- 12345678901234
|
||||
Editor_state.lines = load_array{"madam I'm adam"}
|
||||
Editor_state.cursor1 = {line=1, pos=8}
|
||||
|
@ -399,7 +399,7 @@ function test_click_past_end_of_wrapping_line()
|
|||
io.write('\ntest_click_past_end_of_wrapping_line')
|
||||
-- display a wrapping line
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
-- 12345678901234
|
||||
Editor_state.lines = load_array{"madam I'm adam"}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
|
@ -423,7 +423,7 @@ function test_click_on_wrapping_line_containing_non_ascii()
|
|||
io.write('\ntest_click_on_wrapping_line_containing_non_ascii')
|
||||
-- display a wrapping line containing non-ASCII
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
-- 12345678901234
|
||||
Editor_state.lines = load_array{'madam I’m adam'} -- notice the non-ASCII apostrophe
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
|
@ -447,7 +447,7 @@ function test_click_past_end_of_word_wrapping_line()
|
|||
io.write('\ntest_click_past_end_of_word_wrapping_line')
|
||||
-- display a long line wrapping at a word boundary on a screen of more realistic length
|
||||
App.screen.init{width=160, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
-- 0 1 2
|
||||
-- 123456789012345678901
|
||||
Editor_state.lines = load_array{'the quick brown fox jumped over the lazy dog'}
|
||||
|
@ -468,7 +468,7 @@ function test_select_text()
|
|||
io.write('\ntest_select_text')
|
||||
-- display a line of text
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -490,7 +490,7 @@ function test_cursor_movement_without_shift_resets_selection()
|
|||
io.write('\ntest_cursor_movement_without_shift_resets_selection')
|
||||
-- display a line of text with some part selected
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -508,7 +508,7 @@ function test_edit_deletes_selection()
|
|||
io.write('\ntest_edit_deletes_selection')
|
||||
-- display a line of text with some part selected
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -525,7 +525,7 @@ function test_edit_with_shift_key_deletes_selection()
|
|||
io.write('\ntest_edit_with_shift_key_deletes_selection')
|
||||
-- display a line of text with some part selected
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -547,7 +547,7 @@ function test_copy_does_not_reset_selection()
|
|||
io.write('\ntest_copy_does_not_reset_selection')
|
||||
-- display a line of text with a selection
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -565,7 +565,7 @@ function test_cut()
|
|||
io.write('\ntest_cut')
|
||||
-- display a line of text with some part selected
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -583,7 +583,7 @@ function test_paste_replaces_selection()
|
|||
io.write('\ntest_paste_replaces_selection')
|
||||
-- display a line of text with a selection
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=1}
|
||||
|
@ -603,7 +603,7 @@ function test_deleting_selection_may_scroll()
|
|||
io.write('\ntest_deleting_selection_may_scroll')
|
||||
-- display lines 2/3/4
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=3, pos=2}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -627,7 +627,7 @@ end
|
|||
function test_edit_wrapping_text()
|
||||
io.write('\ntest_edit_wrapping_text')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=2, pos=4}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -649,7 +649,7 @@ function test_insert_newline()
|
|||
io.write('\ntest_insert_newline')
|
||||
-- display a few lines
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -678,7 +678,7 @@ function test_insert_newline_at_start_of_line()
|
|||
io.write('\ntest_insert_newline_at_start_of_line')
|
||||
-- display a line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -695,7 +695,7 @@ function test_insert_from_clipboard()
|
|||
io.write('\ntest_insert_from_clipboard')
|
||||
-- display a few lines
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -724,7 +724,7 @@ end
|
|||
function test_move_cursor_using_mouse()
|
||||
io.write('\ntest_move_cursor_using_mouse')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -741,7 +741,7 @@ end
|
|||
function test_select_text_using_mouse()
|
||||
io.write('\ntest_select_text_using_mouse')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -761,7 +761,7 @@ end
|
|||
function test_select_text_using_mouse_and_shift()
|
||||
io.write('\ntest_select_text_using_mouse_and_shift')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -785,7 +785,7 @@ end
|
|||
function test_select_text_repeatedly_using_mouse_and_shift()
|
||||
io.write('\ntest_select_text_repeatedly_using_mouse_and_shift')
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -815,7 +815,7 @@ function test_cut_without_selection()
|
|||
io.write('\ntest_cut_without_selection')
|
||||
-- display a few lines
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -831,7 +831,7 @@ end
|
|||
function test_pagedown()
|
||||
io.write('\ntest_pagedown')
|
||||
App.screen.init{width=120, height=45}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -857,7 +857,7 @@ function test_pagedown_skips_drawings()
|
|||
-- some lines of text with a drawing intermixed
|
||||
local drawing_width = 50
|
||||
App.screen.init{width=Editor_state.left+drawing_width, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', -- height 15
|
||||
'```lines', '```', -- height 25
|
||||
'def', -- height 15
|
||||
|
@ -885,7 +885,7 @@ function test_pagedown_often_shows_start_of_wrapping_line()
|
|||
io.write('\ntest_pagedown_often_shows_start_of_wrapping_line')
|
||||
-- draw a few lines ending in part of a wrapping line
|
||||
App.screen.init{width=50, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def ghi jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -915,7 +915,7 @@ function test_pagedown_can_start_from_middle_of_long_wrapping_line()
|
|||
io.write('\ntest_pagedown_can_start_from_middle_of_long_wrapping_line')
|
||||
-- draw a few lines starting from a very long wrapping line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def ghi jkl mno pqr stu vwx yza bcd efg hij', 'XYZ'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -942,7 +942,7 @@ end
|
|||
function test_down_arrow_moves_cursor()
|
||||
io.write('\ntest_down_arrow_moves_cursor')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -972,7 +972,7 @@ function test_down_arrow_scrolls_down_by_one_line()
|
|||
io.write('\ntest_down_arrow_scrolls_down_by_one_line')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=3, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1000,7 +1000,7 @@ function test_down_arrow_scrolls_down_by_one_screen_line()
|
|||
io.write('\ntest_down_arrow_scrolls_down_by_one_screen_line')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=3, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1029,7 +1029,7 @@ function test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_
|
|||
io.write('\ntest_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghijkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=3, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1057,7 +1057,7 @@ end
|
|||
function test_page_down_followed_by_down_arrow_does_not_scroll_screen_up()
|
||||
io.write('\ntest_page_down_followed_by_down_arrow_does_not_scroll_screen_up')
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghijkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=3, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1091,7 +1091,7 @@ function test_up_arrow_moves_cursor()
|
|||
io.write('\ntest_up_arrow_moves_cursor')
|
||||
-- display the first 3 lines with the cursor on the bottom line
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=3, pos=1}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1120,7 +1120,7 @@ function test_up_arrow_scrolls_up_by_one_line()
|
|||
io.write('\ntest_up_arrow_scrolls_up_by_one_line')
|
||||
-- display the lines 2/3/4 with the cursor on line 2
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1148,7 +1148,7 @@ function test_up_arrow_scrolls_up_by_one_screen_line()
|
|||
io.write('\ntest_up_arrow_scrolls_up_by_one_screen_line')
|
||||
-- display lines starting from second screen line of a line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=3, pos=6}
|
||||
Editor_state.screen_top1 = {line=3, pos=5}
|
||||
|
@ -1176,7 +1176,7 @@ function test_up_arrow_scrolls_up_to_final_screen_line()
|
|||
io.write('\ntest_up_arrow_scrolls_up_to_final_screen_line')
|
||||
-- display lines starting just after a long line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1206,7 +1206,7 @@ function test_up_arrow_scrolls_up_to_empty_line()
|
|||
io.write('\ntest_up_arrow_scrolls_up_to_empty_line')
|
||||
-- display a screenful of text with an empty line just above it outside the screen
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'', 'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1233,7 +1233,7 @@ end
|
|||
function test_pageup()
|
||||
io.write('\ntest_pageup')
|
||||
App.screen.init{width=120, height=45}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1258,7 +1258,7 @@ function test_pageup_scrolls_up_by_screen_line()
|
|||
io.write('\ntest_pageup_scrolls_up_by_screen_line')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1287,7 +1287,7 @@ function test_pageup_scrolls_up_from_middle_screen_line()
|
|||
io.write('\ntest_pageup_scrolls_up_from_middle_screen_line')
|
||||
-- display a few lines starting from the middle of a line (Editor_state.cursor1.pos > 1)
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def', 'ghi jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=2, pos=5}
|
||||
Editor_state.screen_top1 = {line=2, pos=5}
|
||||
|
@ -1314,7 +1314,7 @@ function test_enter_on_bottom_line_scrolls_down()
|
|||
io.write('\ntest_enter_on_bottom_line_scrolls_down')
|
||||
-- display a few lines with cursor on bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=3, pos=2}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1343,7 +1343,7 @@ function test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom()
|
|||
io.write('\ntest_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom')
|
||||
-- display just the bottom line on screen
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=4, pos=2}
|
||||
Editor_state.screen_top1 = {line=4, pos=1}
|
||||
|
@ -1366,7 +1366,7 @@ function test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bot
|
|||
io.write('\ntest_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom')
|
||||
-- display just an empty bottom line on screen
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', ''}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1385,7 +1385,7 @@ function test_typing_on_bottom_line_scrolls_down()
|
|||
io.write('\ntest_typing_on_bottom_line_scrolls_down')
|
||||
-- display a few lines with cursor on bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=3, pos=4}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1416,7 +1416,7 @@ function test_left_arrow_scrolls_up_in_wrapped_line()
|
|||
io.write('\ntest_left_arrow_scrolls_up_in_wrapped_line')
|
||||
-- display lines starting from second screen line of a line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.screen_top1 = {line=3, pos=5}
|
||||
Editor_state.screen_bottom1 = {}
|
||||
|
@ -1445,7 +1445,7 @@ function test_right_arrow_scrolls_down_in_wrapped_line()
|
|||
io.write('\ntest_right_arrow_scrolls_down_in_wrapped_line')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
Editor_state.screen_bottom1 = {}
|
||||
|
@ -1475,7 +1475,7 @@ function test_home_scrolls_up_in_wrapped_line()
|
|||
io.write('\ntest_home_scrolls_up_in_wrapped_line')
|
||||
-- display lines starting from second screen line of a line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.screen_top1 = {line=3, pos=5}
|
||||
Editor_state.screen_bottom1 = {}
|
||||
|
@ -1504,7 +1504,7 @@ function test_end_scrolls_down_in_wrapped_line()
|
|||
io.write('\ntest_end_scrolls_down_in_wrapped_line')
|
||||
-- display the first three lines with the cursor on the bottom line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
Editor_state.screen_bottom1 = {}
|
||||
|
@ -1534,7 +1534,7 @@ function test_position_cursor_on_recently_edited_wrapping_line()
|
|||
-- draw a line wrapping over 2 screen lines
|
||||
io.write('\ntest_position_cursor_on_recently_edited_wrapping_line')
|
||||
App.screen.init{width=100, height=200}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}
|
||||
Editor_state.cursor1 = {line=1, pos=25}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1568,7 +1568,7 @@ function test_backspace_can_scroll_up()
|
|||
io.write('\ntest_backspace_can_scroll_up')
|
||||
-- display the lines 2/3/4 with the cursor on line 2
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.screen_top1 = {line=2, pos=1}
|
||||
|
@ -1596,8 +1596,8 @@ function test_backspace_can_scroll_up_screen_line()
|
|||
io.write('\ntest_backspace_can_scroll_up_screen_line')
|
||||
-- display lines starting from second screen line of a line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=3, pos=5}
|
||||
Editor_state.screen_top1 = {line=3, pos=5}
|
||||
|
@ -1625,8 +1625,8 @@ 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=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
-- backspace joins with previous line
|
||||
|
@ -1641,8 +1641,8 @@ function test_backspace_over_selection()
|
|||
io.write('\ntest_backspace_over_selection')
|
||||
-- select just one character within a line with cursor before selection
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
@ -1660,8 +1660,8 @@ function test_backspace_over_selection_reverse()
|
|||
io.write('\ntest_backspace_over_selection_reverse')
|
||||
-- select just one character within a line with cursor after selection
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.selection1 = {line=1, pos=1}
|
||||
|
@ -1679,8 +1679,8 @@ function test_backspace_over_multiple_lines()
|
|||
io.write('\ntest_backspace_over_multiple_lines')
|
||||
-- select just one character within a line with cursor after selection
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.selection1 = {line=4, pos=2}
|
||||
|
@ -1699,8 +1699,8 @@ function test_backspace_to_end_of_line()
|
|||
io.write('\ntest_backspace_to_end_of_line')
|
||||
-- select region from cursor to end of line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=1, pos=2}
|
||||
Editor_state.selection1 = {line=1, pos=4}
|
||||
|
@ -1719,8 +1719,8 @@ function test_backspace_to_start_of_line()
|
|||
io.write('\ntest_backspace_to_start_of_line')
|
||||
-- select region from cursor to start of line
|
||||
App.screen.init{width=Editor_state.left+30, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}
|
||||
Editor_state.cursor1 = {line=2, pos=1}
|
||||
Editor_state.selection1 = {line=2, pos=3}
|
||||
|
@ -1738,7 +1738,7 @@ end
|
|||
function test_undo_insert_text()
|
||||
io.write('\ntest_undo_insert_text')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
|
||||
Editor_state.cursor1 = {line=2, pos=4}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1773,7 +1773,7 @@ end
|
|||
function test_undo_delete_text()
|
||||
io.write('\ntest_undo_delete_text')
|
||||
App.screen.init{width=120, height=60}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc', 'defg', 'xyz'}
|
||||
Editor_state.cursor1 = {line=2, pos=5}
|
||||
Editor_state.screen_top1 = {line=1, pos=1}
|
||||
|
@ -1811,7 +1811,7 @@ function test_undo_restores_selection()
|
|||
io.write('\ntest_undo_restores_selection')
|
||||
-- display a line of text with some part selected
|
||||
App.screen.init{width=75, height=80}
|
||||
Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width) -- zero right margin
|
||||
Editor_state = edit.initialize_test_state()
|
||||
Editor_state.lines = load_array{'abc'}
|
||||
Editor_state.cursor1 = {line=1, pos=1}
|
||||
Editor_state.selection1 = {line=1, pos=2}
|
||||
|
|
Loading…
Reference in New Issue