Esempio n. 1
0
    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]))
Esempio n. 2
0
    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]))
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
    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
Esempio n. 7
0
    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)
Esempio n. 8
0
    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)
Esempio n. 9
0
    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)
Esempio n. 10
0
    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)
Esempio n. 11
0
    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
Esempio n. 12
0
    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)
Esempio n. 13
0
 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))