Skip to content

Commit

Permalink
Updated tests for CommandSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Sep 1, 2019
1 parent b9b957e commit 1b5da46
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/core/tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ def _changed(self):
def test_cmdset_init(self):
test_widget = toga.Widget(factory=toga_dummy.factory)
cs = toga.CommandSet(test_widget)
self.assertEqual(cs.widget, test_widget)
self.assertEqual(cs._values, set())
self.assertEqual(cs._commands, set())
self.assertEqual(cs.on_change, None)

def test_cmdset_add(self):
self.changed = False
test_widget = toga.Widget(factory=toga_dummy.factory)
cs = toga.CommandSet(test_widget, on_change=self._changed)
cs = toga.CommandSet(
factory=toga_dummy.factory,
widget=test_widget,
on_change=self._changed
)
grp = toga.Group('Test group', order=10)
cmd = toga.Command(
lambda x: print('Hello World'),
Expand All @@ -147,11 +150,16 @@ def test_cmdset_add(self):
factory=toga_dummy.factory
)
cs.add(cmd)

self.assertTrue(self.changed)
self.assertIsNotNone(cmd._impl)

def test_cmdset_iter(self):
test_widget = toga.Widget(factory=toga_dummy.factory)
cs = toga.CommandSet(test_widget)
cs = toga.CommandSet(
factory=toga_dummy.factory,
widget=test_widget
)
grp = toga.Group('Test group', order=10)
cmd = toga.Command(
lambda x: print('Hello World'),
Expand Down

0 comments on commit 1b5da46

Please sign in to comment.