about summary refs log tree commit diff stats
path: root/drawing_tests.lua
diff options
context:
space:
mode:
Diffstat (limited to 'drawing_tests.lua')
-rw-r--r--drawing_tests.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/drawing_tests.lua b/drawing_tests.lua
index ede25f0..3484436 100644
--- a/drawing_tests.lua
+++ b/drawing_tests.lua
@@ -3,7 +3,7 @@
 -- of specific shapes. In particular, no tests of freehand drawings.
 
 function test_creating_drawing_saves()
-  App.screen.init{width=120, height=60}
+  App.screen.init{width=800, height=600}
   Editor_state = edit.initialize_test_state()
   Editor_state.filename = 'foo'
   Editor_state.lines = load_array{}
@@ -32,7 +32,7 @@ function test_draw_line()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- draw a line
@@ -77,7 +77,7 @@ function test_draw_horizontal_line()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- draw a line that is more horizontal than vertical
@@ -105,7 +105,7 @@ function test_draw_circle()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- draw a circle
@@ -134,7 +134,7 @@ function test_cancel_stroke()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- start drawing a line
@@ -172,7 +172,7 @@ function test_draw_circle_mid_stroke()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- draw a circle
@@ -200,7 +200,7 @@ function test_draw_arc()
   edit.draw(Editor_state)
   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(Text.starty(Editor_state, 1), 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')
   -- draw an arc
@@ -231,7 +231,7 @@ function test_draw_polygon()
   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(Text.starty(Editor_state, 1), 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')
   -- first point
@@ -269,7 +269,7 @@ function test_draw_rectangle()
   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(Text.starty(Editor_state, 1), 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')
   -- first point
@@ -313,7 +313,7 @@ function test_draw_rectangle_intermediate()
   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(Text.starty(Editor_state, 1), 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')
   -- first point
@@ -349,7 +349,7 @@ function test_draw_square()
   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(Text.starty(Editor_state, 1), 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')
   -- first point