def selectColorHSV(self, hsvValues): if not self._isDialog(): raise NotImplementedError procedurelogger.action('Select the color with HSV value of: (%s, %s, %s).' % (hsvValues[0], hsvValues[1], hsvValues[2])) self.hue.value = hsvValues[0] self.saturation.value = hsvValues[1] self.val.value = hsvValues[2] procedurelogger.expectedResult('The color with HSV value of (%s, %s, %s) is selected.' % (hsvValues[0], hsvValues[1], hsvValues[2]))
def selectColorRGB(self, rgbValues): if not self._isDialog(): raise NotImplementedError procedurelogger.action('Select the color with RGB value of: (%s, %s, %s).' % (rgbValues[0], rgbValues[1], rgbValues[2])) self.red.value = rgbValues[0] self.green.value = rgbValues[1] self.blue.value = rgbValues[2] procedurelogger.expectedResult('The color with RGB value of (%s, %s, %s) is selected.' % (rgbValues[0], rgbValues[1], rgbValues[2]))
def assertSelected(self, log=True): 'Raise an exception if this tab is not selected' if log: procedurelogger.expectedResult('The %s is selected.' % self) def selected(): return self.selected assert utils.retryUntilTrue(selected)
def assertSelected(self, log=True): 'Raise an exception if this tab is not selected' if log: procedurelogger.expectedResult('%s is selected.' % self) def selected(): return self.selected assert utils.retryUntilTrue(selected)
def assertClosed(self): 'Raise an exception if the application is still open' procedurelogger.expectedResult('The application closes.') if self.subproc is not None: def closed(): return self.subproc.poll() == 0 assert utils.retryUntilTrue(closed)
def findDialog(self, name, logName=None, retry=True, raiseException=True, setReference=True, log=True): 'Search for a dialog' func = self.__getattr__('findDialog') dialog = func(name, logName=logName, retry=retry, recursive=False, raiseException=raiseException, setReference=setReference) if log: # we need to log after the find() because the dialog might be promoted and have a different logName procedurelogger.expectedResult('The %s appears.' % dialog) return dialog
def assertClosed(self): 'Raise an exception if the alert is still open' procedurelogger.expectedResult('The %s disappears.' % self) def closed(): try: return not self.showing except (LookupError, KeyError, pyatspi.ORBit.CORBA.COMM_FAILURE): return True assert utils.retryUntilTrue(closed)
def findAlert(self, text, logText=None, retry=True, raiseException=True): ''' Search for an alert Alerts typically have no name, so we have to search for them by their content. We look for alerts that are showing and have within them a label that contains the given text. ''' if logText is None: logText = text if raiseException: procedurelogger.expectedResult('An alert appears: %s' % logText) def alertHasLabelContainingText(alert): return alert.role == pyatspi.ROLE_ALERT and alert.showing and \ alert.findLabel(text, retry=False, recursive=True, raiseException=False) is not None return utils.findDescendant(self, alertHasLabelContainingText, retry=retry, recursive=False, raiseException=raiseException)
def selectFont(self, family, style, size): procedurelogger.action("Select font '%s' with style '%s' on size '%s'." % (family, style, size)) self.families.select(family, log=False) self.styles.select(style, log=False) self.sizes.select(size, log=False) procedurelogger.expectedResult("The font '%s' with style '%s' on size '%s' is selected." % (family, style, size))