diff options
author | Ted Gould <ted@canonical.com> | 2009-06-25 10:49:00 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-06-25 10:49:00 -0500 |
commit | c16cdb68a985be741418366402abdf0c37c971c2 (patch) | |
tree | 448164d26048db562712de530e985701b8d419f8 /tests/dbusmenu-gtk/dbusmenu.py.in | |
parent | 0b3ed894b14a8d8e09b43a2d8aba5eb0d4a28719 (diff) | |
parent | b70b4e535349f6a7bb0caa5c0118eb748eafbc83 (diff) | |
download | libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.tar.gz libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.tar.bz2 libdbusmenu-c16cdb68a985be741418366402abdf0c37c971c2.zip |
Merging in the updated gtkmenu branch with tests.
Diffstat (limited to 'tests/dbusmenu-gtk/dbusmenu.py.in')
-rw-r--r-- | tests/dbusmenu-gtk/dbusmenu.py.in | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/dbusmenu-gtk/dbusmenu.py.in b/tests/dbusmenu-gtk/dbusmenu.py.in new file mode 100644 index 0000000..ce159e1 --- /dev/null +++ b/tests/dbusmenu-gtk/dbusmenu.py.in @@ -0,0 +1,71 @@ +from mago.test_suite.main import SingleApplicationTestSuite +from mago.application.main import Application + +import ldtp, ooldtp, ldtputils + +class DbusMenuGtkApp(): + LAUNCHER = "@srcdir@/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") + + + + |