Exemplo n.º 1
0
                    def assertMethod(name, checkShowing=True, retry=False, recursive=True, breadthFirst=False, raiseException=False):
                        def descendantFound():
                            dontCheckShowing = not checkShowing
                            return utils.findDescendant(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), \
                                retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) != None

                        assert utils.retryUntilTrue(descendantFound)
Exemplo n.º 2
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)
Exemplo n.º 3
0
                        def doActionMethod(log=False):
                            def sensitive():
                                return self.sensitive

                            if not utils.retryUntilTrue(sensitive):
                                raise errors.NotSensitiveError
                            if log:
                                procedurelogger.action('Perform "%s" action for %s.' % (iaction.getName(i), self))

                            iaction.doAction(i)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
0
    def assertTextAttribute(self, attr, value, charPos):
        'Assert attr:value string on text at position charPos (i.e. attr="fg-color", value="0,0,0")'

        itext = self._accessible.queryText()
        def checkAttribute():
            if attr in self.getTextAttributes(charPos):
                if self.getTextAttributes(charPos)[attr] == value:
                    return True
            return False
        assert utils.retryUntilTrue(checkAttribute)
Exemplo 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)
Exemplo 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)
Exemplo n.º 9
0
    def assertTextAttribute(self, attr, value, charPos):
        'Assert attr:value string on text at position charPos (i.e. attr="fg-color", value="0,0,0")'

        itext = self._accessible.queryText()

        def checkAttribute():
            if attr in self.getTextAttributes(charPos):
                if self.getTextAttributes(charPos)[attr] == value:
                    return True
            return False

        assert utils.retryUntilTrue(checkAttribute)
Exemplo n.º 10
0
                    def assertMethod(name,
                                     checkShowing=True,
                                     retry=False,
                                     recursive=True,
                                     breadthFirst=False,
                                     raiseException=False):
                        def descendantFound():
                            dontCheckShowing = not checkShowing
                            return utils.findDescendant(self, lambda x: x.role == v[a] and utils.equalsOrMatches(x.name, name) and (dontCheckShowing or x.showing), \
                                retry=retry, recursive=recursive, breadthFirst=breadthFirst, raiseException=raiseException) != None

                        assert utils.retryUntilTrue(descendantFound)
Exemplo n.º 11
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)
Exemplo n.º 12
0
    def _doAction(self, action):
        'Wrapper for doAction method in IAction interface'

        iaction = self._accessible.queryAction()

        for i in xrange(iaction.nActions):
            if iaction.getName(i) == action:
                def sensitive():
                    return self.sensitive

                if not utils.retryUntilTrue(sensitive):
                    raise errors.NotSensitiveError

                iaction.doAction(i)
Exemplo n.º 13
0
    def _doAction(self, action):
        'Wrapper for doAction method in IAction interface'

        iaction = self._accessible.queryAction()

        for i in xrange(iaction.nActions):
            if iaction.getName(i) == action:

                def sensitive():
                    return self.sensitive

                if not utils.retryUntilTrue(sensitive):
                    raise errors.NotSensitiveError

                iaction.doAction(i)
Exemplo n.º 14
0
    def waitForEvent(self, target=None, type=None, qty=None):
        '''
        Waits until the event occurs and returns True.  If the event does not
        occur within config.RETRY_TIMES * config.RETRY_INTERVAL seconds,
        returns False.

        @param target: the requested event target, or None
        @param type: the type of event to listen to, or None
        @param qty: how many events should be fired
        @return: returns True if the event occured, False otherwise
        @rtype: boolean
        '''
        return utils.retryUntilTrue(self.containsEvent, \
                                    args=(self._unwrapAccessible(target),
                                          type, qty))
Exemplo n.º 15
0
    def _doAction(self, action):
        '''
        Wrapper for doAction method in IAction interface

        All actions are now bound automagically; this method is deprecated and
        may be removed in the future.
        '''

        iaction = self._accessible.queryAction()

        for i in xrange(iaction.nActions):
            if iaction.getName(i) == action:
                def sensitive():
                    return self.sensitive

                if not utils.retryUntilTrue(sensitive):
                    raise errors.NotSensitiveError

                iaction.doAction(i)
Exemplo n.º 16
0
 def assertTableCellAt(self, row, col, text):
     assert utils.retryUntilTrue(
         lambda: self.getAccessibleAt(row, col).name == text)
Exemplo n.º 17
0
 def assertSelectedText(self, text, index=0):
     assert utils.retryUntilTrue(
         lambda: self.getSelectedText(index) == text)
Exemplo n.º 18
0
 def assertTableCellAt(self, row, col, text):
     assert utils.retryUntilTrue(lambda : self.getAccessibleAt(row, col).name == text)
Exemplo n.º 19
0
 def assertSelectedText(self, text, index=0):
     assert utils.retryUntilTrue(lambda: self.getSelectedText(index) == text)