fix failing tests on my Android tablet

The obvious way to fix them on Android breaks them on PC and, more
seriously, my Android phone. It seems more robust to slightly dilate a
few widths instead.

With this fix I'm no longer supporting LÖVE v12, that's too annoying an
additional constraint to satisfy.
This commit is contained in:
Kartik K. Agaram 2023-11-12 17:45:42 -08:00
parent 1b5b589d7f
commit e4211628a3
4 changed files with 24 additions and 19 deletions

View File

@ -17,6 +17,8 @@ screens and more restrictive storage models:
* Spurious filedropped events have been [observed](https://github.com/love2d/love-android/issues/254) on LÖVE Android.
* No resizing or moving windows since it's not clear that that's ever
supported on mobile devices. Assume all windows are always maximized.
* Some tweaks to automated tests to pass on my Android devices, with zero
confidence of any sort of coverage.
* ... _(there will likely be others)_
## Getting started

View File

@ -100,9 +100,11 @@ end
function App.run_tests_and_initialize()
App.load()
Test_errors = {}
--? App.run_tests()
App.run_tests()
if #Test_errors > 0 then
error(('There were %d test failures:\n\n%s'):format(#Test_errors, table.concat(Test_errors)))
Current_app = 'error'
Error_message = ('There were %d test failures:\n\n%s'):format(#Test_errors, table.concat(Test_errors))
print(Error_message)
end
App.disable_tests()
App.initialize_globals()

View File

@ -76,7 +76,7 @@ function App.version_check()
Error_message = nil
Error_count = 0
-- we'll reuse error mode on load for an initial version check
local supported_versions = {'11.4', '12.0'} -- put the recommended version first
local supported_versions = {'11.4'} -- put the recommended version first
local minor_version
Major_version, minor_version = love.getVersion()
Version = Major_version..'.'..minor_version
@ -113,6 +113,7 @@ function App.initialize(arg)
elseif Current_app == 'source' then
source.initialize(arg)
elseif Current_app == 'error' then
App.screen.width, App.screen.height, App.screen.flags = App.screen.size()
else
assert(false, 'unknown app "'..Current_app..'"')
end

View File

@ -396,7 +396,7 @@ end
function test_click_on_wrapping_line()
-- display two screen lines with cursor on one of them
App.screen.init{width=50, height=80}
App.screen.init{width=60, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc def ghi jkl mno pqr stu'}
Text.redraw_all(Editor_state)
@ -433,7 +433,7 @@ end
function test_draw_text_wrapping_within_word()
-- arrange a screen line that needs to be split within a word
App.screen.init{width=60, height=60}
App.screen.init{width=61, height=60}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abcd e fghijk', 'xyz'}
Text.redraw_all(Editor_state)
@ -451,7 +451,7 @@ end
function test_draw_wrapping_text_containing_non_ascii()
-- draw a long line containing non-ASCII
App.screen.init{width=60, height=60}
App.screen.init{width=65, height=60}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'madam Im adam', 'xyz'} -- notice the non-ASCII apostrophe
Text.redraw_all(Editor_state)
@ -469,7 +469,7 @@ end
function test_click_past_end_of_screen_line()
-- display a wrapping line
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
-- 12345678901234
Editor_state.lines = load_array{"madam I'm adam"}
@ -492,7 +492,7 @@ end
function test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen()
-- display a wrapping line from its second screen line
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
-- 12345678901234
Editor_state.lines = load_array{"madam I'm adam"}
@ -513,7 +513,7 @@ end
function test_click_past_end_of_wrapping_line()
-- display a wrapping line
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
-- 12345678901234
Editor_state.lines = load_array{"madam I'm adam"}
@ -537,7 +537,7 @@ end
function test_click_past_end_of_wrapping_line_containing_non_ascii()
-- display a wrapping line containing non-ASCII
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
-- 12345678901234
Editor_state.lines = load_array{'madam Im adam'} -- notice the non-ASCII apostrophe
@ -582,7 +582,7 @@ end
function test_select_text()
-- display a line of text
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc def'}
Text.redraw_all(Editor_state)
@ -604,7 +604,7 @@ end
function test_cursor_movement_without_shift_resets_selection()
-- display a line of text with some part selected
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)
@ -622,7 +622,7 @@ end
function test_edit_deletes_selection()
-- display a line of text with some part selected
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)
@ -639,7 +639,7 @@ end
function test_edit_with_shift_key_deletes_selection()
-- display a line of text with some part selected
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)
@ -661,7 +661,7 @@ end
function test_copy_does_not_reset_selection()
-- display a line of text with a selection
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)
@ -679,7 +679,7 @@ end
function test_cut()
-- display a line of text with some part selected
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)
@ -697,7 +697,7 @@ end
function test_paste_replaces_selection()
-- display a line of text with a selection
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc', 'def'}
Text.redraw_all(Editor_state)
@ -971,7 +971,7 @@ end
function test_select_all_text()
-- display a single line of text
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc def'}
Text.redraw_all(Editor_state)
@ -2077,7 +2077,7 @@ end
function test_undo_restores_selection()
-- display a line of text with some part selected
App.screen.init{width=75, height=80}
App.screen.init{width=80, height=80}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc'}
Text.redraw_all(Editor_state)