From 5d3ce83fc6ae08957c88148ad87ae566dd03f08f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 25 Jun 2009 09:13:27 -0500 Subject: Changing the python script to be generated so that it can get the paths correctly. It's almost making Python into a real language. Not quite, but getting there. --- tests/dbusmenu-gtk/Makefile.am | 17 +++++++--- tests/dbusmenu-gtk/dbusmenu.py | 71 --------------------------------------- tests/dbusmenu-gtk/dbusmenu.py.in | 71 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 75 deletions(-) delete mode 100644 tests/dbusmenu-gtk/dbusmenu.py create mode 100644 tests/dbusmenu-gtk/dbusmenu.py.in (limited to 'tests/dbusmenu-gtk') diff --git a/tests/dbusmenu-gtk/Makefile.am b/tests/dbusmenu-gtk/Makefile.am index 976646f..04054ed 100644 --- a/tests/dbusmenu-gtk/Makefile.am +++ b/tests/dbusmenu-gtk/Makefile.am @@ -3,13 +3,22 @@ check: tests tests: mago -mago: dbusmenu.xml - PYTHONPATH=$(srcdir) mago -f $(builddir)/dbusmenu.xml +mago: dbusmenu.xml dbusmenu.py + PYTHONPATH=$(builddir) mago -f $(builddir)/dbusmenu.xml dbusmenu.xml: dbusmenu.xml.in sed -e "s|\@srcdir\@|$(srcdir)|" $< > $@ -EXTRA_DIST = dbusmenu.xml +dbusmenu.py: dbusmenu.py.in + sed -e "s|\@srcdir\@|$(srcdir)|" $< > $@ + +EXTRA_DIST = \ + dbusmenu.xml \ + dbusmenu.xml.in \ + dbusmenu.py \ + dbusmenu.py.in -CLEANFILES = dbusmenu.xml +CLEANFILES = \ + dbusmenu.xml \ + dbusmenu.py diff --git a/tests/dbusmenu-gtk/dbusmenu.py b/tests/dbusmenu-gtk/dbusmenu.py deleted file mode 100644 index 17b38ac..0000000 --- a/tests/dbusmenu-gtk/dbusmenu.py +++ /dev/null @@ -1,71 +0,0 @@ -from mago.test_suite.main import SingleApplicationTestSuite -from mago.application.main import Application - -import ldtp, ooldtp, ldtputils - -class DbusMenuGtkApp(): - LAUNCHER = "./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") - - - - 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") + + + + -- cgit v1.2.3