drop last couple of manual tests

This commit is contained in:
Kartik K. Agaram 2022-06-17 22:24:46 -07:00
parent b8e8ac2481
commit 1ecc3f43e5
3 changed files with 32 additions and 13 deletions

View File

@ -10,15 +10,3 @@ Lua is dynamically typed. Tests can't patch over lack of type-checking.
* All strings are UTF-8. Bytes within them are not characters. I try to label
byte offsets as _offset, and character positions as _pos. For example,
string.sub should never use a _pos to substring, only an _offset.
### Todo list
* resize:
* Create a file containing a long line of characters without spaces. Try
resizing the window vertically and horizontally, as far as possible.
* line-width button
* Create a file containing a single line with a reasonable number of
characters. Move the cursor towards the end of the line. Click on
line-width icon in the top margin, slide it left and right. Watch the line
of characters wrap and unwrap in response. Text should not be selected.

View File

@ -12,6 +12,8 @@ local geom = require 'geom'
require 'help'
require 'icons'
require 'main_tests'
-- run in both tests and a real run
function App.initialize_globals()
-- a line is either text or a drawing
@ -167,7 +169,7 @@ function parse_geometry_spec(geometry_spec)
return true
end
function love.resize(w, h)
function App.resize(w, h)
--? print(("Window resized to width: %d and height: %d."):format(w, h))
App.screen.width, App.screen.height = w, h
Line_width = math.min(40*App.width(Em), App.screen.width-50)

29
main_tests.lua Normal file
View File

@ -0,0 +1,29 @@
function test_resize_window()
io.write('\ntest_resize_window')
Filename = 'foo'
App.screen.init{width=Margin_left+300, height=300}
check_eq(App.screen.width, Margin_left+300, 'F - test_resize_window/baseline/width')
check_eq(App.screen.height, 300, 'F - test_resize_window/baseline/height')
App.resize(200, 400)
check_eq(App.screen.width, 200, 'F - test_resize_window/width')
check_eq(App.screen.height, 400, 'F - test_resize_window/height')
-- TODO: how to make assertions about when App.update got past the early exit?
end
function test_adjust_line_width()
io.write('\ntest_adjust_line_width')
Filename = 'foo'
App.screen.init{width=Margin_left+300, height=300}
Line_width = 256
App.draw() -- initialize button
App.run_after_mouse_press(Margin_left+256, Margin_top-3, 1)
App.mouse_move(Margin_left+200, 37)
-- no change for some time
App.wait_fake_time(0.01)
App.update(0)
check_eq(Line_width, 256, 'F - test_adjust_line_width/early')
-- after 0.1s the change takes
App.wait_fake_time(0.1)
App.update(0)
check_eq(Line_width, 200, 'F - test_adjust_line_width')
end