diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-04-02 11:46:48 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-04-02 20:28:27 +0200 |
commit | fa74f7571094dba15a7e8e216beef11786cff203 (patch) | |
tree | 17ee9c993ed43a8c5b340ed27454fff3ae8dfd20 /test/functional/ui/screen.lua | |
parent | d9235efa76229708586d3c9db3dcbac46127ca0a (diff) | |
download | rneovim-fa74f7571094dba15a7e8e216beef11786cff203.tar.gz rneovim-fa74f7571094dba15a7e8e216beef11786cff203.tar.bz2 rneovim-fa74f7571094dba15a7e8e216beef11786cff203.zip |
refactor(tests): allow to extend the new base set of attrs
We start at 100 so we can make the base set larger if needed. (It might need to
grow/shrink as a result of adopting the new default color scheme as the
default for tests)
Usage best illustrataded by example.
Improving the workflow for making new tests with `screen:snapshot_util()` will
be a follow up.
Diffstat (limited to 'test/functional/ui/screen.lua')
-rw-r--r-- | test/functional/ui/screen.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index ee9334a9fe..ab535afbf4 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -255,6 +255,17 @@ function Screen:set_default_attr_ids(attr_ids) self._default_attr_ids = attr_ids end +function Screen:add_extra_attr_ids(extra_attr_ids) + local attr_ids = vim.deepcopy(Screen._global_default_attr_ids) + for id, attr in pairs(extra_attr_ids) do + if type(id) == 'number' and id < 100 then + error('extra attr ids should be at least 100 or be strings') + end + attr_ids[id] = attr + end + self._default_attr_ids = attr_ids +end + function Screen:get_default_attr_ids() return deepcopy(self._default_attr_ids) end |