fill3: Optionally limit scroll of portals

This commit is contained in:
Andrew Hamilton 2022-01-24 23:06:42 +10:00
parent e13d470d82
commit 923a72fef6
2 changed files with 34 additions and 1 deletions

View file

@ -45,6 +45,15 @@ class WidgetTests(unittest.TestCase):
self.assert_string(portal.appearance_for((8, 3)), " \n foobar \n ")
portal.position = (5, 0)
self.assert_string(portal.appearance_for((2, 1)), "r ")
# limit scroll
portal.position = (0, 0)
self.assertEqual(portal.limit_scroll((1, 1), (1, 1)), (0, 0))
portal.position = (-1, 0)
self.assertEqual(portal.limit_scroll((1, 1), (1, 1)), (0, 0))
portal.position = (1, 0)
self.assertEqual(portal.limit_scroll((6, 1), (1, 1)), (0, 0))
portal.is_left_aligned = False
self.assertEqual(portal.limit_scroll((6, 1), (1, 1)), (-5, 0))
def test_border_widget(self):
contents = fill3.Filler(self.TEXT_A)