Update FakePad to fix tests

This commit is contained in:
Yohann D'ANELLO 2020-11-26 22:32:25 +01:00
parent 0726a8db9e
commit 2690eb8760
2 changed files with 9 additions and 2 deletions

View File

@ -71,7 +71,8 @@ class Display:
""" """
top_y, top_x = max(0, top_y), max(0, top_x) top_y, top_x = max(0, top_y), max(0, top_x)
window_y, window_x = max(0, window_y), max(0, window_x) window_y, window_x = max(0, window_y), max(0, window_x)
screen_max_y, screen_max_x = self.screen.getmaxyx() screen_max_y, screen_max_x = self.screen.getmaxyx() if self.screen \
else 42, 42
last_y, last_x = min(screen_max_y - 1, last_y), \ last_y, last_x = min(screen_max_y - 1, last_y), \
min(screen_max_x - 1, last_x) min(screen_max_x - 1, last_x)

View File

@ -1,3 +1,6 @@
from typing import Tuple
class FakePad: class FakePad:
""" """
In order to run tests, we simulate a fake curses pad that accepts functions In order to run tests, we simulate a fake curses pad that accepts functions
@ -10,8 +13,11 @@ class FakePad:
smincol: int, smaxrow: int, smaxcol: int) -> None: smincol: int, smaxrow: int, smaxcol: int) -> None:
pass pass
def clear(self) -> None: def erase(self) -> None:
pass pass
def resize(self, height: int, width: int) -> None: def resize(self, height: int, width: int) -> None:
pass pass
def getmaxyx(self) -> Tuple[int, int]:
return 42, 42