dogtail r404 - in trunk: . examples



Author: zcerza
Date: Wed Dec 31 18:08:29 2008
New Revision: 404
URL: http://svn.gnome.org/viewvc/dogtail?rev=404&view=rev

Log:
* examples/appstartup.py: Add a new example that launches a given
application, then checks to see that it started correctly by looking for a Node
with the given roleName.


Added:
   trunk/examples/appstartup.py   (contents, props changed)
Modified:
   trunk/ChangeLog

Added: trunk/examples/appstartup.py
==============================================================================
--- (empty file)
+++ trunk/examples/appstartup.py	Wed Dec 31 18:08:29 2008
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import os
+import signal
+import sys
+
+from dogtail.config import config
+config.logDebugToFile = False
+from dogtail.procedural import *
+from dogtail.tc import TCNode, TCBool
+tcn = TCNode()
+
+def appStartup(binary, roleName = "menu item"):
+    """Launches the given binary, then checks to see that the application 
+    started correctly by looking for a Node with the given roleName."""
+
+    pid = run(binary)
+    tcn.compare("app exists", None, focus.application.node)
+    focus.widget.node = focus.app.node.child(roleName=roleName)
+    tcn.compare("app has a %s" % roleName, None, focus.widget.node)
+    os.kill(pid, signal.SIGTERM)
+
+if __name__ == "__main__":
+    binary = sys.argv[1]
+    appStartup(binary)
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]