[tests] add core/widget tests

This commit is contained in:
tobi-wan-kenobi 2020-05-02 14:14:12 +02:00
parent 5ee97dbb09
commit 4bd23950c6
2 changed files with 19 additions and 0 deletions

View file

@ -22,3 +22,4 @@
- convert some stuff to simple attributes to reduce LOCs
- theme.exclude (battery)
- use add_widget() instead of core.widget.Widget()
- use widget index for bumblebee-ctl as alternative (??)

View file

@ -70,4 +70,22 @@ class widget(unittest.TestCase):
module.states = ['a', 'b']
self.assertEqual(['state1', 'state2', 'a', 'b'], self.someWidget.state())
def test_multiple_widget_themes(self):
widget1 = core.widget.Widget(full_text='a')
widget2 = core.widget.Widget(full_text='b')
widget3 = core.widget.Widget(full_text='c')
module = TestModule(widgets=[widget1, widget2, widget3])
module.set('theme.test', '1,2,3')
module.set('theme.test2', 'x')
self.assertEqual('1', widget1.theme('test'))
self.assertEqual('2', widget2.theme('test'))
self.assertEqual('3', widget3.theme('test'))
self.assertEqual('x', widget1.theme('test2'))
self.assertEqual(None, widget2.theme('test2'))
self.assertEqual(None, widget3.theme('test2'))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4