mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
tests/screen.lua: treat "resize" like any other event
Saves ~10 seconds in UI tests
This commit is contained in:
@@ -172,9 +172,6 @@ end
|
|||||||
|
|
||||||
function Screen:try_resize(columns, rows)
|
function Screen:try_resize(columns, rows)
|
||||||
uimeths.try_resize(columns, rows)
|
uimeths.try_resize(columns, rows)
|
||||||
-- Give ourselves a chance to _handle_resize, which requires using
|
|
||||||
-- self.sleep() (for the resize notification) rather than run()
|
|
||||||
self:sleep(0.1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Screen:set_option(option, value)
|
function Screen:set_option(option, value)
|
||||||
@@ -210,11 +207,6 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
|
|||||||
row = row:sub(1, #row - 1) -- Last char must be the screen delimiter.
|
row = row:sub(1, #row - 1) -- Last char must be the screen delimiter.
|
||||||
table.insert(expected_rows, row)
|
table.insert(expected_rows, row)
|
||||||
end
|
end
|
||||||
if not any then
|
|
||||||
assert(self._height == #expected_rows,
|
|
||||||
"Expected screen state's row count(" .. #expected_rows
|
|
||||||
.. ') differs from configured height(' .. self._height .. ') of Screen.')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
local ids = attr_ids or self._default_attr_ids
|
local ids = attr_ids or self._default_attr_ids
|
||||||
local ignore = attr_ignore or self._default_attr_ignore
|
local ignore = attr_ignore or self._default_attr_ignore
|
||||||
@@ -225,6 +217,12 @@ function Screen:expect(expected, attr_ids, attr_ignore, condition, any)
|
|||||||
return tostring(res)
|
return tostring(res)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if expected and not any and self._height ~= #expected_rows then
|
||||||
|
return ("Expected screen state's row count(" .. #expected_rows
|
||||||
|
.. ') differs from configured height(' .. self._height .. ') of Screen.')
|
||||||
|
end
|
||||||
|
|
||||||
local actual_rows = {}
|
local actual_rows = {}
|
||||||
for i = 1, self._height do
|
for i = 1, self._height do
|
||||||
actual_rows[i] = self:_row_repr(self._rows[i], ids, ignore)
|
actual_rows[i] = self:_row_repr(self._rows[i], ids, ignore)
|
||||||
|
Reference in New Issue
Block a user