Handle n+1 characters in the scrolling decorator

This commit is contained in:
Pavle Portic 2020-05-15 20:31:00 +02:00
parent 3bb2fb8247
commit a8df4a5f9d
No known key found for this signature in database
GPG key ID: 6758ACE46AA2A849
3 changed files with 19 additions and 2 deletions

View file

@ -81,5 +81,14 @@ class config(unittest.TestCase):
self.module.text = "this is a different song (0:12)"
self.assertEqual(self.module.text[0:10], self.module.get(self.widget))
def test_n_plus_one(self):
self.module.text = "10 letters"
self.module.set("scrolling.width", 9)
self.assertEqual(self.module.text[0:9], self.module.get(self.widget))
self.assertEqual(self.module.text[1:10], self.module.get(self.widget))
self.assertEqual(self.module.text[0:9], self.module.get(self.widget))
self.assertEqual(self.module.text[1:10], self.module.get(self.widget))
self.assertEqual(self.module.text[0:9], self.module.get(self.widget))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4