tests: add options param to create_screen()

Always apply defaults when creating a screen (the C-side global state
default will not have the intended values without this), and provide a
way to override default values with a new optional parameter
This commit is contained in:
Dominique Martinet 2018-09-16 01:40:13 +09:00
parent e08238d5a0
commit 10b15caad9

View File

@ -4,6 +4,8 @@
from unittest import TestCase
from kitty.config import Options, defaults, merge_configs
from kitty.fast_data_types import set_options
from kitty.fast_data_types import LineBuf, Cursor, Screen, HistoryBuf
@ -72,7 +74,9 @@ class BaseTest(TestCase):
ae = TestCase.assertEqual
maxDiff = 2000
def create_screen(self, cols=5, lines=5, scrollback=5, cell_width=10, cell_height=20):
def create_screen(self, cols=5, lines=5, scrollback=5, cell_width=10, cell_height=20, options={}):
options = Options(merge_configs(defaults._asdict(), options))
set_options(options)
c = Callbacks()
return Screen(c, lines, cols, scrollback, cell_width, cell_height, 0, c)