Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-07 17:40:36 (GMT)
committer Simon Schampijer <simon@laptop.org>2013-01-22 09:10:12 (GMT)
commit668ba9a910a53740b4c84eadfddbfca04d105d72 (patch)
tree24d1b47a1838ea77e87e57bdfbf1685f17aadb3a
parent400117171011642c844f06c7a6e48c88746953a4 (diff)
Improve the activities list test
We are now popping up the palette and verifying it contains the items we expect. Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--tests/test_activitieslist.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/test_activitieslist.py b/tests/test_activitieslist.py
index a5a2e7c..2ff8d78 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,32 @@ 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]]()