A4BSGS2CX4JK7IELL655EC6HAY6ILCWTGIHWZXHRGQOKU3HSUPLAC
XGHCLIKBWIW24G7O5QLYH6EUIY3TWTYFTUIYTWE25RFEGBHMZOKQC
ORRSP7FVCHI2TF5GXBRGQYYJAA3JFYXZBM3T663BKSBV22FCZVCAC
R5QXEHUIZLELJGGCZAE7ATNS3CLRJ7JFRENMGH4XXH24C5WABZDQC
KKMFQDR43ZWVCDRHQLWWX3FCWCFA3ZSXYOBRJNPHUQZR2XPKWULAC
KMSL74GAMFNTAKGDKZFP2AMQXUMOC3XH373BO4IABZWBEP3YAXKAC
2CK5QI7WA7M4IVSACFGOJYAIDKRUTZVMMPSFWEJTUNMWTN7AX4NAC
OI4FPFINEROK6GNDEMOBTGSPYIULCLRGGT5W3H7VLM7VFH22GMWQC
DFGPHG5TJUE5Z5UT72Q5DWRMUG6TR3FHWNSKCQISZC4DZXCA36WQC
KOTNETIMJP2G753SAAQHR5LNOIC7LWLTFSY3QXA276L3TUN63UHQC
VP5KC4XZBKD536KCBFO47UKH74RNONENDCFJAHUMVUTPVPGJWD4AC
ENENSZLKCCS7XILJUHIJUQPBOI6VK74YPHBFWPBXAHHHTHT2D3UQC
4VQGE7RAC2B4NWCCKDCUZMMRDRMXLN6357YY4OPFIK6BZBGRWDHQC
6SMGKYDRM7QERJDO2URF57M3G7OVJBAVPZGD7XO7K2VZCL4TNYBAC
2WGHUWE6DWRNUD7AJNLGT4I6PZ2EIVDQCZ7V7V7WSYPBRPYUUDUQC
LNUHQOGHIOFGJXNGA3DZLYEASLYYDGLN2I3EDZY5ANASQAHCG3YQC
LXTTOB33N2HCUZFIUDRQGGBVHK2HODRG4NBLH6RXRQZDCHF27BSAC
MD3W5IRAC6UQALQE4LJC52VQNDO3I3HXF3XE2XHDABXBYJBUVAXQC
DSLD74DK3P6J2VAFCYF5BGTHZ637QTW3PDHOUHFACDZU66YNM3IAC
APYPFFS3G6TDEUMIHQGMDBJNRNDTCNTPKI5M2AFACJ73P725XQRQC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
MUJTM6REGQAK3LZTIFWGJRXE2UPCM4HSLXQYSF5ITLXLS6JCVPMQC
VG75U7IM2ZQTGM2QETDT6QQ4CSLQPB4APK436POAAQJWOMINPIJAC
KMRJOSLYYHHPGMYXBSLUQTICP6F4LXRCGYSP55YTZQSX4SZISDEAC
ILOA5BYFTQKBSHLFMMZUVPQ2JXBFJD62ERQFBTDK2WSRXUN525VQC
UHB4GARJI5AB5UCDCZRFSCJNXGJSLU5DYGUGX5ITYEXI7Q43Z4CAC
ORKN6EOBUFVAD2TXYW5OIKSL55RU24LOFDTTTXHDZUZ57QRDCY7QC
JOPVPUSAMMU6RFVDQR4NJC4GNNUFB7GPKVH7OS5FKCYS5QZ53VLQC
3PSFWAILGRA4OYXWS2DX7VF332AIBPYBXHEA4GIQY2XEJVD65UMAC
D4B52CQ2QKG2HQKFUQOO5S2ME325DTW3PH2D7SBXCW4BPQFYG7CAC
AYX33NBCPCBFWEZI5KZXHP3Y2Q62GYVT4WHYJUYRIPYV67KPSYZAC
TFM6F5ODCDCNZPYVB5NZMW6MUEDTDUQNTBLPOVBTJ3IH7KT3ETKQC
CE4LZV4TNXJT54CVGM3QANCBP42TMLMZWF2DBSMUYKAHILXIZEMQC
5F54FYKIMKS6TBV23M2GZ6N55VGHPBN66RO5XQS7ZY2GDZSSUJQAC
H3KWPK3GXISOB25HP3USPDJLY4Q3MYDDD77PPQ7OGBVEYG23D7JAC
K2X6G75Z6XBC4DVIRWC5HC7XA3A2SKOM3MWSQTCFEYWIJL7LME2QC
TO6Y2G3UB3IQARSSQF5LBBFGKNALBWK74EJ2EQP2UCSYOM2HLBFQC
APX2PY6GAMJSUH7SFSMBFOQJBSAWLLOCKH4L4ZQP2VLHNEXJPREAC
7CLGG7J277QZGMNOVFEXBX6DRETCVK7GH66HJ7BYOBMPHTJCDFMAC
CRYGI3LRKVHD4D76Q2VTNSX4B2JP5FPDEFJU6DBO7QWFHER2E4OQC
OWK3U6VDHPZM6Q6MB7PVFZPDD2KD5NJ3WHVMGTQ2XGUNYDNWSPWAC
42LVB4DEK3ILS3O5DHFMTJO5HNMJFDYA2WRCLUIOYFPA46MJFZTAC
L6XA5EY2FVDQFRGCBFSCOM6O4GYN74K3YTZKGFUOPXIUYA3YT5JQC
TGZAJUEFRK3NTCDMPIIG7U2TGLDHK4U3JDNFAYX7NHXTJYBYEZIAC
LYN3L74WRXZI4KNNIMNLPRFQ36RAGPWNE2O5AMB42H3CSTI6QM6QC
KAUD3YIKPOXHIUZVR3VCIQHQGBPWTBHXEXC3VQIPAN2BAV6SEMIQC
T7SJSJIH3FUWK2TK6DNVLCNYL7ROJGFVMOOCIY3L46EX5T7M7VNAC
7DYUAOI6WHAP75T2KEGN6CPSASO7B6L6BDE6FQ5ELND7T6X3WO4AC
4AXV2HG4NMAHAWGWD35V5PXULNORCBEKY65UQT37XNYXCSB7TWEAC
VZJHGWSPFPIBTAEIAXTMKPG5BCNEW3L2DDK5ZMC76WPWHRS3OG2QC
3QNOKBFMKBGXBVJIRHR2444JRRMBTABHE4674NR3DT67RRM2X6GAC
2CTN2IEF4ZCVZQORAEBXAUDANF6NYZA24GQ5PXK2WUDWYU5UV25QC
AVTNUQYRBW7IX2YQ3KDLVQ23RGW3BAKTAE7P73ASBYNKOHMQMH5AC
check_eq(Editor_state.cursor1.line, 1, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, '1/cursor:pos')
end
check_eq(Editor_state.cursor1.line, 1, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
end
function test_search_wrap_upwards()
check_eq(Editor_state.cursor1.line, 1, '2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
end
function test_search_wrap()
check_eq(Editor_state.cursor1.line, 4, '2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
end
function test_search_upwards()
check_eq(Editor_state.cursor1.line, 2, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
-- reset cursor
Editor_state.cursor1 = {line=1, pos=1}
Editor_state.screen_top1 = {line=1, pos=1}
-- search for second occurrence
edit.run_after_keychord(Editor_state, 'C-f')
check_eq(Editor_state.selection1.line, 1, 'line')
check_eq(Editor_state.selection1.pos, 2, 'pos')
end
check_eq(Editor_state.lines[1].data, 'xbc', 'baseline')
check_nil(Editor_state.selection1.line, 'baseline:selection')
-- undo
edit.run_after_keychord(Editor_state, 'C-z')
edit.run_after_keychord(Editor_state, 'C-z')
-- selection is restored
App.screen.check(y, 'xyz', 'screen:3')
end
App.screen.check(y, 'defg', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
--? check_eq(Editor_state.selection1.line, 2, 'selection:line')
--? check_eq(Editor_state.selection1.pos, 4, 'selection:pos')
y = Editor_state.top
App.screen.check(y, 'xyz', 'baseline/screen:3')
-- undo
--? -- after undo, the backspaced key is selected
edit.run_after_keychord(Editor_state, 'C-z')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 2, 'baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'baseline/selection:pos')
local y = Editor_state.top
App.screen.check(y, 'xyz', 'screen:3')
end
function test_undo_delete_text()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
y = Editor_state.top
App.screen.check(y, 'xyz', 'baseline/screen:3')
-- undo
edit.run_after_keychord(Editor_state, 'C-z')
App.screen.check(y, 'defg', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 2, 'baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'baseline/selection:pos')
local y = Editor_state.top
check_nil(Editor_state.selection1.line, 'selection')
end
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
-- selection is cleared
check_eq(Editor_state.lines[1].data, 'abc', 'data:1')
check_eq(Editor_state.lines[2].data, 'f', 'data:2')
-- cursor remains at start of selection
check_nil(Editor_state.selection1.line, 'selection')
end
function test_backspace_to_start_of_line()
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
-- selection is cleared
check_eq(Editor_state.lines[1].data, 'a', 'data:1')
check_eq(Editor_state.lines[2].data, 'def', 'data:2')
-- cursor remains at start of selection
check_nil(Editor_state.selection1.line, 'selection')
end
function test_backspace_to_end_of_line()
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
-- selection is cleared
check_eq(Editor_state.lines[1].data, 'akl', 'data:1')
check_eq(Editor_state.lines[2].data, 'mno', 'data:2')
-- cursor remains at start of selection
check_nil(Editor_state.selection1.line, 'selection')
end
function test_backspace_over_multiple_lines()
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
-- selection is cleared
check_eq(Editor_state.lines[1].data, 'bc', 'data')
-- cursor moves to start of selection
check_nil(Editor_state.selection1.line, 'selection')
end
function test_backspace_over_selection_reverse()
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
-- selection is cleared
check_eq(Editor_state.lines[1].data, 'bc', 'data')
-- cursor (remains) at start of selection
check_eq(Editor_state.lines[1].data, 'abcdef', 'check')
end
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
end
function test_backspace_past_line_boundary()
App.screen.check(y, 'kl', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghij', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'baseline/screen:2')
-- after hitting backspace the screen scrolls up by one screen line
edit.run_after_keychord(Editor_state, 'backspace')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
end
function test_backspace_can_scroll_up_screen_line()
App.screen.check(y, 'ghi', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abcdef', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:3')
-- after hitting backspace the screen scrolls up by one line
edit.run_after_keychord(Editor_state, 'backspace')
App.screen.check(y, 'ghi', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 26, 'cursor:pos')
end
function test_backspace_can_scroll_up()
App.screen.check(y, 'stu', 'baseline2/screen:3')
-- try to move the cursor earlier in the third screen line by clicking the mouse
App.screen.check(y, 'jkl mno pqr ', 'baseline2/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc def ghi ', 'baseline2/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.pos, 28, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'xyz', 'baseline1/screen:3')
-- add to the line until it's wrapping over 3 screen lines
App.screen.check(y, 'jkl mno pqr ', 'baseline1/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc def ghi ', 'baseline1/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
end
function test_position_cursor_on_recently_edited_wrapping_line()
-- draw a line wrapping over 2 screen lines
App.screen.check(y, 'ghi ', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 8, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi ', 'baseline/screen:3') -- line wrapping includes trailing whitespace
-- after hitting end the screen scrolls down by one line
edit.run_after_keychord(Editor_state, 'end')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
end
function test_end_scrolls_down_in_wrapped_line()
App.screen.check(y, 'jkl', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi ', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'baseline/screen:2')
-- after hitting home the screen scrolls up to first screen line
edit.run_after_keychord(Editor_state, 'home')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
end
function test_home_scrolls_up_in_wrapped_line()
App.screen.check(y, 'ghi ', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 6, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi ', 'baseline/screen:3') -- line wrapping includes trailing whitespace
-- after hitting the right arrow the screen scrolls down by one line
edit.run_after_keychord(Editor_state, 'right')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
end
function test_right_arrow_scrolls_down_in_wrapped_line()
App.screen.check(y, 'jkl', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi ', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'baseline/screen:2')
-- after hitting the left arrow the screen scrolls up to first screen line
edit.run_after_keychord(Editor_state, 'left')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'kl', 'screen:3')
end
function test_left_arrow_scrolls_up_in_wrapped_line()
App.screen.check(y, 'ghij', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 7, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after typing something the line wraps and the screen scrolls down
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'a', 'screen:1')
end
function test_typing_on_bottom_line_scrolls_down()
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
local y = Editor_state.top
App.screen.check(y, 'kl', 'screen:2')
end
function test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom()
App.screen.check(y, 'j', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 4, 'screen_top')
check_eq(Editor_state.cursor1.line, 5, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:1')
-- after hitting the enter key the screen does not scroll down
edit.run_after_keychord(Editor_state, 'return')
App.screen.check(y, 'hi', 'screen:3')
end
function test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom()
App.screen.check(y, 'g', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 4, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after hitting the enter key the screen scrolls down
edit.run_after_keychord(Editor_state, 'return')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi ', 'screen:3')
end
function test_enter_on_bottom_line_scrolls_down()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc ', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'mno', 'baseline/screen:3') -- line wrapping includes trailing whitespace
-- after hitting the page-up key the screen scrolls up to top
edit.run_after_keychord(Editor_state, 'pageup')
App.screen.check(y, 'jkl', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'screen:3')
end
function test_pageup_scrolls_up_from_middle_screen_line()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc ', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'mno', 'baseline/screen:3') -- line wrapping includes trailing whitespace
-- after hitting the page-up key the screen scrolls up to top
edit.run_after_keychord(Editor_state, 'pageup')
App.screen.check(y, 'jkl', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:2')
end
function test_pageup_scrolls_up_by_screen_line()
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:2')
-- after pageup the cursor goes to first line
edit.run_after_keychord(Editor_state, 'pageup')
App.screen.check(y, 'def', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:3')
end
function test_pageup()
App.screen.check(y, 'abc', 'screen:2')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
y = Editor_state.top
-- empty first line
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after hitting the up arrow the screen scrolls up by one line
edit.run_after_keychord(Editor_state, 'up')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 5, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
end
function test_up_arrow_scrolls_up_to_empty_line()
App.screen.check(y, 'ghi', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'baseline/screen:3')
-- after hitting the up arrow the screen scrolls up to final screen line of previous line
edit.run_after_keychord(Editor_state, 'up')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
end
function test_up_arrow_scrolls_up_to_final_screen_line()
App.screen.check(y, 'jkl', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi ', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'baseline/screen:2')
-- after hitting the up arrow the screen scrolls up to first screen line
edit.run_after_keychord(Editor_state, 'up')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'screen:3')
end
function test_up_arrow_scrolls_up_by_one_screen_line()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
y = Editor_state.top
App.screen.check(y, 'jkl', 'baseline/screen:3')
-- after hitting the up arrow the screen scrolls up by one line
edit.run_after_keychord(Editor_state, 'up')
App.screen.check(y, 'ghi', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'screen:3')
end
function test_up_arrow_scrolls_up_by_one_line()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
-- the screen is unchanged
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after hitting the up arrow the cursor moves up by 1 line
edit.run_after_keychord(Editor_state, 'up')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'mno', 'screen:3')
end
function test_up_arrow_moves_cursor()
App.screen.check(y, 'kl', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghij', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 3, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
y = Editor_state.top
check_eq(Editor_state.screen_top1.line, 3, 'baseline2/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'baseline2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'baseline2/cursor:pos')
-- after hitting down arrow the screen doesn't scroll down further, and certainly doesn't scroll up
edit.run_after_keychord(Editor_state, 'down')
App.screen.check(y, 'ghij', 'baseline/screen:3')
-- after hitting pagedown the screen scrolls down to start of a long line
edit.run_after_keychord(Editor_state, 'pagedown')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'kl', 'screen:3')
end
App.screen.check(y, 'ghij', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghij', 'baseline/screen:3')
-- after hitting the down arrow the screen scrolls down by one line
edit.run_after_keychord(Editor_state, 'down')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
end
function test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word()
App.screen.check(y, 'ghi ', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi ', 'baseline/screen:3') -- line wrapping includes trailing whitespace
-- after hitting the down arrow the screen scrolls down by one line
edit.run_after_keychord(Editor_state, 'down')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'jkl', 'screen:3')
end
function test_down_arrow_scrolls_down_by_one_screen_line()
App.screen.check(y, 'ghi', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 4, 'cursor')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after hitting the down arrow the screen scrolls down by one line
edit.run_after_keychord(Editor_state, 'down')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'screen:3')
end
function test_down_arrow_scrolls_down_by_one_line()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
-- the screen is unchanged
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- after hitting the down arrow, the cursor moves down by 1 line
edit.run_after_keychord(Editor_state, 'down')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'screen_top:pos')
end
function test_down_arrow_moves_cursor()
App.screen.check(y, 'mno ', 'screen:3')
end
function test_pagedown_never_moves_up()
App.screen.check(y, 'jkl ', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi ', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'screen_top:pos')
y = Editor_state.top
App.screen.check(y, 'ghi ', 'baseline/screen:3')
-- after pagedown we scroll down the very long wrapping line
edit.run_after_keychord(Editor_state, 'pagedown')
App.screen.check(y, 'def ', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc ', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'screen:1')
end
function test_pagedown_can_start_from_middle_of_long_wrapping_line()
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor')
y = Editor_state.top + drawing_height
App.screen.check(y, 'abc', 'baseline/screen:1')
-- after pagedown the screen draws the drawing up top
-- 15px margin + 10px margin + 25px drawing + 10px margin + 15px line3 = 75px < screen height 80px
edit.run_after_keychord(Editor_state, 'pagedown')
check_eq(Editor_state.lines[2].mode, 'drawing', 'baseline/lines')
Editor_state.cursor1 = {line=1, pos=1}
Editor_state.screen_top1 = {line=1, pos=1}
Editor_state.screen_bottom1 = {}
local drawing_height = Drawing_padding_height + drawing_width/2 -- default
-- initially the screen displays the first line and the drawing
-- 15px margin + 15px line1 + 10px margin + 25px drawing + 10px margin = 75px < screen height 80px
edit.draw(Editor_state)
local y = Editor_state.top
App.screen.check(y, 'ghi', 'screen:2')
end
function test_pagedown_skips_drawings()
App.screen.check(y, 'def', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
y = Editor_state.top
App.screen.check(y, 'def', 'baseline/screen:2')
-- after pagedown the bottom line becomes the top
edit.run_after_keychord(Editor_state, 'pagedown')
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
check_nil(Editor_state.selection1.line, 'check')
end
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
end
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
end
function test_select_text_repeatedly_using_mouse_and_shift()
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
end
function test_select_text_using_mouse_and_shift()
App.screen.check(y, 'def', 'screen:3')
end
function test_select_text_using_mouse()
App.screen.check(y, 'zbc', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'axy', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- paste some text including a newline, check that new line is created
App.clipboard = 'xy\nz'
edit.run_after_keychord(Editor_state, 'C-v')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.lines[1].data, '', 'data:1')
check_eq(Editor_state.lines[2].data, 'abc', 'data:2')
end
function test_insert_from_clipboard()
App.screen.check(y, 'def', 'screen:3')
end
function test_insert_newline_at_start_of_line()
App.screen.check(y, 'bc', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'a', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
y = Editor_state.top
App.screen.check(y, 'ghi', 'baseline/screen:3')
-- hitting the enter key splits the line
edit.run_after_keychord(Editor_state, 'return')
App.screen.check(y, 'def', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'fg', 'screen:3')
end
function test_insert_newline()
App.screen.check(y, 'de', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.screen_top1.line, 1, 'check')
check_eq(Editor_state.lines[1].data, 'ahi', 'data')
end
App.screen.check(y, 'jkl', 'baseline/screen:3')
-- set up a selection starting above the currently displayed page
Editor_state.selection1 = {line=1, pos=2}
-- delete selection
edit.run_after_keychord(Editor_state, 'backspace')
-- page scrolls up
App.screen.check(y, 'ghi', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'def', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.lines[1].data, 'xyzdef', 'check')
end
function test_deleting_selection_may_scroll()
check_eq(Editor_state.lines[1].data, 'bc', 'data')
end
function test_paste_replaces_selection()
check_eq(App.clipboard, 'a', 'clipboard')
-- selected text is deleted
check(Editor_state.selection1.line, 'check')
end
function test_cut()
check_eq(App.clipboard, 'a', 'clipboard')
-- selection is reset since shift key is not pressed
check_nil(Editor_state.selection1.line, 'check')
check_eq(Editor_state.lines[1].data, 'Dbc', 'data')
end
function test_copy_does_not_reset_selection()
check_eq(Editor_state.lines[1].data, 'xbc', 'check')
end
function test_edit_with_shift_key_deletes_selection()
check_nil(Editor_state.selection1.line, 'check')
check_eq(Editor_state.lines[1].data, 'abc', 'data')
end
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 1, 'selection:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
end
function test_cursor_movement_without_shift_resets_selection()
check_eq(Editor_state.cursor1.pos, 20, 'cursor')
end
function test_select_text()
App.screen.check(y, 'the quick brown fox ', 'baseline/screen:1')
y = y + Editor_state.line_height
-- click past the end of the screen line
edit.run_after_mouse_click(Editor_state, App.screen.width-2,y-2, 1)
-- cursor moves to end of screen line
check_eq(Editor_state.cursor1.pos, 15, 'cursor') -- one more than the number of UTF-8 code-points
end
function test_click_past_end_of_word_wrapping_line()
App.screen.check(y, 'am', 'baseline/screen:3')
y = y + Editor_state.line_height
-- click past the end of it
edit.run_after_mouse_click(Editor_state, App.screen.width-2,y-2, 1)
-- cursor moves to end of line
App.screen.check(y, 'I’m ad', 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'madam ', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.pos, 15, 'cursor') -- one more than the number of UTF-8 code-points
end
function test_click_past_end_of_wrapping_line_containing_non_ascii()
App.screen.check(y, 'am', 'baseline/screen:3')
y = y + Editor_state.line_height
-- click past the end of it
edit.run_after_mouse_click(Editor_state, App.screen.width-2,y-2, 1)
-- cursor moves to end of line
App.screen.check(y, "I'm ad", 'baseline/screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'madam ', 'baseline/screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'cursor:pos')
end
function test_click_past_end_of_wrapping_line()
App.screen.check(y, "I'm ad", 'baseline/screen:2')
y = y + Editor_state.line_height
-- click past end of second screen line
edit.run_after_mouse_click(Editor_state, App.screen.width-2,y-2, 1)
-- cursor moves to end of screen line
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'cursor:pos')
end
function test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen()
App.screen.check(y, "I'm ad", 'baseline/screen:2')
y = y + Editor_state.line_height
-- click past end of second screen line
edit.run_after_mouse_click(Editor_state, App.screen.width-2,y-2, 1)
-- cursor moves to end of screen line
App.screen.check(y, 'madam ', 'baseline/screen:1')
y = y + Editor_state.line_height
App.screen.check(y, '’m a', 'screen:3')
end
function test_click_on_wrapping_line()
App.screen.check(y, 'am I', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'mad', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ijk', 'screen:3')
end
function test_draw_wrapping_text_containing_non_ascii()
-- draw a long line containing non-ASCII
App.screen.check(y, 'e fgh', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abcd ', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
end
function test_draw_text_wrapping_within_word()
-- arrange a screen line that needs to be split within a word
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
end
App.screen.check(y, 'ghi', 'screen:3')
end
App.screen.check(y, 'def ', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc ', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'fgh', 'screen:3')
end
function test_draw_word_wrapping_text()
App.screen.check(y, 'de', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
App.screen.check(y, 'ghi', 'screen:3')
end
function test_draw_wrapping_text()
App.screen.check(y, 'def', 'screen:2')
y = y + Editor_state.line_height
App.screen.check(y, 'abc', 'screen:1')
y = y + Editor_state.line_height
check_eq(Editor_state.cursor1.line, 1, 'cursor')
end
function test_draw_text()
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
end
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
end
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
end
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
-- selection is empty to avoid perturbing future edits
check_eq(Editor_state.cursor1.line, 2, 'line')
check_eq(Editor_state.cursor1.pos, 4, 'pos')
end
check_eq(Editor_state.cursor1.pos, 9, 'check')
end
function test_move_past_end_of_word_on_next_line()
check_eq(Editor_state.cursor1.pos, 4, 'check')
end
function test_skip_multiple_spaces_to_next_word()
check_eq(Editor_state.cursor1.pos, 8, 'check')
end
function test_skip_past_tab_to_next_word()
check_eq(Editor_state.cursor1.pos, 4, 'check')
end
function test_skip_to_next_word()
check_eq(Editor_state.cursor1.line, 1, 'line')
check_eq(Editor_state.cursor1.pos, 5, 'pos')
end
function test_move_past_end_of_word()
check_eq(Editor_state.cursor1.pos, 1, 'check')
end
function test_move_to_start_of_word_on_previous_line()
check_eq(Editor_state.cursor1.pos, 9, 'check')
end
function test_skip_multiple_spaces_to_previous_word()
check_eq(Editor_state.cursor1.pos, 1, 'check')
end
function test_skip_past_tab_to_previous_word()
check_eq(Editor_state.cursor1.pos, 1, 'check')
end
function test_skip_to_previous_word()
check_eq(Editor_state.cursor1.pos, 1, 'check')
end
function test_move_to_start_of_previous_word()
check_eq(Editor_state.cursor1.line, 2, 'line')
check_eq(Editor_state.cursor1.pos, 1, 'pos')
end
function test_move_to_start_of_word()
check_eq(Editor_state.cursor1.line, 1, 'line')
check_eq(Editor_state.cursor1.pos, 4, 'pos') -- past end of line
end
function test_move_right_to_next_line()
check_eq(Editor_state.cursor1.pos, 2, 'check')
end
function test_move_left_to_previous_line()
check_eq(Editor_state.cursor1.pos, 1, 'check')
end
function test_move_right()
App.screen.check(y, 'a', 'screen:1')
end
function test_press_ctrl()
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
end
function test_insert_first_character()
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
end
function test_backspace_from_start_of_final_line()
check_eq(#Editor_state.lines, 2, '#lines')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
end
function test_backspace_to_delete_drawing()
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
end
function test_click_to_create_drawing()
check_eq(App.filesystem['foo'], 'abc\ndef\n', 'check')
end
check_eq(#Editor_state.lines, 3, '#lines')
check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')
check_eq(Editor_state.lines[2].data, 'def', 'lines:2')
check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')
edit.draw(Editor_state)
end
function test_drop_file_saves_previous()
check_eq(Editor_state.left, Margin_left, 'edit:left')
check_eq(Editor_state.right, App.screen.width/2 - Margin_right, 'edit:right')
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
end
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
end
function test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width()
check_eq(Editor_state.left, Margin_left, 'edit:left')
check_eq(Editor_state.right, old_editor_right, 'edit:right')
-- log browser margins are adjusted
check_eq(App.screen.width, 600, 'display:width')
-- left side margins are unchanged
check(Show_log_browser_side, 'check')
end
check(not Show_log_browser_side, 'baseline')
-- pressing ctrl+l shows log-browser side
check_eq(App.screen.width, 200, 'width')
check_eq(App.screen.height, 400, 'height')
check_eq(Editor_state.left, Margin_left, 'left_margin')
check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
-- TODO: how to make assertions about when App.update got past the early exit?
check_eq(App.screen.width, 300, 'baseline/width')
check_eq(App.screen.height, 300, 'baseline/height')
check_eq(Editor_state.left, Test_margin_left, 'baseline/left_margin')
check_eq(Editor_state.right, 300 - Test_margin_right, 'baseline/right_margin')
App.resize(200, 400)
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.lines[2].mode, 'drawing', 'baseline/lines')
App.screen.check(y, 'abc', 'baseline/screen:1')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor')
App.screen.check(y, 'def', 'screen:1')
check_eq(#Editor_state.lines, 1, 'F - test_initial_state/#lines')
check_eq(Editor_state.cursor1.line, 1, 'F - test_initial_state/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_initial_state/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_initial_state/screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'F - test_initial_state/screen_top:pos')
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(#Editor_state.lines, 1, 'F - test_backspace_to_delete_drawing/#lines')
check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_to_delete_drawing/cursor')
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
check_eq(#Editor_state.lines, 1, 'F - test_backspace_from_start_of_final_line/#lines')
check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_from_start_of_final_line/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_backspace_from_start_of_final_line/screen_top')
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_move_left_to_previous_line/line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_move_left_to_previous_line/pos') -- past end of line
check_eq(Editor_state.cursor1.line, 1, 'line')
check_eq(Editor_state.cursor1.pos, 4, 'pos') -- past end of line
check_eq(Editor_state.cursor1.line, 1, 'F - test_move_to_start_of_word_on_previous_line/line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_move_to_start_of_word_on_previous_line/pos')
check_eq(Editor_state.cursor1.line, 1, 'line')
check_eq(Editor_state.cursor1.pos, 5, 'pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_move_past_end_of_word_on_next_line/line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_move_past_end_of_word_on_next_line/pos')
check_eq(Editor_state.cursor1.line, 2, 'line')
check_eq(Editor_state.cursor1.pos, 4, 'pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_moves_cursor/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_moves_cursor/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_moves_cursor/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_click_moves_cursor/selection:pos')
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_to_left_of_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_to_left_of_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_to_left_of_line/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_takes_margins_into_account/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_on_wrapping_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_on_wrapping_line/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_on_wrapping_line_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_on_wrapping_line_takes_margins_into_account/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'F - test_click_on_wrapping_line/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 12, 'cursor:pos')
check_eq(Editor_state.cursor1.pos, 15, 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points
check_eq(Editor_state.cursor1.pos, 15, 'cursor') -- one more than the number of UTF-8 code-points
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text/selection:line')
check_eq(Editor_state.selection1.pos, 1, 'F - test_select_text/selection:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_select_text/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_select_text/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 1, 'selection:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_cursor_movement_without_shift_resets_selection')
check_eq(Editor_state.lines[1].data, 'abc', 'F - test_cursor_movement_without_shift_resets_selection/data')
check_nil(Editor_state.selection1.line, 'check')
check_eq(Editor_state.lines[1].data, 'abc', 'data')
check_nil(Editor_state.selection1.line, 'F - test_edit_with_shift_key_deletes_selection')
check_eq(Editor_state.lines[1].data, 'Dbc', 'F - test_edit_with_shift_key_deletes_selection/data')
check_nil(Editor_state.selection1.line, 'check')
check_eq(Editor_state.lines[1].data, 'Dbc', 'data')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_deleting_selection_may_scroll')
check_eq(Editor_state.lines[1].data, 'ahi', 'F - test_deleting_selection_may_scroll/data')
check_eq(Editor_state.screen_top1.line, 1, 'check')
check_eq(Editor_state.lines[1].data, 'ahi', 'data')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_insert_newline/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_newline/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_insert_newline/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_newline_at_start_of_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_insert_newline_at_start_of_line/cursor:pos')
check_eq(Editor_state.lines[1].data, '', 'F - test_insert_newline_at_start_of_line/data:1')
check_eq(Editor_state.lines[2].data, 'abc', 'F - test_insert_newline_at_start_of_line/data:2')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.lines[1].data, '', 'data:1')
check_eq(Editor_state.lines[2].data, 'abc', 'data:2')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_insert_from_clipboard/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_from_clipboard/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_insert_from_clipboard/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_using_mouse/selection:line')
check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_using_mouse_and_shift/selection:line')
check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse_and_shift/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_using_mouse_and_shift/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_select_text_using_mouse_and_shift/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:line')
check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'selection:line')
check_eq(Editor_state.selection1.pos, 2, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_pagedown/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_pagedown/cursor')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_pagedown_skips_drawings/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_pagedown_skips_drawings/cursor')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'screen_top:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pagedown_never_moves_up/screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'F - test_pagedown_never_moves_up/screen_top:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 9, 'screen_top:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_down_arrow_moves_cursor/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_down_arrow_moves_cursor/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_line/screen_top')
check_eq(Editor_state.cursor1.line, 4, 'F - test_down_arrow_scrolls_down_by_one_line/cursor')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 4, 'cursor')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'baseline2/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'baseline2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'baseline2/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_pagedown_followed_by_down_arrow_does_not_scroll_screen_up/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_moves_cursor/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_up_arrow_moves_cursor/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
App.screen.check(y, 'mno', 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')
check_eq(Editor_state.screen_top1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:pos')
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
App.screen.check(y, 'jkl', 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen:3')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')
check_eq(Editor_state.screen_top1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:pos')
App.screen.check(y, 'jkl', 'screen:3')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 5, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_enter_on_bottom_line_scrolls_down/screen_top')
check_eq(Editor_state.cursor1.line, 4, 'F - test_enter_on_bottom_line_scrolls_down/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_enter_on_bottom_line_scrolls_down/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 4, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 4, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')
check_eq(Editor_state.cursor1.line, 5, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')
check_eq(Editor_state.screen_top1.line, 4, 'screen_top')
check_eq(Editor_state.cursor1.line, 5, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')
check_eq(Editor_state.cursor1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_typing_on_bottom_line_scrolls_down/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_typing_on_bottom_line_scrolls_down/cursor:line')
check_eq(Editor_state.cursor1.pos, 7, 'F - test_typing_on_bottom_line_scrolls_down/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 7, 'cursor:pos')
App.screen.check(y, 'mno', 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')
check_eq(Editor_state.screen_top1.pos, 1, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:pos')
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_right_arrow_scrolls_down_in_wrapped_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 6, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 6, 'cursor:pos')
App.screen.check(y, 'mno', 'F - test_home_scrolls_up_in_wrapped_line/screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')
check_eq(Editor_state.screen_top1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/cursor:pos')
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'F - test_end_scrolls_down_in_wrapped_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_end_scrolls_down_in_wrapped_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 8, 'F - test_end_scrolls_down_in_wrapped_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 2, 'screen_top')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 8, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_position_cursor_on_recently_edited_wrapping_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 26, 'F - test_position_cursor_on_recently_edited_wrapping_line/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 26, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_backspace_can_scroll_up/screen_top')
check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_can_scroll_up/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
check_eq(Editor_state.cursor1.line, 1, 'cursor')
App.screen.check(y, 'mno', 'F - test_backspace_can_scroll_up_screen_line/screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/screen_top')
check_eq(Editor_state.screen_top1.pos, 1, 'F - test_backspace_can_scroll_up_screen_line/screen_top')
check_eq(Editor_state.cursor1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_backspace_can_scroll_up_screen_line/cursor:pos')
App.screen.check(y, 'mno', 'screen:3')
check_eq(Editor_state.screen_top1.line, 3, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
check_eq(Editor_state.cursor1.line, 3, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_selection/cursor:line")
check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_over_selection/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_selection_reverse/cursor:line")
check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_over_selection_reverse/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.lines[1].data, 'akl', "F - test_backspace_over_multiple_lines/data:1")
check_eq(Editor_state.lines[2].data, 'mno', "F - test_backspace_over_multiple_lines/data:2")
check_eq(Editor_state.lines[1].data, 'akl', 'data:1')
check_eq(Editor_state.lines[2].data, 'mno', 'data:2')
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_multiple_lines/cursor:line")
check_eq(Editor_state.cursor1.pos, 2, "F - test_backspace_over_multiple_lines/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_eq(Editor_state.lines[1].data, 'a', "F - test_backspace_to_start_of_line/data:1")
check_eq(Editor_state.lines[2].data, 'def', "F - test_backspace_to_start_of_line/data:2")
check_eq(Editor_state.lines[1].data, 'a', 'data:1')
check_eq(Editor_state.lines[2].data, 'def', 'data:2')
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_to_start_of_line/cursor:line")
check_eq(Editor_state.cursor1.pos, 2, "F - test_backspace_to_start_of_line/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
check_eq(Editor_state.lines[1].data, 'abc', "F - test_backspace_to_start_of_line/data:1")
check_eq(Editor_state.lines[2].data, 'f', "F - test_backspace_to_start_of_line/data:2")
check_eq(Editor_state.lines[1].data, 'abc', 'data:1')
check_eq(Editor_state.lines[2].data, 'f', 'data:2')
check_eq(Editor_state.cursor1.line, 2, "F - test_backspace_to_start_of_line/cursor:line")
check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_to_start_of_line/cursor:pos")
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_insert_text/baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_undo_insert_text/baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_undo_insert_text/baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_undo_insert_text/baseline/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'baseline/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_insert_text/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_undo_insert_text/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_undo_insert_text/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_undo_insert_text/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_delete_text/baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'F - test_undo_delete_text/baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_undo_delete_text/baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_undo_delete_text/baseline/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'baseline/cursor:line')
check_eq(Editor_state.cursor1.pos, 4, 'baseline/cursor:pos')
check_nil(Editor_state.selection1.line, 'baseline/selection:line')
check_nil(Editor_state.selection1.pos, 'baseline/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_delete_text/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_undo_delete_text/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_undo_delete_text/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_undo_delete_text/selection:pos')
--? check_eq(Editor_state.selection1.line, 2, 'F - test_undo_delete_text/selection:line')
--? check_eq(Editor_state.selection1.pos, 4, 'F - test_undo_delete_text/selection:pos')
check_eq(Editor_state.cursor1.line, 2, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'cursor:pos')
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
--? check_eq(Editor_state.selection1.line, 2, 'selection:line')
--? check_eq(Editor_state.selection1.pos, 4, 'selection:pos')
check_eq(Editor_state.lines[1].data, 'xbc', 'F - test_undo_restores_selection/baseline')
check_nil(Editor_state.selection1.line, 'F - test_undo_restores_selection/baseline:selection')
check_eq(Editor_state.lines[1].data, 'xbc', 'baseline')
check_nil(Editor_state.selection1.line, 'baseline:selection')
check_eq(Editor_state.selection1.line, 1, 'F - test_undo_restores_selection/line')
check_eq(Editor_state.selection1.pos, 2, 'F - test_undo_restores_selection/pos')
check_eq(Editor_state.selection1.line, 1, 'line')
check_eq(Editor_state.selection1.pos, 2, 'pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_search/1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_search/1/cursor:pos')
check_eq(Editor_state.cursor1.line, 2, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
check_eq(Editor_state.cursor1.line, 4, 'F - test_search/2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_search/2/cursor:pos')
check_eq(Editor_state.cursor1.line, 4, '2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_search_upwards/2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_search_upwards/2/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, '2/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '2/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_search_wrap/1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_search_wrap/1/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, '1/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_search_wrap_upwards/1/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, 'F - test_search_wrap_upwards/1/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, '1/cursor:line')
check_eq(Editor_state.cursor1.pos, 5, '1/cursor:pos')
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, Test_margin_left, 'F - test_resize_window/baseline/left_margin')
check_eq(Editor_state.right, 300 - Test_margin_right, 'F - test_resize_window/baseline/right_margin')
check_eq(App.screen.width, 300, 'baseline/width')
check_eq(App.screen.height, 300, 'baseline/height')
check_eq(Editor_state.left, Test_margin_left, 'baseline/left_margin')
check_eq(Editor_state.right, 300 - Test_margin_right, 'baseline/right_margin')
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.right, 200-Margin_right, 'F - test_resize_window/right_margin')
check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'F - test_resize_window/drawing_width')
check_eq(App.screen.width, 200, 'width')
check_eq(App.screen.height, 400, 'height')
check_eq(Editor_state.left, Margin_left, 'left_margin')
check_eq(Editor_state.right, 200-Margin_right, 'right_margin')
check_eq(Editor_state.width, 200-Margin_left-Margin_right, 'drawing_width')
check_eq(Editor_state.left, Margin_left, 'F - test_show_log_browser_side_doubles_window_width_if_possible/edit:left')
check_eq(Editor_state.right, old_editor_right, 'F - test_show_log_browser_side_doubles_window_width_if_possible/edit:right')
check_eq(Editor_state.left, Margin_left, 'edit:left')
check_eq(Editor_state.right, old_editor_right, 'edit:right')
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'F - test_show_log_browser_side_doubles_window_width_if_possible/log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'F - test_show_log_browser_side_doubles_window_width_if_possible/log:right')
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
check_eq(Editor_state.left, Margin_left, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/edit:left')
check_eq(Editor_state.right, App.screen.width/2 - Margin_right, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/edit:right')
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'F - test_show_log_browser_side_resizes_both_sides_if_cannot_double_window_width/log:right')
check_eq(Editor_state.left, Margin_left, 'edit:left')
check_eq(Editor_state.right, App.screen.width/2 - Margin_right, 'edit:right')
check_eq(Log_browser_state.left, App.screen.width/2 + Margin_left, 'log:left')
check_eq(Log_browser_state.right, App.screen.width - Margin_right, 'log:right')
check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')
check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
check_eq(#Editor_state.lines, 3, '#lines')
check_eq(Editor_state.lines[1].data, 'abc', 'lines:1')
check_eq(Editor_state.lines[2].data, 'def', 'lines:2')
check_eq(Editor_state.lines[3].data, 'ghi', 'lines:3')
check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')
check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')
check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
check_eq(#Editor_state.lines, 2, 'F - test_draw_line/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_line/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_line/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_line/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_line/baseline/#shapes')
-- draw a line
edit.run_after_mouse_press(Editor_state, Editor_state.left+5, Editor_state.top+Drawing_padding_top+6, 1)
edit.run_after_mouse_release(Editor_state, Editor_state.left+35, Editor_state.top+Drawing_padding_top+36, 1)
local drawing = Editor_state.lines[1]
check_eq(#drawing.shapes, 1, 'F - test_draw_line/#shapes')
check_eq(#drawing.points, 2, 'F - test_draw_line/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_draw_line/shape:1')
local p1 = drawing.points[drawing.shapes[1].p1]
local p2 = drawing.points[drawing.shapes[1].p2]
check_eq(p1.x, 5, 'F - test_draw_line/p1:x')
check_eq(p1.y, 6, 'F - test_draw_line/p1:y')
check_eq(p2.x, 35, 'F - test_draw_line/p2:x')
check_eq(p2.y, 36, 'F - test_draw_line/p2:y')
-- wait until save
check_eq(App.filesystem['foo'], '```lines\n```\n\n', 'check')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 2, '#points')
check_eq(drawing.shapes[1].mode, 'line', 'shape:1')
check_eq(p1.x, 5, 'p1:x')
check_eq(p1.y, 6, 'p1:y')
check_eq(p2.x, 35, 'p2:x')
check_eq(p2.y, 36, 'p2:y')
check_eq(#drawing.shapes, 1, 'F - test_draw_line/save/#shapes')
check_eq(#drawing.points, 2, 'F - test_draw_line/save/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_draw_line/save/shape:1')
check_eq(#drawing.shapes, 1, 'save/#shapes')
check_eq(#drawing.points, 2, 'save/#points')
check_eq(drawing.shapes[1].mode, 'line', 'save/shape:1')
check_eq(p1.x, 5, 'F - test_draw_line/save/p1:x')
check_eq(p1.y, 6, 'F - test_draw_line/save/p1:y')
check_eq(p2.x, 35, 'F - test_draw_line/save/p2:x')
check_eq(p2.y, 36, 'F - test_draw_line/save/p2:y')
check_eq(p1.x, 5, 'save/p1:x')
check_eq(p1.y, 6, 'save/p1:y')
check_eq(p2.x, 35, 'save/p2:x')
check_eq(p2.y, 36, 'save/p2:y')
check_eq(#Editor_state.lines, 2, 'F - test_draw_horizontal_line/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_horizontal_line/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_horizontal_line/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_horizontal_line/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_horizontal_line/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_horizontal_line/#shapes')
check_eq(#drawing.points, 2, 'F - test_draw_horizontal_line/#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'F - test_draw_horizontal_line/shape_mode')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 2, '#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'shape_mode')
check_eq(p1.x, 5, 'F - test_draw_horizontal_line/p1:x')
check_eq(p1.y, 6, 'F - test_draw_horizontal_line/p1:y')
check_eq(p2.x, 35, 'F - test_draw_horizontal_line/p2:x')
check_eq(p2.y, p1.y, 'F - test_draw_horizontal_line/p2:y')
check_eq(p1.x, 5, 'p1:x')
check_eq(p1.y, 6, 'p1:y')
check_eq(p2.x, 35, 'p2:x')
check_eq(p2.y, p1.y, 'p2:y')
check_eq(#Editor_state.lines, 2, 'F - test_draw_circle/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_circle/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_circle/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_circle/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_circle/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_circle/#shapes')
check_eq(#drawing.points, 1, 'F - test_draw_circle/#points')
check_eq(drawing.shapes[1].mode, 'circle', 'F - test_draw_horizontal_line/shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'F - test_draw_circle/radius')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'circle', 'shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'radius')
check_eq(#Editor_state.lines, 2, 'F - test_cancel_stroke/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_cancel_stroke/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_cancel_stroke/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_cancel_stroke/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_cancel_stroke/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_circle_mid_stroke/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_circle_mid_stroke/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_circle_mid_stroke/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_circle_mid_stroke/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_circle_mid_stroke/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_circle_mid_stroke/#shapes')
check_eq(#drawing.points, 1, 'F - test_draw_circle_mid_stroke/#points')
check_eq(drawing.shapes[1].mode, 'circle', 'F - test_draw_horizontal_line/shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'F - test_draw_circle_mid_stroke/radius')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'circle', 'shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'radius')
check_eq(#Editor_state.lines, 2, 'F - test_draw_arc/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_arc/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_arc/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_arc/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_arc/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_arc/#shapes')
check_eq(#drawing.points, 1, 'F - test_draw_arc/#points')
check_eq(drawing.shapes[1].mode, 'arc', 'F - test_draw_horizontal_line/shape_mode')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'arc', 'shape_mode')
check_eq(center.x, 35, 'F - test_draw_arc/center:x')
check_eq(center.y, 36, 'F - test_draw_arc/center:y')
check_eq(arc.start_angle, 0, 'F - test_draw_arc/start:angle')
check_eq(arc.end_angle, math.pi/4, 'F - test_draw_arc/end:angle')
check_eq(center.x, 35, 'center:x')
check_eq(center.y, 36, 'center:y')
check_eq(arc.start_angle, 0, 'start:angle')
check_eq(arc.end_angle, math.pi/4, 'end:angle')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_polygon/baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'F - test_draw_polygon/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_polygon/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_polygon/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_polygon/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_polygon/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle/baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'F - test_draw_rectangle/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_rectangle/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_rectangle/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_rectangle/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_rectangle/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_rectangle/#shapes')
check_eq(#drawing.points, 5, 'F - test_draw_rectangle/#points') -- currently includes every point added
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 5, '#points') -- currently includes every point added
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle_intermediate/baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'F - test_draw_rectangle_intermediate/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_rectangle_intermediate/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_rectangle_intermediate/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_rectangle_intermediate/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_rectangle_intermediate/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(pending.mode, 'rectangle', 'F - test_draw_rectangle_intermediate/shape_mode')
check_eq(#pending.vertices, 2, 'F - test_draw_rectangle_intermediate/vertices')
check_eq(pending.mode, 'rectangle', 'shape_mode')
check_eq(#pending.vertices, 2, 'vertices')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_square/baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'F - test_draw_square/baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_square/baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'F - test_draw_square/baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_square/baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_square/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, 'F - test_draw_square/#shapes')
check_eq(#drawing.points, 5, 'F - test_draw_square/#points') -- currently includes every point added
check_eq(drawing.shapes[1].mode, 'square', 'F - test_draw_square/shape_mode')
check_eq(#drawing.shapes[1].vertices, 4, 'F - test_draw_square/vertices')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 5, '#points') -- currently includes every point added
check_eq(drawing.shapes[1].mode, 'square', 'shape_mode')
check_eq(#drawing.shapes[1].vertices, 4, 'vertices')
check_eq(#drawing.shapes, 1, 'F - test_name_point/baseline/#shapes')
check_eq(#drawing.points, 2, 'F - test_name_point/baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_name_point/baseline/shape:1')
local p1 = drawing.points[drawing.shapes[1].p1]
local p2 = drawing.points[drawing.shapes[1].p2]
check_eq(p1.x, 5, 'F - test_name_point/baseline/p1:x')
check_eq(p1.y, 6, 'F - test_name_point/baseline/p1:y')
check_eq(p2.x, 35, 'F - test_name_point/baseline/p2:x')
check_eq(p2.y, 36, 'F - test_name_point/baseline/p2:y')
check_nil(p2.name, 'F - test_name_point/baseline/p2:name')
-- enter 'name' mode without moving the mouse
edit.run_after_keychord(Editor_state, 'C-n')
check_eq(Editor_state.current_drawing_mode, 'name', 'F - test_name_point/mode:1')
edit.run_after_text_input(Editor_state, 'A')
check_eq(p2.name, 'A', 'F - test_name_point')
-- still in 'name' mode
check_eq(Editor_state.current_drawing_mode, 'name', 'F - test_name_point/mode:2')
-- exit 'name' mode
edit.run_after_keychord(Editor_state, 'return')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_name_point/mode:3')
check_eq(p2.name, 'A', 'F - test_name_point')
-- wait until save
check_eq(#drawing.shapes, 1, 'save/#shapes')
check_eq(#drawing.points, 2, 'save/#points')
check_eq(drawing.shapes[1].mode, 'line', 'save/shape:1')
check_eq(p1.x, 5, 'save/p1:x')
check_eq(p1.y, 6, 'save/p1:y')
check_eq(p2.x, 35, 'save/p2:x')
check_eq(p2.y, 36, 'save/p2:y')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 2, '#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'shape_mode')
check_eq(p1.x, 5, 'p1:x')
check_eq(p1.y, 6, 'p1:y')
check_eq(p2.x, 35, 'p2:x')
check_eq(p2.y, p1.y, 'p2:y')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'circle', 'shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'radius')
check_eq(center.x, 35, 'center:x')
check_eq(center.y, 36, 'center:y')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 0, '#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'circle', 'shape_mode')
check_eq(drawing.shapes[1].radius, 30, 'radius')
check_eq(center.x, 35, 'center:x')
check_eq(center.y, 36, 'center:y')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 1, '#points')
check_eq(drawing.shapes[1].mode, 'arc', 'shape_mode')
check_eq(arc.radius, 30, 'radius')
check_eq(center.x, 35, 'center:x')
check_eq(center.y, 36, 'center:y')
check_eq(arc.start_angle, 0, 'start:angle')
check_eq(arc.end_angle, math.pi/4, 'end:angle')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 3, 'vertices')
check_eq(shape.mode, 'polygon', 'shape_mode')
check_eq(#shape.vertices, 3, 'vertices')
check_eq(p.x, 5, 'p1:x')
check_eq(p.y, 6, 'p1:y')
check_eq(p.x, 65, 'p2:x')
check_eq(p.y, 36, 'p2:y')
check_eq(p.x, 35, 'p3:x')
check_eq(p.y, 26, 'p3:y')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 5, '#points') -- currently includes every point added
check_eq(shape.mode, 'rectangle', 'shape_mode')
check_eq(#shape.vertices, 4, 'vertices')
check_eq(p.x, 35, 'p1:x')
check_eq(p.y, 36, 'p1:y')
check_eq(p.x, 75, 'p2:x')
check_eq(p.y, 76, 'p2:y')
check_eq(p.x, 70, 'p3:x')
check_eq(p.y, 81, 'p3:y')
check_eq(p.x, 30, 'p4:x')
check_eq(p.y, 41, 'p4:y')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.points, 3, '#points') -- currently includes every point added
check_eq(pending.mode, 'rectangle', 'shape_mode')
check_eq(#pending.vertices, 2, 'vertices')
check_eq(p.x, 35, 'p1:x')
check_eq(p.y, 36, 'p1:y')
check_eq(p.x, 75, 'p2:x')
check_eq(p.y, 76, 'p2:y')
check_eq(Editor_state.current_drawing_mode, 'line', 'baseline/drawing_mode')
check_eq(#Editor_state.lines, 2, 'baseline/#lines')
check_eq(Editor_state.lines[1].mode, 'drawing', 'baseline/mode')
check_eq(Editor_state.line_cache[1].starty, Editor_state.top+Drawing_padding_top, 'baseline/y')
check_eq(Editor_state.lines[1].h, 128, 'baseline/y')
check_eq(#Editor_state.lines[1].shapes, 0, 'baseline/#shapes')
check_eq(#drawing.shapes, 1, '#shapes')
check_eq(#drawing.points, 5, '#points') -- currently includes every point added
check_eq(drawing.shapes[1].mode, 'square', 'shape_mode')
check_eq(#drawing.shapes[1].vertices, 4, 'vertices')
check_eq(p.x, 35, 'p1:x')
check_eq(p.y, 36, 'p1:y')
check_eq(p.x, 65, 'p2:x')
check_eq(p.y, 66, 'p2:y')
check_eq(p.x, 35, 'p3:x')
check_eq(p.y, 96, 'p3:y')
check_eq(p.x, 5, 'p4:x')
check_eq(p.y, 66, 'p4:y')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_nil(p2.name, 'baseline/p2:name')
check_eq(Editor_state.current_drawing_mode, 'name', 'mode:1')
check_eq(p2.name, 'A', 'check1')
check_eq(Editor_state.current_drawing_mode, 'name', 'mode:2')
check_eq(Editor_state.current_drawing_mode, 'line', 'mode:3')
check_eq(p2.name, 'A', 'check2')
check_eq(#drawing.shapes, 1, 'F - test_move_point/baseline/#shapes')
check_eq(#drawing.points, 2, 'F - test_move_point/baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_move_point/baseline/shape:1')
local p1 = drawing.points[drawing.shapes[1].p1]
local p2 = drawing.points[drawing.shapes[1].p2]
check_eq(p1.x, 5, 'F - test_move_point/baseline/p1:x')
check_eq(p1.y, 6, 'F - test_move_point/baseline/p1:y')
check_eq(p2.x, 35, 'F - test_move_point/baseline/p2:x')
check_eq(p2.y, 36, 'F - test_move_point/baseline/p2:y')
-- wait until save
check_eq(p2.name, 'A', 'save')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_move_point/mode:3')
check_eq(drawing.pending, {}, 'F - test_move_point/pending')
-- wait until save
check_eq(p2.x, 35, 'save/x')
check_eq(p2.y, 36, 'save/y')
check_eq(Editor_state.current_drawing_mode, 'move', 'mode:1')
check_eq(drawing.pending.mode, 'move', 'mode:2')
check_eq(drawing.pending.target_point, p2, 'target')
check_eq(p2.x, 26, 'x')
check_eq(p2.y, 44, 'y')
check_eq(#drawing.shapes, 1, 'F - test_move_point_on_manhattan_line/baseline/#shapes')
check_eq(#drawing.points, 2, 'F - test_move_point_on_manhattan_line/baseline/#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'F - test_move_point_on_manhattan_line/baseline/shape:1')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'baseline/shape:1')
check_eq(#drawing.shapes, 2, 'F - test_delete_lines_at_point/baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_delete_lines_at_point/baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'F - test_delete_lines_at_point/baseline/shape:2')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'F - test_delete_lines_at_point/shape:1')
check_eq(drawing.shapes[2].mode, 'deleted', 'F - test_delete_lines_at_point/shape:2')
-- wait for some time
check_eq(p2.x, 26, 'save/x')
check_eq(p2.y, 44, 'save/y')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'manhattan', 'baseline/shape:1')
check_eq(Editor_state.current_drawing_mode, 'move', 'mode:1')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(#drawing.shapes, 2, 'F - test_delete_line_under_mouse_pointer/baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_delete_line_under_mouse_pointer/baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'F - test_delete_line_under_mouse_pointer/baseline/shape:2')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'F - test_delete_line_under_mouse_pointer/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'F - test_delete_line_under_mouse_pointer/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'shape:2')
check_eq(#drawing.shapes, 1, 'F - test_delete_point_from_polygon/baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'F - test_delete_point_from_polygon/baseline/mode')
check_eq(#drawing.shapes[1].vertices, 4, 'F - test_delete_point_from_polygon/baseline/vertices')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
check_eq(#drawing.shapes[1].vertices, 4, 'baseline/vertices')
check_eq(drawing.shapes[1].mode, 'polygon', 'F - test_delete_point_from_polygon/shape')
check_eq(#drawing.shapes[1].vertices, 3, 'F - test_delete_point_from_polygon/vertices')
check_eq(drawing.shapes[1].mode, 'polygon', 'shape')
check_eq(#drawing.shapes[1].vertices, 3, 'vertices')
check_eq(#drawing.shapes, 1, 'F - test_delete_point_from_polygon/baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'F - test_delete_point_from_polygon/baseline/mode')
check_eq(#drawing.shapes[1].vertices, 3, 'F - test_delete_point_from_polygon/baseline/vertices')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
check_eq(#drawing.shapes[1].vertices, 3, 'baseline/vertices')
check_eq(#drawing.shapes, 1, 'F - test_undo_name_point/baseline/#shapes')
check_eq(#drawing.points, 2, 'F - test_undo_name_point/baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_undo_name_point/baseline/shape:1')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'F - test_undo_name_point/baseline/p1:x')
check_eq(p1.y, 6, 'F - test_undo_name_point/baseline/p1:y')
check_eq(p2.x, 35, 'F - test_undo_name_point/baseline/p2:x')
check_eq(p2.y, 36, 'F - test_undo_name_point/baseline/p2:y')
check_nil(p2.name, 'F - test_undo_name_point/baseline/p2:name')
check_eq(#Editor_state.history, 1, 'F - test_undo_name_point/baseline/history:1')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_nil(p2.name, 'baseline/p2:name')
check_eq(#Editor_state.history, 1, 'baseline/history:1')
check_eq(p2.name, 'A', 'F - test_undo_name_point/baseline')
check_eq(#Editor_state.history, 3, 'F - test_undo_name_point/baseline/history:2')
check_eq(Editor_state.next_history, 4, 'F - test_undo_name_point/baseline/next_history')
check_eq(p2.name, 'A', 'baseline')
check_eq(#Editor_state.history, 3, 'baseline/history:2')
check_eq(Editor_state.next_history, 4, 'baseline/next_history')
check_eq(Editor_state.next_history, 3, 'F - test_undo_name_point/next_history')
check_eq(p2.name, '', 'F - test_undo_name_point') -- not quite what it was before, but close enough
-- wait until save
check_eq(#Editor_state.lines[1].shapes, 0, 'save')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'shape:2')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
check_eq(#drawing.shapes[1].vertices, 4, 'baseline/vertices')
check_eq(drawing.shapes[1].mode, 'polygon', 'shape')
check_eq(#drawing.shapes[1].vertices, 3, 'vertices')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'polygon', 'baseline/mode')
check_eq(#drawing.shapes[1].vertices, 3, 'baseline/vertices')
check_eq(drawing.shapes[1].mode, 'deleted', 'check')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_nil(p2.name, 'baseline/p2:name')
check_eq(#Editor_state.history, 1, 'baseline/history:1')
check_eq(p2.name, 'A', 'baseline')
check_eq(#Editor_state.history, 3, 'baseline/history:2')
check_eq(Editor_state.next_history, 4, 'baseline/next_history')
check_eq(#drawing.shapes, 1, 'F - test_undo_move_point/baseline/#shapes')
check_eq(#drawing.points, 2, 'F - test_undo_move_point/baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_undo_move_point/baseline/shape:1')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'F - test_undo_move_point/baseline/p1:x')
check_eq(p1.y, 6, 'F - test_undo_move_point/baseline/p1:y')
check_eq(p2.x, 35, 'F - test_undo_move_point/baseline/p2:x')
check_eq(p2.y, 36, 'F - test_undo_move_point/baseline/p2:y')
check_nil(p2.name, 'F - test_undo_move_point/baseline/p2:name')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_nil(p2.name, 'baseline/p2:name')
check_eq(Editor_state.next_history, 2, 'F - test_undo_move_point/next_history')
check_eq(p2.x, 35, 'F - test_undo_move_point/x')
check_eq(p2.y, 36, 'F - test_undo_move_point/y')
-- wait until save
check_eq(p2.name, '', 'save')
check_eq(#drawing.shapes, 1, 'baseline/#shapes')
check_eq(#drawing.points, 2, 'baseline/#points')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(p1.x, 5, 'baseline/p1:x')
check_eq(p1.y, 6, 'baseline/p1:y')
check_eq(p2.x, 35, 'baseline/p2:x')
check_eq(p2.y, 36, 'baseline/p2:y')
check_nil(p2.name, 'baseline/p2:name')
check_eq(p2.x, 26, 'x')
check_eq(p2.y, 44, 'y')
check_eq(Editor_state.next_history, 4, 'next_history')
check_eq(#drawing.shapes, 2, 'F - test_undo_delete_point/baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_undo_delete_point/baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'F - test_undo_delete_point/baseline/shape:2')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'F - test_undo_delete_point/shape:1')
check_eq(drawing.shapes[2].mode, 'deleted', 'F - test_undo_delete_point/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
check_eq(drawing.shapes[2].mode, 'deleted', 'shape:2')
check_eq(Editor_state.next_history, 3, 'F - test_undo_move_point/next_history')
check_eq(drawing.shapes[1].mode, 'line', 'F - test_undo_delete_point/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'F - test_undo_delete_point/shape:2')
-- wait until save
check_eq(p2.x, 35, 'save/x')
check_eq(p2.y, 36, 'save/y')
check_eq(#drawing.shapes, 2, 'baseline/#shapes')
check_eq(drawing.shapes[1].mode, 'line', 'baseline/shape:1')
check_eq(drawing.shapes[2].mode, 'line', 'baseline/shape:2')
check_eq(drawing.shapes[1].mode, 'deleted', 'shape:1')
check_eq(drawing.shapes[2].mode, 'deleted', 'shape:2')