[core/theme] Improve items that are lists
Until now, using a list as prefix/suffix didn't work as expected, because the corresponding method for retrieving the value was called multiple times, and each time, the next icon would be retrieved. Changed the logic inside the theme to only update the indices every time that an actual update was happening.
This commit is contained in:
parent
4b402438cc
commit
4cd6444bbf
2 changed files with 10 additions and 4 deletions
|
@ -63,7 +63,7 @@ class theme(unittest.TestCase):
|
|||
core.event.trigger('next-widget')
|
||||
self.assertEqual(self.cycleTheme['cycle'][2]['fg'], theme.get('fg'))
|
||||
self.assertEqual(self.cycleTheme['cycle'][2]['bg'], theme.get('bg'))
|
||||
|
||||
|
||||
with unittest.mock.patch('core.output.sys.stdout'):
|
||||
core.event.trigger('update')
|
||||
self.assertEqual(self.cycleTheme['cycle'][0]['fg'], theme.get('fg'))
|
||||
|
@ -108,6 +108,8 @@ class theme(unittest.TestCase):
|
|||
|
||||
for i in range(0, len(expected)*3):
|
||||
self.assertEqual(expected[i%len(expected)], theme.get('fg', widget))
|
||||
self.assertEqual(expected[i%len(expected)], theme.get('fg', widget)) # ensure multiple invocations are OK
|
||||
core.event.trigger('update')
|
||||
|
||||
def test_state(self):
|
||||
widget = core.widget.Widget()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue