about summary refs log tree commit diff stats
path: root/text_tests.lua
diff options
context:
space:
mode:
Diffstat (limited to 'text_tests.lua')
-rw-r--r--text_tests.lua125
1 files changed, 1 insertions, 124 deletions
diff --git a/text_tests.lua b/text_tests.lua
index 55a9e85..962de7d 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -15,32 +15,6 @@ function test_initial_state()
   check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
 end
 
-function test_click_to_create_drawing()
-  App.screen.init{width=800, height=600}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{}
-  Text.redraw_all(Editor_state)
-  edit.draw(Editor_state)
-  edit.run_after_mouse_click(Editor_state, 8,Editor_state.top+8, 1)
-  -- cursor skips drawing to always remain on text
-  check_eq(#Editor_state.lines, 2, '#lines')
-  check_eq(Editor_state.cursor1.line, 2, 'cursor')
-end
-
-function test_backspace_to_delete_drawing()
-  -- display a drawing followed by a line of text (you shouldn't ever have a drawing right at the end)
-  App.screen.init{width=120, height=60}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'```lines', '```', ''}
-  Text.redraw_all(Editor_state)
-  -- cursor is on text as always (outside tests this will get initialized correctly)
-  Editor_state.cursor1.line = 2
-  -- backspacing deletes the drawing
-  edit.run_after_keychord(Editor_state, 'backspace', 'backspace')
-  check_eq(#Editor_state.lines, 1, '#lines')
-  check_eq(Editor_state.cursor1.line, 1, 'cursor')
-end
-
 function test_backspace_from_start_of_final_line()
   -- display final line of text with cursor at start of it
   App.screen.init{width=120, height=60}
@@ -995,34 +969,6 @@ function test_pagedown()
   App.screen.check(y, 'ghi', 'screen:2')
 end
 
-function test_pagedown_skips_drawings()
-  -- some lines of text with a drawing intermixed
-  local drawing_width = 50
-  App.screen.init{width=Editor_state.left+drawing_width, height=80}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'abc',               -- height 15
-                                  '```lines', '```',   -- height 25
-                                  'def',               -- height 15
-                                  'ghi'}               -- height 15
-  Text.redraw_all(Editor_state)
-  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}
-  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, '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', 'pagedown')
-  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, 'def', 'screen:1')
-end
-
 function test_pagedown_can_start_from_middle_of_long_wrapping_line()
   -- draw a few lines starting from a very long wrapping line
   App.screen.init{width=Editor_state.left+30, height=60}
@@ -1100,30 +1046,6 @@ function test_down_arrow_moves_cursor()
   App.screen.check(y, 'ghi', 'screen:3')
 end
 
-function test_down_arrow_skips_drawing()
-  -- some lines of text with a drawing intermixed
-  local drawing_width = 50
-  App.screen.init{width=Editor_state.left+drawing_width, height=100}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'abc',               -- height 15
-                                  '```lines', '```',   -- height 25
-                                  'ghi'}
-  Text.redraw_all(Editor_state)
-  Editor_state.cursor1 = {line=1, pos=1}
-  Editor_state.screen_top1 = {line=1, pos=1}
-  edit.draw(Editor_state)
-  local y = Editor_state.top
-  App.screen.check(y, 'abc', 'baseline/screen:1')
-  y = y + Editor_state.line_height
-  local drawing_height = Drawing_padding_height + drawing_width/2  -- default
-  y = y + drawing_height
-  App.screen.check(y, 'ghi', 'baseline/screen:3')
-  check(Editor_state.cursor_x, 'baseline/cursor_x')
-  -- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawing
-  edit.run_after_keychord(Editor_state, 'down', 'down')
-  check_eq(Editor_state.cursor1.line, 3, 'cursor')
-end
-
 function test_down_arrow_scrolls_down_by_one_line()
   -- display the first three lines with the cursor on the bottom line
   App.screen.init{width=120, height=60}
@@ -1267,30 +1189,6 @@ function test_up_arrow_moves_cursor()
   App.screen.check(y, 'ghi', 'screen:3')
 end
 
-function test_up_arrow_skips_drawing()
-  -- some lines of text with a drawing intermixed
-  local drawing_width = 50
-  App.screen.init{width=Editor_state.left+drawing_width, height=100}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'abc',               -- height 15
-                                  '```lines', '```',   -- height 25
-                                  'ghi'}
-  Text.redraw_all(Editor_state)
-  Editor_state.cursor1 = {line=3, pos=1}
-  Editor_state.screen_top1 = {line=1, pos=1}
-  edit.draw(Editor_state)
-  local y = Editor_state.top
-  App.screen.check(y, 'abc', 'baseline/screen:1')
-  y = y + Editor_state.line_height
-  local drawing_height = Drawing_padding_height + drawing_width/2  -- default
-  y = y + drawing_height
-  App.screen.check(y, 'ghi', 'baseline/screen:3')
-  check(Editor_state.cursor_x, 'baseline/cursor_x')
-  -- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawing
-  edit.run_after_keychord(Editor_state, 'up', 'up')
-  check_eq(Editor_state.cursor1.line, 1, 'cursor')
-end
-
 function test_up_arrow_scrolls_up_by_one_line()
   -- display the lines 2/3/4 with the cursor on line 2
   App.screen.init{width=120, height=60}
@@ -1318,27 +1216,6 @@ function test_up_arrow_scrolls_up_by_one_line()
   App.screen.check(y, 'ghi', 'screen:3')
 end
 
-function test_up_arrow_scrolls_up_by_one_line_skipping_drawing()
-  -- display lines 3/4/5 with a drawing just off screen at line 2
-  App.screen.init{width=120, height=60}
-  Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'abc', '```lines', '```', 'def', 'ghi', 'jkl'}
-  Text.redraw_all(Editor_state)
-  Editor_state.cursor1 = {line=3, pos=1}
-  Editor_state.screen_top1 = {line=3, pos=1}
-  edit.draw(Editor_state)
-  local y = Editor_state.top
-  App.screen.check(y, 'def', 'baseline/screen:1')
-  y = y + Editor_state.line_height
-  App.screen.check(y, 'ghi', 'baseline/screen:2')
-  y = y + Editor_state.line_height
-  App.screen.check(y, 'jkl', 'baseline/screen:3')
-  -- after hitting the up arrow the screen scrolls up to previous text line
-  edit.run_after_keychord(Editor_state, 'up', 'up')
-  check_eq(Editor_state.screen_top1.line, 1, 'screen_top')
-  check_eq(Editor_state.cursor1.line, 1, 'cursor')
-end
-
 function test_up_arrow_scrolls_up_by_one_screen_line()
   -- display lines starting from second screen line of a line
   App.screen.init{width=Editor_state.left+30, height=60}
@@ -2001,7 +1878,7 @@ end
 function test_search()
   App.screen.init{width=120, height=60}
   Editor_state = edit.initialize_test_state()
-  Editor_state.lines = load_array{'```lines', '```', 'def', 'ghi', '’deg'}  -- contains unicode quote in final line
+  Editor_state.lines = load_array{'abc', 'def', 'ghi', '’deg'}  -- contains unicode quote in final line
   Text.redraw_all(Editor_state)
   Editor_state.cursor1 = {line=1, pos=1}
   Editor_state.screen_top1 = {line=1, pos=1}