Hello community,
here is the log from the commit of package ldtp
checked in at Fri Sep 22 00:53:30 CEST 2006.
--------
--- ldtp/ldtp.changes 2006-09-07 21:17:35.000000000 +0200
+++ ldtp/ldtp.changes 2006-09-22 00:24:18.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Sep 22 00:23:46 CEST 2006 - dobey@suse.de
+
+- Update to newere CVS snapshot for many bug fixes and features
+ for better testing of accessibility in the desktop
+
+-------------------------------------------------------------------
Old:
----
ldtp-0.5.0cvs20060907.tar.bz2
New:
----
ldtp-0.5.0cvs20060921.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ldtp.spec ++++++
--- /var/tmp/diff_new_pack.3GS5lZ/_old 2006-09-22 00:53:19.000000000 +0200
+++ /var/tmp/diff_new_pack.3GS5lZ/_new 2006-09-22 00:53:19.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package ldtp (Version 0.5.0cvs20060907)
+# spec file for package ldtp (Version 0.5.0cvs20060921)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -17,7 +17,7 @@
Group: Productivity/Other
Autoreqprov: on
Requires: python
-Version: 0.5.0cvs20060907
+Version: 0.5.0cvs20060921
Release: 1
Summary: Linux Desktop Testing Project (LDTP)
URL: http://ldtp.freedesktop.org
@@ -128,6 +128,9 @@
/usr/%{_lib}/python%{py_ver}/site-packages/*
%changelog -n ldtp
+* Fri Sep 22 2006 - dobey@suse.de
+- Update to newere CVS snapshot for many bug fixes and features
+ for better testing of accessibility in the desktop
* Thu Sep 07 2006 - dobey@suse.de
- Update to a CVS snapshot for many bug fixes and features for
testing accessibility in the desktop
++++++ ldtp-0.5.0cvs20060907.tar.bz2 -> ldtp-0.5.0cvs20060921.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/python/ChangeLog new/ldtp-0.5.0cvs20060921/python/ChangeLog
--- old/ldtp-0.5.0cvs20060907/python/ChangeLog 2006-09-07 20:31:42.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/python/ChangeLog 2006-09-21 19:45:03.000000000 +0200
@@ -1,11 +1,25 @@
-2006-09-07 Rodney Dawes
+2006-09-21 Rodney Dawes
- * Makefile.am: Use a cleaner method of installing the python modules
- and scripts that properly supports uninstallation
+ * ldtp.py (remap): Update the documentation as undoremap () no longer
+ needs to be called after calling remap () and using the updated map
+ (undoremap): Add this method back in for compatibility, so that scripts
+ which already use it won't fail complaining that undoremap is undefined
+ Document undoremap as deprecated
- * license.txt:
- * setup.py: We don't need these old files any more with the new method
- of installing the python modules
+2006-09-18 Nagappan A
+
+ * ldtputils.py (execute): Throw exception if LTFX command not
+ found in the default executable PATH
+
+2006-09-12 Nagappan A
+
+ * ldtp.py (launchapp): launchapp can now take optional command
+ line argument
+
+2006-09-11 Nagappan A
+
+ * ldtp.py (launchapp): Moved launchapp from ldtputils.py to
+ ldtp.py
2006-08-31 Nagappan A
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/python/ldtp.py new/ldtp-0.5.0cvs20060921/python/ldtp.py
--- old/ldtp-0.5.0cvs20060907/python/ldtp.py 2006-09-01 20:35:52.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/python/ldtp.py 2006-09-21 19:42:04.000000000 +0200
@@ -253,17 +253,21 @@
flag = True
# Get client socket fd based on thread id
client = _sockFdPool.get (threading.currentThread ())
+
+ # Encode the message in UTF-8 so we don't break on extended
+ # characters in the application GUIs
+ buffer = msg.encode ('utf8')
# Pack length (integer value) in network byte order
- msglen = struct.pack ('!i', len (msg))
+ msglen = struct.pack ('!i', len (buffer))
# Send message length
client.send (msglen)
# Send message
- client.send (msg)
+ client.send (buffer)
ldtpDebug = os.getenv ('LDTP_DEBUG')
if ldtpDebug != None and ldtpDebug == '2':
- print 'Send packet', msg
+ print 'Send packet', buffer
sendLck.release ()
- except socket.error, msg:
+ except socket.error, buffer:
if flag == True:
# Reason for using the flag:
# 'Do not call this method when the lock is unlocked.'
@@ -1898,13 +1902,9 @@
def remap (applicationName, windowName):
""" We can handle dynamically created widgets (meaning widgets created at run time) using
this remap function. Calling remap will generate appmap for the given dialog at run
- time and update the hash table. Then we can access the new widgets. But please make
- sure to call undoremap() once the required functions are performed so that the hash
- table will be reverted back to its original state. The reason for having undoremap()
- is that subsequent calls to remap() might corrupt the hash table containg the appmap
- entries.
-
- Please not that the <application-name> should be same as the one given as the commmand-line
+ time and update the hash table. Then we can access the new widgets.
+
+ Please note that the <application-name> should be same as the one given as the commmand-line
argument for appmap generation.
INPUT: remap ('<application-name>', '<window name>')
@@ -1921,6 +1921,17 @@
except LdtpExecutionError, msg:
raise LdtpExecutionError (str (msg))
+# Deprecated undoremap function as it is no longer needed
+
+def undoremap (applicationName, windowName):
+ """ This function is deprecated and no longer needs to be called.
+ This function is a no-op and immediately returns, but exists to
+ maintain compatibility with scripts which call it.
+
+ INPUT: undoremap ('<application-name>', 'window name>')
+ """
+ return 1
+
# Log Function
def startlog (logFileName, fileOverWrite = 1):
@@ -1989,23 +2000,22 @@
# MenuItem Functions
# Table Functions
+def selectrow (windowName, tableName, rowText, nthMatch = -1):
+ """Selects the row with the text in the table
+ INPUT: selectevent ('<window name>', '<table name>', '<row text to be selected>')
+
+ OUTPUT: Returns 1 on success and 0 on error."""
+ try:
+ _requestId = str (random.randint (0, sys.maxint))
+ _message = generatexml ('selectrow', _requestId, windowName, tableName, rowText, str(nthMatch))
+ sendpacket (_message)
+ _responseStatus, _responseData = getresponse (_requestId)
+ if _responseStatus[0] != 0:
+ raise LdtpExecutionError ('selectrow failed: ' + _responseStatus[1])
+ return 1
+ except LdtpExecutionError, msg:
+ raise LdtpExecutionError (str (msg))
-def selectrow (windowName, tableName, rowText):
- """Selects the row with the text in the table
- INPUT: selectevent ('<window name>', '<table name>', '<row text to be selected>')
-
- OUTPUT: Returns 1 on success and 0 on error."""
- try:
- _requestId = str (random.randint (0, sys.maxint))
- _message = generatexml ('selectrow', _requestId, windowName, tableName, rowText)
- sendpacket (_message)
- _responseStatus, _responseData = getresponse (_requestId)
- if _responseStatus[0] != 0:
- raise LdtpExecutionError ('selectrow failed: ' + _responseStatus[1])
- return 1
- except LdtpExecutionError, msg:
- raise LdtpExecutionError (str (msg))
-
def selectrowindex (windowName, tableName, rowIndex):
"""Selects the row with the index in the table
INPUT: selectevent ('<window name>', '<table name>', <row index>)
@@ -3029,3 +3039,15 @@
return 1
except LdtpExecutionError, msg:
return 0
+
+def launchapp (appname, env=1):
+ """
+ OUTPUT: None"""
+ try:
+ _requestId = str (random.randint (0, sys.maxint))
+ _message = generatexml ('launchapp', _requestId, appname, str(env))
+ sendpacket (_message)
+ _responseStatus, _responseData = getresponse (_requestId)
+ except LdtpExecutionError, msg:
+ pass
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/python/ldtprunner new/ldtp-0.5.0cvs20060921/python/ldtprunner
--- old/ldtp-0.5.0cvs20060907/python/ldtprunner 2006-09-01 20:35:52.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/python/ldtprunner 2006-09-18 20:49:10.000000000 +0200
@@ -27,7 +27,8 @@
#
#############################################################################
-import sys, re
+import sys, re, os, commands
+import xml.dom.minidom
if len (sys.argv) < 2:
print 'Syntax: gldap <XML File>'
@@ -40,8 +41,6 @@
print 'Syntax: gldap <XML File>'
sys.exit (1)
-import xml.dom.minidom
-
try:
dom = xml.dom.minidom.parse (sys.argv[1])
except xml.parsers.expat.ExpatError, msg:
@@ -51,8 +50,6 @@
print 'XML \"' + sys.argv[1] + '\" file not found'
sys.exit (1)
-import ldtp, ldtputils, traceback
-
def getText (nodelist):
rc = ""
for node in nodelist:
@@ -60,6 +57,8 @@
rc = rc + node.data
return rc
+import ldtp, ldtputils, traceback
+
def executeldtp (ldtpxmldata):
ldtpxml = ldtpxmldata.getElementsByTagName ("ldtp")
if ldtpxml == []:
@@ -76,7 +75,8 @@
logfileappend = int (logfileupdate)
except ValueError:
# print 'Log file append status not integer value - ' + logfileupdate
- log ('Log file append status not integer value - ' + logfileupdate, 'warning')
+ log ('Log file append status not integer value - '
+ + logfileupdate, 'warning')
None
# print 'Log append - ' + logfileappend
except IndexError:
@@ -221,12 +221,35 @@
break
ldtp.log (scriptname, 'scriptend')
scriptPassCount = scriptPassCount + 1
- ldtp.log (str (scriptPassCount) + ' test scripts passed of ' + str (totalScripts), 'groupstatus')
+ ldtp.log (str (scriptPassCount) + ' test scripts passed of ' +
+ str (totalScripts), 'groupstatus')
if scriptPassCount != totalScripts:
raise ldtp.LdtpExecutionError ('One or more test scripts failed !')
-import os
+def enable_accessibility():
+ global old_accessibility_value
+ old_accessibility_value = commands.getoutput('gconftool-2 --get ' +
+ '/desktop/gnome/interface'+
+ '/accessibility')
+ if old_accessibility_value == 'true':
+ return # accessibility is enabled
+
+ if commands.getstatusoutput ('gconftool-2 --set --type bool /desktop/gnome'
+ + '/interface/accessibility true')[0] != 0:
+ raise ldtp.LdtpExecutionError ('Accessibility not enabled')
+
+def replace_accessibility():
+ global old_accessibility_value
+ if old_accessibility_value == 'true':
+ return
+ if commands.getstatusoutput ('gconftool-2 --set --type bool /desktop/gnome'
+ + '/interface/accessibility false')[0] != 0:
+ raise ldtp.LdtpExecutionError ('Unable to reset Accessibility')
+
sys.path = sys.path + ['.']
+old_accessibility_value = 'false'
os.chdir (os.getcwdu ())
+enable_accessibility()
executeldtp (dom)
+replace_accessibility()
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/python/ldtputils.py new/ldtp-0.5.0cvs20060921/python/ldtputils.py
--- old/ldtp-0.5.0cvs20060907/python/ldtputils.py 2006-08-04 18:59:46.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/python/ldtputils.py 2006-09-18 20:49:11.000000000 +0200
@@ -157,23 +157,11 @@
############# Application Functions #################
-def launchapp (application, env = 0):
- if env == 1:
- os.putenv ('GTK_MODULES', 'gail:atk-bridge');
- os.putenv ('GNOME_ACCESSIBILITY', '1');
- pid = os.fork ()
- if pid == 0:
- #os.execvp (application, [''])
- commands.getstatusoutput (application)
- os._exit(os.EX_OK)
- # Let us wait so that the application launches
- time.sleep (5)
-
def execute (cmd):
status = commands.getstatusoutput (cmd)
if status[0] != 0:
ldtp.log (status[1], 'error')
- return 0
+ raise LdtpExecutionError (status[1])
return 1
########### LTFX Functions ###############
@@ -183,7 +171,7 @@
status = commands.getstatusoutput (cmd)
if status[0] != 0:
ldtp.log (status[1], 'error')
- return None
+ raise LdtpExecutionError (status[1])
return status[1]
def windowexists (window_name):
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ChangeLog new/ldtp-0.5.0cvs20060921/src/ChangeLog
--- old/ldtp-0.5.0cvs20060907/src/ChangeLog 2006-09-07 20:33:37.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ChangeLog 2006-09-20 17:42:05.000000000 +0200
@@ -1,7 +1,27 @@
-2006-09-07 Rodney Dawes
+2006-09-20 Nagappan A
- * Makefile.am (ldtp_SOURCES): Need device.h and ldtp-record.h here
- (EXTRA_DIST): Make sure localization.c is always disted
+ * ldtp-appmap.c (search_key_regexp_based): Fixed a bug reported by
+ Guofu Xu - Palm Source. Included * at end of pattern.
+
+2006-09-19 Nagappan A
+
+ * tree-table.c (double_click, double_click_row): Added two new
+ functions
+
+2006-09-14 Prashanth Mohan
+
+ * tree-table.c (select_row): Added support for selecting Nth
+ occurence of a value in a tree table row
+
+2006-09-12 Nagappan A
+
+ * client-handler.c (handle_request): launchapp can now take
+ optional command line arguments
+
+2006-09-11 Nagappan A
+
+ * client-handler.c (handle_request): Moved launchapp from client
+ side to server side, based on requirement from Palm Source.
2006-08-31 Nagappan A
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/Makefile.am new/ldtp-0.5.0cvs20060921/src/Makefile.am
--- old/ldtp-0.5.0cvs20060907/src/Makefile.am 2006-09-07 17:29:18.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/Makefile.am 2006-09-20 17:41:15.000000000 +0200
@@ -75,8 +75,8 @@
ldtp-record.h
if ENABLE_LOCALIZATION
-ldtp_SOURCES += \
- localization.c
+ ldtp_SOURCES += \
+ localization.c
endif
ldtp_LDADD = \
@@ -86,8 +86,8 @@
$(CSPI_1_0_LIBS)
if ENABLE_LOCALIZATION
-ldtp_LDADD += \
- $(LOCALIZATION_LIB)
+ ldtp_LDADD += \
+ $(LOCALIZATION_LIB)
endif
EXTRA_DIST = \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/client-handler.c new/ldtp-0.5.0cvs20060921/src/client-handler.c
--- old/ldtp-0.5.0cvs20060907/src/client-handler.c 2006-08-18 20:35:59.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/client-handler.c 2006-09-18 20:49:11.000000000 +0200
@@ -624,6 +624,23 @@
return;
}
switch (command) {
+ case LDTP_CMD_LAUNCHAPP: {
+ GError *error = NULL;
+ if (cctxt->req->component && g_ascii_strcasecmp(cctxt->req->component, "1") == 0) {
+ g_setenv ("GTK_MODULES", "gail:atk-bridge", TRUE);
+ g_setenv ("GNOME_ACCESSIBILITY", "1", TRUE);
+ }
+ if (g_spawn_command_line_async (cctxt->req->context, &error)) {
+ // Let us wait so that the application launches
+ sleep (5);
+ }
+ else {
+ if (error)
+ g_print ("%s\n", error->message);
+ *err = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_LAUNCH_APP);
+ }
+ return;
+ }
case LDTP_CMD_SETAPPMAP:
case LDTP_CMD_INITAPPMAP: {
char *appmap_filename = NULL;
@@ -1282,8 +1299,8 @@
uint32_t packet_len;
uint32_t pckt_len = 0;
uint32_t prev_pckt_len = 0;
- size_t i = 0;
- size_t bytes_read = 0;
+ uint32_t i = 0;
+ uint32_t bytes_read = 0;
uint32_t resp_size = 0;
char *resp_pckt = NULL;
@@ -1370,17 +1387,6 @@
pckt->len = packet_len;
handle_request (cctxt, pckt, &err);
- if (err && err->err_code != LDTP_ERROR_SUCCESS) {
- /*
- FIXME:
- ldtp_log ("Protocol error: closing connection [%s:%d]\n",
- client->ip_address, client->socketfd);
- */
- /*
- We should not close the connection for all errors
- */
- //goto error;
- }
if (err && err->err_code == LDTP_ERROR_STOP_SCRIPT_ENGINE) {
goto error;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-appmap.c new/ldtp-0.5.0cvs20060921/src/ldtp-appmap.c
--- old/ldtp-0.5.0cvs20060907/src/ldtp-appmap.c 2006-08-11 17:22:11.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-appmap.c 2006-09-20 17:41:15.000000000 +0200
@@ -255,17 +255,22 @@
if type and key matches then return true
*/
obj = (OBJInfo *) user_data;
+ g_print ("regexp- key: %d - %d - %d - %s\n",
+ obj->obj_is_window,
+ g_pattern_match_simple ("frm*", obj->key),
+ g_pattern_match_simple ("dlg*", obj->key),
+ obj->key);
if (obj->pattern && (!obj->obj_is_window ||
- g_pattern_match_simple ("frm", obj->key) ||
- g_pattern_match_simple ("dlg", obj->key)))
+ g_pattern_match_simple ("frm*", obj->key) ||
+ g_pattern_match_simple ("dlg*", obj->key)))
return g_pattern_match_string (obj->pattern, key);
- tmp = g_strdup_printf ("frm%s", obj->key);
+ tmp = g_strdup_printf ("frm%s*", obj->key);
if (tmp && g_pattern_match_simple (tmp, key)) {
g_free (tmp);
return TRUE;
}
g_free (tmp);
- tmp = g_strdup_printf ("dlg%s", obj->key);
+ tmp = g_strdup_printf ("dlg%s*", obj->key);
if (tmp && g_pattern_match_simple (tmp, key)) {
g_free (tmp);
return TRUE;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-command.c new/ldtp-0.5.0cvs20060921/src/ldtp-command.c
--- old/ldtp-0.5.0cvs20060907/src/ldtp-command.c 2006-08-18 20:35:59.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-command.c 2006-09-18 20:49:11.000000000 +0200
@@ -196,6 +196,7 @@
ldtp_command_new ( LDTP_CMD_STARTRECORD, "startrecord"),
ldtp_command_new ( LDTP_CMD_STOPRECORD, "stoprecord"),
ldtp_command_new ( LDTP_CMD_HASSTATE, "hasstate"),
+ ldtp_command_new ( LDTP_CMD_LAUNCHAPP, "launchapp"),
NULL
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-command.h new/ldtp-0.5.0cvs20060921/src/ldtp-command.h
--- old/ldtp-0.5.0cvs20060907/src/ldtp-command.h 2006-08-18 20:35:59.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-command.h 2006-09-18 20:49:11.000000000 +0200
@@ -170,7 +170,8 @@
LDTP_CMD_STOP_SCRIPT_ENGINE,
LDTP_CMD_STARTRECORD,
LDTP_CMD_STOPRECORD,
- LDTP_CMD_HASSTATE
+ LDTP_CMD_HASSTATE,
+ LDTP_CMD_LAUNCHAPP
};
struct _LDTPCommand {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-error.c new/ldtp-0.5.0cvs20060921/src/ldtp-error.c
--- old/ldtp-0.5.0cvs20060907/src/ldtp-error.c 2006-08-18 20:38:08.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-error.c 2006-09-18 20:49:11.000000000 +0200
@@ -555,6 +555,9 @@
case LDTP_ERROR_STOP_RECORD_ENGINE:
msg = "Wrong command sequence, stop called before start";
break;
+ case LDTP_ERROR_UNABLE_TO_LAUNCH_APP:
+ msg = "Unable to launch application";
+ break;
default:
msg = "Error code not found";
break;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-error.h new/ldtp-0.5.0cvs20060921/src/ldtp-error.h
--- old/ldtp-0.5.0cvs20060907/src/ldtp-error.h 2006-08-18 20:38:08.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-error.h 2006-09-18 20:49:11.000000000 +0200
@@ -196,7 +196,8 @@
LDTP_ERROR_OFFSET_OUT_OF_BOUND,
LDTP_ERROR_TEXT_NOT_ACCESSIBLE,
LDTP_ERROR_STOP_SCRIPT_ENGINE,
- LDTP_ERROR_STOP_RECORD_ENGINE
+ LDTP_ERROR_STOP_RECORD_ENGINE,
+ LDTP_ERROR_UNABLE_TO_LAUNCH_APP
} LDTPErrorCode;
typedef struct _LDTPError LDTPError;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/ldtp-gui.c new/ldtp-0.5.0cvs20060921/src/ldtp-gui.c
--- old/ldtp-0.5.0cvs20060907/src/ldtp-gui.c 2006-08-24 21:58:40.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/ldtp-gui.c 2006-09-18 20:49:11.000000000 +0200
@@ -1208,14 +1208,14 @@
if (Accessible_getRole (child) == role)
return child;
else {
- Accessible *parent = NULL;
- parent = child;
+ Accessible *tmp_parent = NULL;
+ tmp_parent = child;
child = get_object_handle (child, role);
/*
Unref local parent
*/
- if (parent)
- Accessible_unref (parent);
+ if (tmp_parent)
+ Accessible_unref (tmp_parent);
if (child != NULL)
return child;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/table.c new/ldtp-0.5.0cvs20060921/src/table.c
--- old/ldtp-0.5.0cvs20060907/src/table.c 2006-07-27 15:19:47.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/table.c 2006-09-20 17:41:15.000000000 +0200
@@ -252,6 +252,50 @@
}
/*
+ Double click
+*/
+static LDTPError*
+double_click (Accessible *object, FILE *log_fp)
+{
+ long x, y, height, width;
+ SPIBoolean flag = FALSE;
+ LDTPError *error;
+ Accessible *cell;
+ AccessibleComponent *component;
+
+ if (Accessible_isComponent (object))
+ component = Accessible_getComponent (object);
+ else {
+ Accessible_unref (object);
+ error = ldtp_error_get_error (LDTP_ERROR_OBJ_NOT_COMPONENT_TYPE);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ AccessibleComponent_getExtents (component, &x, &y, &width, &height, SPI_COORD_TYPE_SCREEN);
+ /* NOTE: Some widgets doesnot sense the double click event if they are performed exactly on the
+ * border. In order to take care of those situtations also we make adjustments in the x and y value
+ * to fire the event at the center of the object.
+ */
+ x = x + width / 2;
+ y = y + height / 2;
+ flag = AccessibleComponent_grabFocus (component);
+ Accessible_unref (component);
+ if (!flag) {
+ error = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_GRAB_FOCUS);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ flag = SPI_generateMouseEvent (x, y, "b1d");
+ if (flag)
+ return ldtp_error_get_error (LDTP_ERROR_SUCCESS);
+ else {
+ error = ldtp_error_get_error (LDTP_ERROR_DOUBLE_CLICK_FAILED);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+}
+
+/*
Double click row
*/
static LDTPError*
@@ -1331,6 +1375,10 @@
error = select_row (cctxt->gui_handle->handle,
(char *)cctxt->req->arg_list->data, cctxt->log_fp);
break;
+ case LDTP_CMD_DOUBLECLICK:
+ error = double_click (cctxt->gui_handle->handle,
+ cctxt->log_fp);
+ break;
case LDTP_CMD_DOUBLECLICKROW:
error = double_click_row (cctxt->gui_handle->handle,
cctxt->req->arg_list->data, cctxt->log_fp);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ldtp-0.5.0cvs20060907/src/tree-table.c new/ldtp-0.5.0cvs20060921/src/tree-table.c
--- old/ldtp-0.5.0cvs20060907/src/tree-table.c 2006-08-24 21:58:40.000000000 +0200
+++ new/ldtp-0.5.0cvs20060921/src/tree-table.c 2006-09-20 17:41:15.000000000 +0200
@@ -381,6 +381,64 @@
return error;
}
+static Accessible*
+get_row (Accessible *object, char *row_text, FILE *log_fp)
+{
+ long i, j;
+ long n_rows, n_cols;
+ Accessible *cell;
+ AccessibleTable *table;
+ char msg[256];
+
+ table = Accessible_getTable (object);
+ n_rows = AccessibleTable_getNRows (table);
+ n_cols = AccessibleTable_getNColumns (table);
+ g_print ("Number of rows: %ld\tColumn: %ld\n", n_rows, n_cols);
+
+ for (i = 0; i < n_rows; i++) {
+ for (j = 0; j < n_cols; j++) {
+ long child_count;
+ cell = AccessibleTable_getAccessibleAt (table, i, j);
+ child_count = Accessible_getChildCount (cell);
+ g_print ("Child count: %ld\n", child_count);
+ if (child_count > 0) {
+ long k;
+ char *name;
+ Accessible *child;
+ for (k = 0; k < child_count; k++) {
+ child = Accessible_getChildAtIndex (cell, k);
+ name = Accessible_getName (child);
+ g_print ("Table cell name: %s\n", name);
+ if (g_utf8_collate (name, row_text) == 0) {
+ SPI_freeString (name);
+ Accessible_unref (cell);
+ Accessible_unref (table);
+ return child;
+ } // if
+ SPI_freeString (name);
+ Accessible_unref (child);
+ } // for
+ } else {
+ char *name;
+ name = Accessible_getName (cell);
+ g_print ("Table cell name: %s\n", name);
+ if (g_utf8_collate (name, row_text) == 0) {
+ SPI_freeString (name);
+ Accessible_unref (table);
+ return cell;
+ } // if
+ SPI_freeString (name);
+ }
+ Accessible_unref (cell);
+ } // for j
+ } // for i
+
+ Accessible_unref (table);
+ g_sprintf (msg, "Unable to find %s in table", row_text);
+ log_msg (LDTP_LOG_CAUSE, msg, log_fp);
+ return NULL;
+}
+
static LDTPError*
select_row (Accessible *object, GSList *l, FILE *log_fp)
{
@@ -392,7 +450,7 @@
AccessibleTable *table;
char *name = NULL;
char *row_text = l->data;
- long n_matches = -1, matches = 1;
+ long n_matches = 0;
l = l->next;
if (l && l->data)
@@ -401,7 +459,7 @@
table = Accessible_getTable (object);
n_rows = AccessibleTable_getNRows (table);
n_cols = AccessibleTable_getNColumns (table);
- g_print ("Number of rows: %ld\tColumn: %ld\n", n_rows, n_cols);
+ g_print ("Number of rows: %ld\tColumn: %ld\tMatch index: %ld\n", n_rows, n_cols, n_matches);
for (i = 0; i < n_rows; i++) {
for (j = 0; j < n_cols; j++) {
@@ -410,18 +468,19 @@
child_count = Accessible_getChildCount (cell);
if (child_count > 0) {
long k;
-
Accessible *child;
for (k = 0; k < child_count; k++) {
child = Accessible_getChildAtIndex (cell, k);
name = Accessible_getName (child);
+ if (name)
+ g_print ("Table cell Name: %s\n", name);
if (g_utf8_collate (name, row_text) == 0) {
- if (n_matches != -1 && n_matches != matches) {
- matches++;
+ if (n_matches != 0) {
+ n_matches--;
Accessible_unref (child);
+ SPI_freeString(name);
continue;
}
-
if (Accessible_isComponent (cell)) {
AccessibleComponent *accessible_component;
accessible_component = Accessible_getComponent (cell);
@@ -431,6 +490,7 @@
Accessible_unref (cell);
error = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_GRAB_FOCUS);
log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ SPI_freeString(name);
return error;
}
Accessible_unref (accessible_component);
@@ -448,6 +508,13 @@
else {
name = Accessible_getName (cell);
if (g_utf8_collate (name, row_text) == 0) {
+ if (n_matches != 0) {
+ n_matches--;
+ Accessible_unref (cell);
+ SPI_freeString(name);
+ continue;
+ }
+
if (Accessible_isComponent (cell)) {
AccessibleComponent *accessible_component;
accessible_component = Accessible_getComponent (cell);
@@ -618,6 +685,101 @@
return error;
}
+/*
+ Double click
+*/
+static LDTPError*
+double_click (Accessible *object, FILE *log_fp)
+{
+ long x, y, height, width;
+ SPIBoolean flag = FALSE;
+ LDTPError *error;
+ Accessible *cell;
+ AccessibleComponent *component;
+
+ if (Accessible_isComponent (object))
+ component = Accessible_getComponent (object);
+ else {
+ Accessible_unref (object);
+ error = ldtp_error_get_error (LDTP_ERROR_OBJ_NOT_COMPONENT_TYPE);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ AccessibleComponent_getExtents (component, &x, &y, &width, &height, SPI_COORD_TYPE_SCREEN);
+ /* NOTE: Some widgets doesnot sense the double click event if they are performed exactly on the
+ * border. In order to take care of those situtations also we make adjustments in the x and y value
+ * to fire the event at the center of the object.
+ */
+ x = x + width / 2;
+ y = y + height / 2;
+ flag = AccessibleComponent_grabFocus (component);
+ Accessible_unref (component);
+ if (!flag) {
+ error = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_GRAB_FOCUS);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ flag = SPI_generateMouseEvent (x, y, "b1d");
+ if (flag)
+ return ldtp_error_get_error (LDTP_ERROR_SUCCESS);
+ else {
+ error = ldtp_error_get_error (LDTP_ERROR_DOUBLE_CLICK_FAILED);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+}
+
+/*
+ Double click row
+*/
+static LDTPError*
+double_click_row (Accessible *object, char *row_text, FILE *log_fp)
+{
+ long x, y, height, width;
+ SPIBoolean flag = FALSE;
+ LDTPError *error;
+ Accessible *cell;
+ AccessibleComponent *component;
+
+ cell = get_row (object, row_text, log_fp);
+ if (cell) {
+ if (Accessible_isComponent (cell))
+ component = Accessible_getComponent (cell);
+ else {
+ Accessible_unref (cell);
+ error = ldtp_error_get_error (LDTP_ERROR_OBJ_NOT_COMPONENT_TYPE);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ AccessibleComponent_getExtents (component, &x, &y, &width, &height, SPI_COORD_TYPE_SCREEN);
+ /* NOTE: Some widgets doesnot sense the double click event if they are performed exactly on the
+ * border. In order to take care of those situtations also we make adjustments in the x and y value
+ * to fire the event at the center of the object.
+ */
+ x = x + width / 2;
+ y = y + height / 2;
+ flag = AccessibleComponent_grabFocus (component);
+ Accessible_unref (cell);
+ Accessible_unref (component);
+ if (!flag) {
+ error = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_GRAB_FOCUS);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ flag = SPI_generateMouseEvent (x, y, "b1d");
+ if (flag)
+ return ldtp_error_get_error (LDTP_ERROR_SUCCESS);
+ else {
+ error = ldtp_error_get_error (LDTP_ERROR_DOUBLE_CLICK_FAILED);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+ }
+ }
+ error = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_GET_CELL_HANDLE_FAILED);
+ log_msg (LDTP_LOG_CAUSE, error->message, log_fp);
+ return error;
+}
+
static LDTPError*
select_row_index (Accessible *object, long row, FILE *log_fp)
{
@@ -1326,6 +1488,14 @@
error = select_row_partial_match (cctxt->gui_handle->handle,
cctxt->req->arg_list->data, cctxt->log_fp);
break;
+ case LDTP_CMD_DOUBLECLICKROW:
+ error = double_click_row (cctxt->gui_handle->handle,
+ cctxt->req->arg_list->data, cctxt->log_fp);
+ break;
+ case LDTP_CMD_DOUBLECLICK:
+ error = double_click (cctxt->gui_handle->handle,
+ cctxt->log_fp);
+ break;
case LDTP_CMD_GETTREETABLEROWINDEX:
error = get_row_index (cctxt->gui_handle->handle, &cctxt->req->arg_list, cctxt->log_fp);
if (error->err_code == LDTP_ERROR_SUCCESS) {
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org