Hello community, here is the log from the commit of package ldtp for openSUSE:Factory checked in at Thu Apr 1 18:11:15 CEST 2010. -------- --- ldtp/ldtp.changes 2010-02-12 01:43:21.000000000 +0100 +++ /mounts/work_src_done/STABLE/ldtp/ldtp.changes 2010-03-30 20:23:44.000000000 +0200 @@ -1,0 +2,21 @@ +Tue Mar 30 20:22:46 CEST 2010 - vuntz@opensuse.org + +- Update to version 2.0.5: + + bgo#614249 - Connection refused when importing ldtp module + +------------------------------------------------------------------- +Sat Mar 27 12:10:41 CET 2010 - vuntz@opensuse.org + +- Update to version 2.0.4: + + Fix LDTPv2 hang + + Don't navigate table cell, as it causes more resource and time + in OpenOffice calc + + Added new API simulatemousemove for DnD test (VMware + Workstation / Player Unity-GHI feature) + + Fix bgo#612311 + + Listen all Window events, else new application like Firefox is + not listed + + waittillguiexist now can wait for state as well + + hasstate can wait for given time till the state is True + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- ldtp-2.0.3.tar.bz2 New: ---- ldtp-2.0.5.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ldtp.spec ++++++ --- /var/tmp/diff_new_pack.zt7N0l/_old 2010-04-01 18:06:08.000000000 +0200 +++ /var/tmp/diff_new_pack.zt7N0l/_new 2010-04-01 18:06:08.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package ldtp (Version 2.0.3) +# spec file for package ldtp (Version 2.0.5) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -19,7 +19,7 @@ Name: ldtp -Version: 2.0.3 +Version: 2.0.5 Release: 1 License: GPLv2+ ; LGPLv2.1+ Summary: Linux Desktop Testing Project (LDTP) ++++++ ldtp-2.0.3.tar.bz2 -> ldtp-2.0.5.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/PKG-INFO new/ldtp-2.0.5/PKG-INFO --- old/ldtp-2.0.3/PKG-INFO 2010-02-11 07:55:00.000000000 +0100 +++ new/ldtp-2.0.5/PKG-INFO 2010-03-30 08:57:57.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: ldtp -Version: 2.0.3 +Version: 2.0.5 Summary: Linux Desktop Testing Project Version 2 Home-page: http://ldtp.freesktop.org Author: Nagappan Alagappan diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtp/client.py new/ldtp-2.0.5/ldtp/client.py --- old/ldtp-2.0.3/ldtp/client.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtp/client.py 2010-03-30 08:54:20.000000000 +0200 @@ -20,6 +20,8 @@ import os import sys import time +import signal +import traceback import xmlrpclib import subprocess from socket import error as SocketError @@ -44,9 +46,8 @@ class Transport(xmlrpclib.Transport): def _spawn_daemon(self): - self._daemon = subprocess.Popen( - ['python', '-c', 'import ldtpd; ldtpd.main()'], - close_fds = True) + self._daemon = os.spawnlp(os.P_NOWAIT, 'python', + 'python', '-c', 'import ldtpd; ldtpd.main()') def request(self, host, handler, request_body, verbose=0): try: @@ -71,7 +72,8 @@ def kill_daemon(self): try: - self._daemon.kill() + # SIGKILL 9 Term Kill signal + os.kill(self._daemon, 9) except AttributeError: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/combo_box.py new/ldtp-2.0.5/ldtpd/combo_box.py --- old/ldtp-2.0.3/ldtpd/combo_box.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/combo_box.py 2010-03-30 08:54:20.000000000 +0200 @@ -327,7 +327,7 @@ if self._glob_match(item_name, text): selectioni = child_obj.querySelection() - print selectioni.selectChild(index) + selectioni.selectChild(index) try: try: # In Firefox Preferences: Action to select @@ -397,6 +397,10 @@ index += 1 raise LdtpServerException('Unable to select item index') + # Since selectindex and comboselectindex implementation are same, + # for backward compatibility let us assign selectindex to comboselectindex + comboselectindex = selectindex + def getallitem(self, window_name, object_name): ''' Select combo box item diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/core.py new/ldtp-2.0.5/ldtpd/core.py --- old/ldtp-2.0.3/ldtpd/core.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/core.py 2010-03-30 08:54:20.000000000 +0200 @@ -52,9 +52,6 @@ ''' def __init__(self): Utils.__init__(self) - self._states = {} - self._state_names = {} - self._get_all_state_names() # Window up time and onwindowcreate events self._events = ["window:create", "window:destroy"] # User registered events @@ -68,7 +65,10 @@ def _registered_event_cb(self, event): if event and event.source and event.type: - abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + try: + abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + except: + return window_name = u'%s%s' % (abbrev_role, abbrev_name) self._callback_event.append(u"%s-%s" % (event.type, window_name)) @@ -78,12 +78,18 @@ if event and event.source and window and \ self._match_name_to_acc(window, event.source): self._callback_event.append(u"onwindowcreate-%s" % window) - abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + try: + abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + except: + return win_name = u'%s%s' % (abbrev_role, abbrev_name) self._window_uptime[win_name] = [event.source_name, time.strftime("%Y %m %d %H %M %S")] elif event and event.type == "window:destroy": - abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + try: + abbrev_role, abbrev_name = self._ldtpize_accessible(event.source) + except: + return win_name = u'%s%s' % (abbrev_role, abbrev_name) if win_name in self._window_uptime: self._window_uptime[win_name].append( \ @@ -112,7 +118,10 @@ window_list = [] window_type = {} for gui in self._list_guis(): - window_name = self._ldtpize_accessible(gui) + try: + window_name = self._ldtpize_accessible(gui) + except: + continue if window_name[1] == '': if window_name[0] in window_type: window_type[window_name[0]] += 1 @@ -132,18 +141,6 @@ def isalive(self): return True - def _get_all_state_names(self): - """ - This is used by client internally to populate all states - Create a dictionary - """ - for state in pyatspi.STATE_VALUE_TO_NAME.keys(): - self._states[state.__repr__()] = state - # Ignore STATE_ string for LDTPv1 compatibility - self._state_names[state] = \ - state.__repr__().lower().partition("state_")[2] - return self._states - def launchapp(self, cmd, args=[], delay = 5, env = 1): ''' Launch application. @@ -421,7 +418,7 @@ return int(waiter.run()) - def waittillguiexist(self, window_name, object_name='', guiTimeOut=30): + def waittillguiexist(self, window_name, object_name='', guiTimeOut=30, state = ''): ''' Wait till a window or component exists. @@ -433,12 +430,14 @@ @type object_name: string @param guiTimeOut: Wait timeout in seconds @type guiTimeOut: integer + @param state: Object state used only when object_name is provided. + @type object_name: string @return: 1 if GUI was found, 0 if not. @rtype: integer ''' if object_name: - waiter = ObjectExistsWaiter(window_name, object_name, guiTimeOut) + waiter = ObjectExistsWaiter(window_name, object_name, guiTimeOut, state) else: waiter = GuiExistsWaiter(window_name, guiTimeOut) @@ -515,7 +514,7 @@ _state.unref() return _obj_states - def hasstate(self, window_name, object_name, state): + def hasstate(self, window_name, object_name, state, guiTimeOut = 0): ''' has state @@ -525,22 +524,18 @@ @param object_name: Object name to look for, either full name, LDTP's name convention, or a Unix glob. @type object_name: string + @param state: Object state. + @type object_name: string + @param guiTimeOut: Wait timeout in seconds + @type guiTimeOut: integer @return: 1 on success. @rtype: integer ''' try: - if re.search(';', object_name): - obj = self._get_menu_hierarchy(window_name, object_name) - else: - obj = self._get_object(window_name, object_name) - - _state_inst = obj.getState() - _obj_state = _state_inst.getStates() - state = 'STATE_%s' % state.upper() - if state in self._states and \ - self._states[state] in _obj_state: - return 1 + waiter = \ + ObjectExistsWaiter(window_name, object_name, guiTimeOut, state) + return int(waiter.run()) except: pass return 0 @@ -801,30 +796,42 @@ elif prop == 'label': obj = self._get_object(window_name, object_name) # A sanity check. return obj.name + elif prop == 'label_by': + obj = self._get_object(window_name, object_name) + rel_set = obj.getRelationSet() + if rel_set: + for i, rel in enumerate(rel_set): + relationType = rel.getRelationType() + if relationType == pyatspi.RELATION_LABELLED_BY or \ + relationType == pyatspi.RELATION_CONTROLLED_BY: + label_acc = rel.getTarget(i) + return label_acc.name + return obj.name elif prop == 'obj_index': role_count = {} - for gui in self._list_guis(): - if self._match_name_to_acc(window_name, gui): - for name, obj, obj_index in self._appmap_pairs(gui): - role = obj.getRole() - role_count[role] = role_count.get(role, 0) + 1 - if name == object_name: - return obj_index + gui = self._get_window_handle(window_name) + for name, obj, obj_index in self._appmap_pairs(gui): + role = obj.getRole() + role_count[role] = role_count.get(role, 0) + 1 + if name == object_name: + return obj_index raise LdtpServerException( 'Unable to find object name in application map') elif prop == 'parent': cached_list = [] - for gui in self._list_guis(): - if self._match_name_to_acc(window_name, gui): - for name, obj, obj_index in self._appmap_pairs(gui): - if name == object_name: - for pname, pobj in cached_list: - if obj in pobj: # avoid double link issues - return pname - _parent = self._ldtpize_accessible(obj.parent) - return '%s%s' % (_parent[0], _parent[1]) - cached_list.insert(0, (name, obj)) + gui = self._get_window_handle(window_name) + for name, obj, obj_index in self._appmap_pairs(gui): + if name == object_name: + for pname, pobj in cached_list: + if obj in pobj: # avoid double link issues + return pname + try: + _parent = self._ldtpize_accessible(obj.parent) + except: + continue + return u'%s%s' % (_parent[0], _parent[1]) + cached_list.insert(0, (name, obj)) raise LdtpServerException( 'Unable to find object name in application map') @@ -832,15 +839,21 @@ obj = self._get_object(window_name, object_name) return obj.getRoleName().replace(' ', '_') elif prop == 'children': - children = [] + children = '' obj = self._get_object(window_name, object_name) - for gui in self._list_guis(): - if self._match_name_to_acc(window_name, gui): - for name, child, obj_index in self._appmap_pairs(gui): - if child in obj: - children.append(name) - break - return ' '.join(children) + for i in range(obj.childCount): + child_obj = obj.getChildAtIndex(i) + try: + child_name = self._ldtpize_accessible(child_obj) + except: + continue + child_obj.unref() + child_name = u'%s%s' % (child_name[0], child_name[1]) + if children: + children += u' %s' % child_name + else: + children = child_name + return children raise LdtpServerException('Unknown property "%s" in %s' % \ (prop, object_name)) @@ -862,27 +875,29 @@ @rtype: list ''' matches = [] - for gui in self._list_guis(): - if self._match_name_to_acc(window_name, gui): - for name, obj, obj_index in self._appmap_pairs(gui): - if child_name and role: - if obj.getRoleName() == role and \ - (child_name == name or \ - self._match_name_to_acc(child_name, obj)): - matches.append(name) - elif role: - if obj.getRoleName() == role: - matches.append(name) - elif child_name: - if child_name == name or \ - self._match_name_to_acc(child_name, obj): - matches.append(name) - - #print matches, first - if matches and first: - # Return once we have a match - return matches - + gui = self._get_window_handle(window_name) + if gui: + if role: + role = re.sub('_', ' ', role) + for name, obj, obj_index in self._appmap_pairs(gui): + if child_name and role: + if obj.getRoleName() == role and \ + (child_name == name or \ + self._match_name_to_acc(child_name, obj)): + matches.append(name) + elif role: + if obj.getRoleName() == role: + matches.append(name) + elif child_name: + if child_name == name or \ + self._match_name_to_acc(child_name, obj): + matches.append(name) + + #print matches, first + if matches and first: + # Return once we have a match + return matches + if not matches: raise LdtpServerException('Could not find a child.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/mouse.py new/ldtp-2.0.5/ldtpd/mouse.py --- old/ldtp-2.0.3/ldtpd/mouse.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/mouse.py 2010-03-30 08:54:20.000000000 +0200 @@ -19,6 +19,7 @@ Headers in this file shall remain intact. ''' +import time import pyatspi from utils import Utils from server_exception import LdtpServerException @@ -134,3 +135,65 @@ return self._mouse_event(_coordinates.x + _coordinates.width / 2, _coordinates.y + _coordinates.height / 2, 'b1d') + + def simulatemousemove(self, source_x, source_y, dest_x, dest_y, delay = 0.0): + """ + @param source_x: Source X + @type source_x: integer + @param source_y: Source Y + @type source_y: integer + @param dest_x: Dest X + @type dest_x: integer + @param dest_y: Dest Y + @type dest_y: integer + @param delay: Sleep time between the mouse move + @type delay: double + + @return: 1 if simulation was successful, 0 if not. + @rtype: integer + """ + size = self._get_size(self._desktop) + if (source_x < size.x or source_y < size.y or \ + dest_x > size.width or dest_y > size.height) and \ + (source_x > size.width or source_y > size.height or \ + dest_x < size.x or dest_y < size.y): + return 0 + + x_flag = False # Iterated x ? + y_flag = False # Iterated y ? + while True: + if not x_flag: + if source_x > dest_x: + # If source X greather than dest X + # then move -1 pixel + source_x -= 1 + elif source_x < dest_x: + # If source X less than dest X + # then move +1 pixel + source_x += 1 + else: + # If source X equal to dest X + # then don't process X co-ordinate + x_flag = True + if not y_flag: + if source_y > dest_y: + # If source Y greather than dest Y + # then move -1 pixel + source_y -= 1 + elif source_y < dest_y: + # If source Y less than dest Y + # then move +1 pixel + source_y += 1 + else: + # If source Y equal to dest Y + # then don't process Y co-ordinate + y_flag = True + if delay: + time.sleep(delay) + # Start mouse move from source_x, source_y to dest_x, dest_y + self.generatemouseevent(source_x, source_y, 'abs') + if source_x == dest_x and source_y == dest_y: + # If we have reached the dest_x and dest_y + # then break the loop + break + return 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/page_tab_list.py new/ldtp-2.0.5/ldtpd/page_tab_list.py --- old/ldtp-2.0.3/ldtpd/page_tab_list.py 2009-08-26 05:34:08.000000000 +0200 +++ new/ldtp-2.0.5/ldtpd/page_tab_list.py 2010-02-24 05:23:29.000000000 +0100 @@ -20,6 +20,7 @@ ''' import pyatspi from utils import Utils +from server_exception import LdtpServerException class PageTabList(Utils): def selecttab(self, window_name, object_name, tab_name): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/table.py new/ldtp-2.0.5/ldtpd/table.py --- old/ldtp-2.0.3/ldtpd/table.py 2009-10-12 16:47:06.000000000 +0200 +++ new/ldtp-2.0.5/ldtpd/table.py 2010-03-17 06:57:23.000000000 +0100 @@ -76,12 +76,23 @@ if not cell: continue if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - if self._match_name_to_acc(row_text, child): - self._grab_focus(child) - cell.unref() - return 1 + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + if self._match_name_to_acc(row_text, child): + self._grab_focus(child) + cell.unref() + return 1 + finally: + if not flag: + self._handle_table_cell = False elif self._match_name_to_acc(row_text, cell): self._grab_focus(cell) cell.unref() @@ -118,12 +129,23 @@ if not cell: continue if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - if re.search(row_text, child.name): - self._grab_focus(child) - cell.unref() - return 1 + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + if re.search(row_text, child.name): + self._grab_focus(child) + cell.unref() + return 1 + finally: + if not flag: + self._handle_table_cell = False elif self._match_name_to_acc(row_text, cell): self._grab_focus(cell) cell.unref() @@ -211,15 +233,26 @@ cell = self._get_accessible_at_row_column(obj, row_index, column) name = None if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - try: - texti = child.queryText() - except NotImplementedError: - continue - name = child.name - self._grab_focus(cell) - break + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + try: + texti = child.queryText() + except NotImplementedError: + continue + name = child.name + self._grab_focus(cell) + break + finally: + if not flag: + self._handle_table_cell = False else: name = cell.name self._grab_focus(cell) @@ -251,17 +284,28 @@ cell = self._get_accessible_at_row_column(obj, row_index, column) flag = None if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - try: - actioni = child.queryAction() + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value flag = True - if not self._check_state(child, pyatspi.STATE_CHECKED): - self._click_object(child, 'toggle') - except NotImplementedError: - continue - self._grab_focus(cell) - break + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + try: + actioni = child.queryAction() + flag = True + if not self._check_state(child, pyatspi.STATE_CHECKED): + self._click_object(child, 'toggle') + except NotImplementedError: + continue + self._grab_focus(cell) + break + finally: + if not flag: + self._handle_table_cell = False else: try: actioni = cell.queryAction() @@ -299,16 +343,27 @@ cell = self._get_accessible_at_row_column(obj, row_index, column) flag = None if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - try: - actioni = child.queryAction() + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value flag = True - self._click_object(child, 'expand or contract') - self._grab_focus(cell) - break - except NotImplementedError: - continue + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + try: + actioni = child.queryAction() + flag = True + self._click_object(child, 'expand or contract') + self._grab_focus(cell) + break + except NotImplementedError: + continue + finally: + if not flag: + self._handle_table_cell = False else: try: actioni = cell.queryAction() @@ -345,17 +400,28 @@ cell = self._get_accessible_at_row_column(obj, row_index, column) flag = None if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - try: - actioni = child.queryAction() + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value flag = True - if self._check_state(child, pyatspi.STATE_CHECKED): - self._click_object(child, 'toggle') - except NotImplementedError: - continue - self._grab_focus(cell) - break + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + try: + actioni = child.queryAction() + flag = True + if self._check_state(child, pyatspi.STATE_CHECKED): + self._click_object(child, 'toggle') + except NotImplementedError: + continue + self._grab_focus(cell) + break + finally: + if not flag: + self._handle_table_cell = False else: try: actioni = cell.queryAction() @@ -399,12 +465,23 @@ if not cell: continue if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - if self._match_name_to_acc(row_text, child): - self._grab_focus(child) - cell.unref() - return i + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + if self._match_name_to_acc(row_text, child): + self._grab_focus(child) + cell.unref() + return i + finally: + if not flag: + self._handle_table_cell = False elif self._match_name_to_acc(row_text, cell): self._grab_focus(cell) cell.unref() @@ -464,16 +541,27 @@ if not cell: continue if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - if self._match_name_to_acc(row_text, child): - self._grab_focus(child) - size = self._get_size(cell) - self._mouse_event(size.x + size.width / 2, - size.y + size.height / 2, - 'b1c') - cell.unref() - return i + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + if self._match_name_to_acc(row_text, child): + self._grab_focus(child) + size = self._get_size(cell) + self._mouse_event(size.x + size.width / 2, + size.y + size.height / 2, + 'b1c') + cell.unref() + return i + finally: + if not flag: + self._handle_table_cell = False elif self._match_name_to_acc(row_text, cell): self._grab_focus(cell) size = self._get_size(cell) @@ -514,16 +602,27 @@ if not cell: continue if cell.childCount > 0: - children = self._list_objects(cell) - for child in children: - if self._match_name_to_acc(row_text, child): - self._grab_focus(child) - size = self._get_size(cell) - self._mouse_event(size.x + size.width / 2, - size.y + size.height / 2, - 'b1d') - cell.unref() - return i + flag = False + try: + if self._handle_table_cell: + # Was externally set, let us not + # touch this value + flag = True + else: + self._handle_table_cell = True + children = self._list_objects(cell) + for child in children: + if self._match_name_to_acc(row_text, child): + self._grab_focus(child) + size = self._get_size(cell) + self._mouse_event(size.x + size.width / 2, + size.y + size.height / 2, + 'b1d') + cell.unref() + return i + finally: + if not flag: + self._handle_table_cell = False elif self._match_name_to_acc(row_text, cell): self._grab_focus(cell) size = self._get_size(cell) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/text.py new/ldtp-2.0.5/ldtpd/text.py --- old/ldtp-2.0.3/ldtpd/text.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/text.py 2010-03-30 08:54:20.000000000 +0200 @@ -281,7 +281,6 @@ except NotImplementedError: raise LdtpServerException('Text cannot be entered into object.') - print dir(texti) texti.setTextContents('%s%s' % (texti.getText(0, texti.characterCount), data.encode('utf-8'))) return 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/utils.py new/ldtp-2.0.5/ldtpd/utils.py --- old/ldtp-2.0.3/ldtpd/utils.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/utils.py 2010-03-30 08:54:20.000000000 +0200 @@ -30,19 +30,35 @@ cached_apps = None def __init__(self): lazy_load = True + self._states = {} + self._state_names = {} self._callback = {} self._window_uptime = {} self._callback_event = [] + self._get_all_state_names() + self._handle_table_cell = False self._desktop = pyatspi.Registry.getDesktop(0) if Utils.cached_apps is None: pyatspi.Registry.registerEventListener( - self._on_window_event, 'window:create') + self._on_window_event, 'window') Utils.cached_apps = list() if lazy_load: for app in self._desktop: if app is None: continue self.cached_apps.append(app) + def _get_all_state_names(self): + """ + This is used by client internally to populate all states + Create a dictionary + """ + for state in pyatspi.STATE_VALUE_TO_NAME.keys(): + self._states[state.__repr__()] = state + # Ignore STATE_ string for LDTPv1 compatibility + self._state_names[state] = \ + state.__repr__().lower().partition("state_")[2] + return self._states + def _on_window_event(self, event): if event.host_application not in self.cached_apps: self.cached_apps.append(event.host_application) @@ -72,24 +88,6 @@ relationType == pyatspi.RELATION_CONTROLLED_BY: label_acc = rel.getTarget(i) break - return abbreviated_roles.get(acc.getRole(), 'ukn'), \ - (label_acc or acc).name.replace(' ', '').rstrip(':.') - - def _glob_match(self, pattern, string): - return bool(re_match(glob_trans(pattern), string, re.M | re.U | re.L)) - - def _match_name_to_acc(self, name, acc): - if acc.name == name: - return 1 - _ldtpize_accessible_name = self._ldtpize_accessible(acc) - _object_name = u'%s%s' % (_ldtpize_accessible_name[0], - _ldtpize_accessible_name[1]) - if _object_name == name: - return 1 - if self._glob_match(name, acc.name): - return 1 - if self._glob_match(name, _object_name): - return 1 role = acc.getRole() if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ role == pyatspi.ROLE_WINDOW or \ @@ -100,11 +98,42 @@ strip = '( |\n)' else: strip = '( |:|\.|_|\n)' - _tmp_name = re.sub(strip, '', name) - if self._glob_match(_tmp_name, _object_name): - return 1 - if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): - return 1 + return abbreviated_roles.get(role, 'ukn'), \ + re.sub(strip, '', (label_acc or acc).name) + + def _glob_match(self, pattern, string): + return bool(re_match(glob_trans(pattern), string, re.M | re.U | re.L)) + + def _match_name_to_acc(self, name, acc): + try: + if acc.name == name: + return 1 + _ldtpize_accessible_name = self._ldtpize_accessible(acc) + _object_name = u'%s%s' % (_ldtpize_accessible_name[0], + _ldtpize_accessible_name[1]) + if _object_name == name: + return 1 + if self._glob_match(name, acc.name): + return 1 + if self._glob_match(name, _object_name): + return 1 + role = acc.getRole() + if role == pyatspi.ROLE_FRAME or role == pyatspi.ROLE_DIALOG or \ + role == pyatspi.ROLE_WINDOW or \ + role == pyatspi.ROLE_FONT_CHOOSER or \ + role == pyatspi.ROLE_FILE_CHOOSER or \ + role == pyatspi.ROLE_ALERT or \ + role == pyatspi.ROLE_COLOR_CHOOSER: + strip = '( |\n)' + else: + strip = '( |:|\.|_|\n)' + _tmp_name = re.sub(strip, '', name) + if self._glob_match(_tmp_name, _object_name): + return 1 + if self._glob_match(_tmp_name, _ldtpize_accessible_name[1]): + return 1 + except: + pass return 0 def _match_name_to_appmap(self, name, appmap_name): @@ -121,6 +150,11 @@ if obj: yield obj for child in obj: + if child and child.getRole() == pyatspi.ROLE_TABLE_CELL and \ + not self._handle_table_cell: + # In OO.o navigating table cells consumes more time + # and resource + break for c in self._list_objects(child): yield c @@ -129,34 +163,42 @@ This function will check for all levels and returns the first matching LIST / MENU type """ - if obj: - for child in obj: - if not child: - continue - if child.childCount > 0: - child_obj = self._get_combo_child_object_type(child) - if child_obj: - return child_obj - if child.getRole() == pyatspi.ROLE_LIST: - return child - elif child.getRole() == pyatspi.ROLE_MENU: - return child + try: + if obj: + for child in obj: + if not child: + continue + if child.childCount > 0: + child_obj = self._get_combo_child_object_type(child) + if child_obj: + return child_obj + if child.getRole() == pyatspi.ROLE_LIST: + return child + elif child.getRole() == pyatspi.ROLE_MENU: + return child + except: + pass + return None def _get_child_object_type(self, obj, role_type): """ This function will check for all levels and returns the first matching role_type """ - if obj and role_type: - for child in obj: - if not child: - continue - if child.childCount > 0: - child_obj = self._get_child_object_type(child, role_type) + try: + if obj and role_type: + for child in obj: + if not child: + continue + if child.childCount > 0: + child_obj = self._get_child_object_type(child, role_type) if child_obj: return child_obj - if child.getRole() == role_type: - return child + if child.getRole() == role_type: + return child + except: + pass + return None def _appmap_pairs(self, gui): ldtpized_list = [] @@ -253,7 +295,7 @@ return gui return None - def _get_object(self, window_name, obj_name): + def _get_object_info(self, window_name, obj_name): _window_handle = self._get_window_handle(window_name) if not _window_handle: raise LdtpServerException('Unable to find window "%s"' % \ @@ -262,10 +304,14 @@ if self._glob_match(obj_name, obj_index) or \ self._match_name_to_acc(obj_name, obj) or \ self._match_name_to_appmap(obj_name, name): - return obj + return name, obj, obj_index raise LdtpServerException( 'Unable to find object name "%s" in application map' % obj_name) + def _get_object(self, window_name, obj_name): + name, obj, obj_index = self._get_object_info(window_name, obj_name) + return obj + def _grab_focus(self, obj): try: componenti = obj.queryComponent() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/value.py new/ldtp-2.0.5/ldtpd/value.py --- old/ldtp-2.0.3/ldtpd/value.py 2009-08-26 05:41:46.000000000 +0200 +++ new/ldtp-2.0.5/ldtpd/value.py 2010-03-16 05:09:38.000000000 +0100 @@ -497,12 +497,12 @@ raise LdtpServerException('Value cannot be entered into object.') i = 0 - max = valuei.maximumValue / 8; + maxValue = valuei.maximumValue / 8; flag = False while i < iterations: if valuei.currentValue >= valuei.maximumValue: raise LdtpServerException('Maximum limit reached') - valuei.currentValue += max + valuei.currentValue += maxValue time.sleep(1.0/100) flag = True i += 1 @@ -538,12 +538,12 @@ raise LdtpServerException('Value cannot be entered into object.') i = 0 - min = valuei.maximumValue / 8; + minValue = valuei.maximumValue / 8 flag = False while i < iterations: if valuei.currentValue < valuei.minimumValue: raise LdtpServerException('Minimum limit reached') - valuei.currentValue -= min + valuei.currentValue -= minValue time.sleep(1.0/100) flag = True i += 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/ldtpd/waiters.py new/ldtp-2.0.5/ldtpd/waiters.py --- old/ldtp-2.0.3/ldtpd/waiters.py 2010-02-11 07:53:45.000000000 +0100 +++ new/ldtp-2.0.5/ldtpd/waiters.py 2010-03-30 08:54:20.000000000 +0200 @@ -27,8 +27,6 @@ import pyatspi import traceback -_main_loop = gobject.MainLoop() - class Waiter(Utils): events = [] def __init__(self, timeout): @@ -46,12 +44,12 @@ if self.success or self.timeout == 0: return self.success - + gobject.timeout_add_seconds(1, self._timeout_cb) if self.events: pyatspi.Registry.registerEventListener( self._event_cb, *self.events) - _main_loop.run() + gtk.main() if self.events: pyatspi.Registry.deregisterEventListener( self._event_cb, *self.events) @@ -63,7 +61,7 @@ self._timeout_count += 1 self.poll() if self._timeout_count >= self.timeout or self.success: - _main_loop.quit() + gtk.main_quit() return False return True @@ -73,7 +71,7 @@ def _event_cb(self, event): self.event_cb(event) if self.success: - _main_loop.quit() + gtk.main_quit() def event_cb(self, event): pass @@ -100,11 +98,13 @@ for w in window_list: if self._frame_name: current_window = w.get_name() - if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + if re.search( + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then maximize just that window w.maximize() self.success = True @@ -128,10 +128,12 @@ if self._frame_name: current_window = w.get_name() if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then minimize just that window w.minimize() self.success = True @@ -155,10 +157,12 @@ if self._frame_name: current_window = w.get_name() if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then unmaximize just that window w.unmaximize() self.success = True @@ -182,10 +186,12 @@ if self._frame_name: current_window = w.get_name() if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then unminimize just that window w.unminimize(int(time.time())) self.success = True @@ -209,10 +215,12 @@ if self._frame_name: current_window = w.get_name() if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then activate just that window w.activate(int(time.time())) self.success = True @@ -234,10 +242,12 @@ if self._frame_name: current_window = w.get_name() if re.search( \ - fnmatch.translate(self._frame_name), current_window, re.I) \ + fnmatch.translate(self._frame_name), current_window, + re.U | re.M | re.L) \ or re.search(fnmatch.translate(re.sub("(^frm)|(^dlg)", "", self._frame_name)), - re.sub(" *(\t*)|(\n*)", "", current_window), re.I): + re.sub(" *(\t*)|(\n*)", "", current_window), + re.U | re.M | re.L): # If window name specified, then close just that window w.close(int(time.time())) self.success = True @@ -279,17 +289,26 @@ self.success = True class ObjectExistsWaiter(GuiExistsWaiter): - def __init__(self, frame_name, obj_name, timeout): + def __init__(self, frame_name, obj_name, timeout, state = ''): GuiExistsWaiter.__init__(self, frame_name, timeout) self._obj_name = obj_name + self._state = state def poll(self): try: if re.search(';', self._obj_name): - self._get_menu_hierarchy(self._frame_name, self._obj_name) + obj = self._get_menu_hierarchy(self._frame_name, self._obj_name) else: - self._get_object(self._frame_name, self._obj_name) - self.success = True + obj = self._get_object(self._frame_name, self._obj_name) + if self._state: + _state_inst = obj.getState() + _obj_state = _state_inst.getStates() + state = 'STATE_%s' % self._state.upper() + if state in self._states and \ + self._states[state] in _obj_state: + self.success = True + else: + self.success = True except: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/scripts/ldtp new/ldtp-2.0.5/scripts/ldtp --- old/ldtp-2.0.3/scripts/ldtp 2010-02-11 07:54:08.000000000 +0100 +++ new/ldtp-2.0.5/scripts/ldtp 2010-03-30 08:54:05.000000000 +0200 @@ -17,7 +17,7 @@ (options, args) = parser.parse_args() if options.version: # Print version info and exit - print 'ldtp-2.0.3' + print 'ldtp-2.0.5' sys.exit(0) parse_cmd_line_option() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ldtp-2.0.3/setup.py new/ldtp-2.0.5/setup.py --- old/ldtp-2.0.3/setup.py 2010-02-11 07:53:56.000000000 +0100 +++ new/ldtp-2.0.5/setup.py 2010-03-30 08:53:55.000000000 +0200 @@ -3,7 +3,7 @@ from distutils.core import setup setup(name='ldtp', - version='2.0.3', + version='2.0.5', description='Linux Desktop Testing Project Version 2', maintainer='Nagappan Alagappan', maintainer_email='nagappan@gmail.com', ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org