diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-07 17:40:36 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-12-14 10:27:48 (GMT) |
commit | a9b3987e460b8efa8602b43e1beb227aeb38ffa3 (patch) | |
tree | 3ab4bbcef0d0017b5ab11e7bcfd6f4b70e53886f | |
parent | 1339bad98ecd28a7227cc43ae32b01f8ad01fda3 (diff) |
Improve the activities list testunit-tests
We are now popping up the palette and verifying it contains
the items we expect.
-rw-r--r-- | tests/test_activitieslist.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/test_activitieslist.py b/tests/test_activitieslist.py index a5a2e7c..8b54215 100644 --- a/tests/test_activitieslist.py +++ b/tests/test_activitieslist.py @@ -14,10 +14,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import sys import os import unittest - -from jarabe.desktop.activitieslist import ActivityListPalette +import subprocess tests_dir = os.path.dirname(__file__) base_dir = os.path.dirname(tests_dir) @@ -50,6 +50,33 @@ class MockActivityInfo: def is_user_activity(self): return True +def _create_activities_palette(): + from gi.repository import Gtk + from jarabe.desktop.activitieslist import ActivityListPalette + + palette = ActivityListPalette(MockActivityInfo()) + palette.popup() + + Gtk.main() + class TestActivitiesList(unittest.TestCase): + def _check_activities_palette(self): + from sugar3.test import uitree + + root = uitree.get_root() + + for name in ["Make favorite", "Erase", "Start new"]: + node = root.find_child(name=name, role_name="label") + self.assertIsNotNone(node) + def test_activity_list_palette(self): - palette = ActivityListPalette(MockActivityInfo()) + process = subprocess.Popen(["python", __file__, + "_create_activities_palette"]) + try: + self._check_activities_palette() + finally: + process.terminate() + +if __name__ == '__main__': + globals()[sys.argv[1]]() + |