diff options
| author | Ted Gould <ted@gould.cx> | 2009-12-08 14:10:38 -0600 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2009-12-08 14:10:38 -0600 |
| commit | 115665755152eb58a43583cb61bd79bad6e115a7 (patch) | |
| tree | 3d59c6ac11121beee109148d53b008529a028d5d /tests/dbusmenu-gtk/mago_tests/dbusmenu.py | |
| parent | aaa4ebbb1825dc423b08dd6801712bc92556de86 (diff) | |
| parent | 3dd457a08ccb07205ac12d03895258de4fd7c236 (diff) | |
| download | libdbusmenu-115665755152eb58a43583cb61bd79bad6e115a7.tar.gz libdbusmenu-115665755152eb58a43583cb61bd79bad6e115a7.tar.bz2 libdbusmenu-115665755152eb58a43583cb61bd79bad6e115a7.zip | |
* Updating to trunk
* Test suite fixes and automation support
* dbus-dumper tool
* Switch to org.ayatana
Diffstat (limited to 'tests/dbusmenu-gtk/mago_tests/dbusmenu.py')
| -rw-r--r-- | tests/dbusmenu-gtk/mago_tests/dbusmenu.py | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/dbusmenu-gtk/mago_tests/dbusmenu.py b/tests/dbusmenu-gtk/mago_tests/dbusmenu.py new file mode 100644 index 0000000..5e9f691 --- /dev/null +++ b/tests/dbusmenu-gtk/mago_tests/dbusmenu.py @@ -0,0 +1,71 @@ +from mago.test_suite.main import SingleApplicationTestSuite +from mago.application.main import Application + +import ldtp, ooldtp, ldtputils, os.path + +class DbusMenuGtkApp(): + LAUNCHER = os.path.join(os.path.dirname(__file__), "..", "dbusMenuTest") + WINDOW = "frmlibdbusmenu-gtktest" + + def open(self, menu_schema=''): + ldtp.launchapp(self.LAUNCHER, [menu_schema]) + + def menu_exists(self, menu=''): + app = ooldtp.context(self.WINDOW) + + if menu == '': + menu = "mnu1" + + try: + component = app.getchild(menu) + except ldtp.LdtpExecutionError: + return False + + return True + + def get_submenus(self, menu=''): + app = ooldtp.context(self.WINDOW) + + if menu == '': + menu = "mnu1" + + component = app.getchild(menu) + + try: + submenus = component.listsubmenus() + except ldtp.LdtpExecutionError: + return "" + + return submenus + +class DbusMenuGtkTest(SingleApplicationTestSuite): + APPLICATION_FACTORY = DbusMenuGtkApp + + def cleanup(self): + ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70) + + def teardown(self): + ldtp.waittillguinotexist(self.application.WINDOW, guiTimeOut=70) + + def testStaticMenu(self, menu_schema, menu_item='', notexists=''): + self.application.open(menu_schema) + ldtp.waittillguiexist(self.application.WINDOW) + + if notexists == "True": + if self.application.menu_exists(menu_item): + raise AssertionError("The menu item exists") + else: + if not self.application.menu_exists(menu_item): + raise AssertionError("The menu item does not exists") + + + def testSubmenus(self, menu_schema, menu_item='', submenus=''): + self.application.open(menu_schema) + ldtp.waittillguiexist(self.application.WINDOW) + + if submenus != self.application.get_submenus(menu_item): + raise AssertionError("The submenus are different") + + + + |
