From 10b15caad9680b5158714255d51373f9aa28ae93 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sun, 16 Sep 2018 01:40:13 +0900 Subject: [PATCH] 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 --- kitty_tests/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty_tests/__init__.py b/kitty_tests/__init__.py index c7b6eeb36..5ea7d3b3e 100644 --- a/kitty_tests/__init__.py +++ b/kitty_tests/__init__.py @@ -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)