diff options
author | Ted Gould <ted@canonical.com> | 2009-10-09 12:06:56 -0400 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-10-09 12:06:56 -0400 |
commit | dce80730186bfb61b1919652d71fc249b8df5f75 (patch) | |
tree | 4b73ccf17a97ffe3c0d66d1376360fd4e0430c76 /tests/dbusmenu-gtk/mago_tests/dbusmenu.py | |
parent | 1e668b013089c5a4027102bca75f7542917fef2d (diff) | |
download | libdbusmenu-dce80730186bfb61b1919652d71fc249b8df5f75.tar.gz libdbusmenu-dce80730186bfb61b1919652d71fc249b8df5f75.tar.bz2 libdbusmenu-dce80730186bfb61b1919652d71fc249b8df5f75.zip |
Making the mago tests run in the make file in tests and making it so that they use a standard Python file.
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") + + + + |