예제 #1
0
 def test_check_coordinates_builtin(self):
     with self.assertRaises(ValueError):
         absoluteMotion(-5, 5)
     with self.assertRaises(ValueError):
         absoluteMotion(5, -5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(10, 10, -5, 5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(10, 10, 5, -5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(-5, 5, 10, 10)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(5, -5, 10, 10)
     with self.assertRaises(ValueError):
         click(-5, 5)
     with self.assertRaises(ValueError):
         click(5, -5)
     with self.assertRaises(ValueError):
         doubleClick(-5, 5)
     with self.assertRaises(ValueError):
         doubleClick(5, -5)
     with self.assertRaises(ValueError):
         press(-5, 5)
     with self.assertRaises(ValueError):
         press(5, -5)
     with self.assertRaises(ValueError):
         release(-5, 5)
     with self.assertRaises(ValueError):
         release(5, -5)
예제 #2
0
    def __init__(self,
                 appName,
                 shortcut='<Control><Q>',
                 a11yAppName=None,
                 forceKill=True,
                 parameters='',
                 recordVideo=False):
        """
        Initialize object App
        appName     command to run the app
        shortcut    default quit shortcut
        a11yAppName app's a11y name is different than binary
        forceKill   is the app supposed to be kill before/after test?
        parameters  has the app any params needed to start? (only for startViaCommand)
        recordVideo start gnome-shell recording while running the app
        """
        self.appCommand = appName
        self.shortcut = shortcut
        self.forceKill = forceKill
        self.parameters = parameters
        self.internCommand = self.appCommand.lower()
        self.a11yAppName = a11yAppName
        self.recordVideo = recordVideo
        self.pid = None

        # a way of overcoming overview autospawn when mouse in 1,1 from start
        pressKey('Esc')
        absoluteMotion(100, 100, 2)

        # attempt to make a recording of the test
        if self.recordVideo:
            keyCombo('<Control><Alt><Shift>R')
예제 #3
0
파일: robot.py 프로젝트: JDongian/neobot
def out_mouse_move(pos, mode):
    if mode == "abs":
        return rawinput.absoluteMotion(*pos)
    # Click in the game using game-relative coordinates.
    elif mode == "rel":
        if game_pos == 0:
            raise Exeption("Error: game_pos undefined.")
            return False
        # Bounds checking.
        if game_pos[0][0] <= pos[0] <= game_pos[1][0] and game_pos[0][1] <= pos[1] <= game_pos[1][1]:
            return rawinput.absoluteMotion(game_pos[0][0] + pos[0], game_pos[0][1] + pos[1])
        else:
            raise Exeption("Error: position out of bounds.")
            return False
    elif mode == "ratio":
        if game_pos == 0:
            raise Exeption("Error: game_pos undefined.")
            return False
        # Bounds checking.
        if 0 <= pos[0] <= 1 and 0 <= pos[1] <= 1:
            return rawinput.absoluteMotion(
                game_pos[0][0] + pos[0] * (game_pos[1][0] - game_pos[0][0]),
                game_pos[0][1] + pos[1] * (game_pos[1][1] - game_pos[0][1]),
            )
        else:
            raise Exeption("Error: position out of bounds.")
            return False
    raise Exeption("Error: incorrect mode.")
    return False
예제 #4
0
 def test_check_coordinates_builtin(self):
     with self.assertRaises(ValueError):
         absoluteMotion(-5, 5)
     with self.assertRaises(ValueError):
         absoluteMotion(5, -5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(10, 10, -5, 5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(10, 10, 5, -5)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(-5, 5, 10, 10)
     with self.assertRaises(ValueError):
         absoluteMotionWithTrajectory(5, -5, 10, 10)
     with self.assertRaises(ValueError):
         click(-5, 5)
     with self.assertRaises(ValueError):
         click(5, -5)
     with self.assertRaises(ValueError):
         doubleClick(-5, 5)
     with self.assertRaises(ValueError):
         doubleClick(5, -5)
     with self.assertRaises(ValueError):
         press(-5, 5)
     with self.assertRaises(ValueError):
         press(5, -5)
     with self.assertRaises(ValueError):
         release(-5, 5)
     with self.assertRaises(ValueError):
         release(5, -5)
    def __init__(self,
                 appName,
                 desktopFileName=None,
                 shortcut='<Control><Q>',
                 a11yAppName=None,
                 forceKill=True,
                 parameters='',
                 recordVideo=False):
        """
        Initialize object App
        appName     command to run the app
        shortcut    default quit shortcut
        a11yAppName app's a11y name is different than binary
        forceKill   is the app supposed to be kill before/after test?
        parameters  has the app any params needed to start? (only for startViaCommand)
        recordVideo start gnome-shell recording while running the app
        """
        self.appCommand = appName
        self.shortcut = shortcut
        self.forceKill = forceKill
        self.parameters = parameters
        self.internCommand = self.appCommand.lower()
        self.a11yAppName = a11yAppName
        self.recordVideo = recordVideo
        self.pid = None
        if desktopFileName is None:
            desktopFileName = self.appCommand
        self.desktopFileName = desktopFileName
        # a way of overcoming overview autospawn when mouse in 1,1 from start
        pressKey('Esc')
        absoluteMotion(100, 100, 2)

        # attempt to make a recording of the test
        if self.recordVideo:
            keyCombo('<Control><Alt><Shift>R')
예제 #6
0
 def testMoveMouseToDock(self):
     rawinput.absoluteMotion(int(utils.resolution.width / 2),
                             utils.resolution.height)
     main_window = self.ddedockobject.child(self.dock_mainwindow)
     (width, height) = main_window.size
     self.assertTrue(height > 1,
                     " the size is : %s" % str(main_window.size))
예제 #7
0
파일: rv6.py 프로젝트: spiceqa/tp-spice
 def fullscreen_off(self):
     assert self.is_fullscreen()
     # It seems that F11 is processed by WindowManager, not RemoteViewer.
     # It is necessary to point on some RV widget.
     _, _, w, h = self.dsp.extents
     rawinput.absoluteMotion(w/2, 0)
     self.fullscreen_toggle()
     self.must_window()
예제 #8
0
파일: rv6.py 프로젝트: spiceqa/tp-spice
 def fullscreen_off(self):
     assert self.is_fullscreen()
     _, _, w, h = self.dsp.extents
     rawinput.absoluteMotion(w/2, 0)
     self.push_front()
     n = self.dsp.button('Leave fullscreen')
     do_click(n)
     assert self.is_window()
예제 #9
0
 def test_motion(self):
     absoluteMotion(0, 0)
     absoluteMotion(0, 0, mouseDelay=1)
     absoluteMotion(-100, -100, check=False)
     absoluteMotion(0, 0, mouseDelay=1, check=False)
     relativeMotion(-100, -100)
     absoluteMotion(0, 0)
     relativeMotion(-100, -100, mouseDelay=1)
예제 #10
0
 def fullscreen_off(self):
     assert self.is_fullscreen()
     _, _, w, h = self.dsp.extents
     rawinput.absoluteMotion(w/2, 0)
     self.push_front()
     n = self.dsp.button('Leave fullscreen')
     do_click(n)
     assert self.is_window()
예제 #11
0
 def fullscreen_off(self):
     assert self.is_fullscreen()
     # It seems that F11 is processed by WindowManager, not RemoteViewer.
     # It is necessary to point on some RV widget.
     _, _, w, h = self.dsp.extents
     rawinput.absoluteMotion(w/2, 0)
     self.fullscreen_toggle()
     self.must_window()
예제 #12
0
 def test_motion(self):
     absoluteMotion(100, 100)
     absoluteMotion(100, 100, mouseDelay=1)
     absoluteMotion(-100, -100, check=False)
     absoluteMotion(100, 100, mouseDelay=1, check=False)
     relativeMotion(-10, -10)
     absoluteMotion(100, 100)
     relativeMotion(-10, -10, mouseDelay=1)
예제 #13
0
 def fullscreen_off(self):
     assert self.is_fullscreen()
     self.push_front()
     x = self.drawing_area.size[0]
     rawinput.absoluteMotion(x / 2, 0)
     n = self.dsp.button('Leave fullscreen')
     do_click(n)
     assert self.is_window()
 def testMaximizeFileManager(self):
     win = utils.findWindow(self.filemanager_windowname)
     win.maximize()
     win.activate(time.time())
     rawinput.absoluteMotion(int(utils.resolution.width / 2),
                             int(utils.resolution.height / 2))
     time.sleep(2)
     self.assertTrue(win != None)
 def testActivateFileManager(self):
     managerobj = self.ddedockobject.child(self.filemanager)
     managerobj.click()
     rawinput.absoluteMotion(int(utils.resolution.width / 2),
                             int(utils.resolution.height / 2))
     time.sleep(3)
     win = utils.findWindow(self.filemanager_windowname)
     self.assertTrue(win != None)
     self.assertTrue(win.is_maximized())
예제 #16
0
def point_and_pointed(node):
    #node.point()
    x, y = node.position
    assert x >= 0, "Node position X isn't positive: %s." % x
    assert y >= 0, "Node position Y isn't positive: %s." % y
    pointX = x + node.size[0] / 2
    pointY = y + node.size[1] / 2
    rawinput.absoluteMotion(pointX, pointY)
    assert node.parent.getChildAtPoint(pointX, pointY) == node, \
        "Point for node [%s | %s]: failed." % (node.roleName, node.name)
    logger.info("Point for node [%s | %s]: success.", node.roleName, node.name)
예제 #17
0
파일: rv6.py 프로젝트: spiceqa/tp-spice
def point_and_pointed(node):
    #node.point()
    x, y = node.position
    assert x >= 0, "Node position X isn't positive: %s." % x
    assert y >= 0, "Node position Y isn't positive: %s." % y
    pointX = x + node.size[0] / 2
    pointY = y + node.size[1] / 2
    rawinput.absoluteMotion(pointX, pointY)
    assert node.parent.getChildAtPoint(pointX, pointY) == node, \
        "Point for node [%s | %s]: failed." % (node.roleName, node.name)
    logger.info("Point for node [%s | %s]: success.", node.roleName, node.name)
예제 #18
0
 def wm_send_key(self, key):
     self.push_front()
     if self.is_fullscreen():
         # remote-viewer intercepts _all_ keys. It is necessary to point to
         # some RV widget.
         x = self.drawing_area.size[0]
         rawinput.absoluteMotion(x / 2, 0)
         n = self.dsp.button('Leave fullscreen')
         point_and_pointed(n)
     else:
         point_and_pointed(self.dsp.menu('File'))
     logger.info("Display #%s, send key: %s", self.num, key)
     time.sleep(1.5)  # Hrrrr!!!!!!!!!!!
     tree.root.keyCombo(key)
예제 #19
0
    def __init__(self,
                 appName,
                 shortcut='<Control><Q>',
                 desktopFileName=None,
                 timeout=5,
                 a11yAppName=None,
                 forceKill=True,
                 parameters='',
                 recordVideo=False,
                 recordVideoName=None):
        """
        Initialize object App
        appName     command to run the app
        shortcut    default quit shortcut
        a11yAppName app's a11y name is different than binary
        timeout     timeout for starting and shuting down the app
        forceKill   is the app supposed to be kill before/after test?
        parameters  has the app any params needed to start? (only for
                    startViaCommand)
        recordVideo start gnome-shell recording while running the app
        recordVideoName filename template for renaming the screencast video
        desktopFileName = name of the desktop file if other than
                          appName (without .desktop extension)
        """
        self.appCommand = appName
        self.shortcut = shortcut
        self.timeout = timeout
        self.forceKill = forceKill
        self.parameters = parameters
        self.internCommand = self.appCommand.lower()
        self.a11yAppName = a11yAppName
        self.recordVideo = recordVideo
        self.recordVideoName = recordVideoName
        self.pid = None

        # a way of overcoming overview autospawn when mouse in 1,1 from start
        pressKey('Esc')
        absoluteMotion(100, 100, 2)

        # set correct desktop file name
        if desktopFileName is None:
            desktopFileName = self.appCommand
        self.desktopFileName = desktopFileName

        # attempt to make a recording of the test
        if self.recordVideo:
            # Screencasts stop after 30 secs by default, see https://bugzilla.redhat.com/show_bug.cgi?id=1163186#c1
            cmd = "gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 600"
            Popen(cmd, shell=True, stdout=PIPE).wait()
            keyCombo('<Control><Alt><Shift>R')
    def testOpenFileManager(self):
        launcher = self.ddedockobject.child("Launcher")
        launcher.point()
        managerobj = self.ddedockobject.child(self.filemanager)
        managerobj.click()
        rawinput.absoluteMotion(int(utils.resolution.width / 2),
                                int(utils.resolution.height / 2))

        if utils.dock.hidemode_smarthide != self.defaulthidemode:
            utils.setDdeDockHideMode(utils.dock.hidemode_smarthide)

        hidemode = utils.getDdeDockHideMode()
        hidestate = utils.getDdeDockHideState()
        self.assertTrue(hidemode == utils.dock.hidemode_smarthide)
        win = utils.findWindow(self.filemanager_windowname)
        self.assertTrue(win != None)
예제 #21
0
 def push_front(self):
     logger.info("Push app front.")
     if self.is_fullscreen():
         logger.info("Display is fullscreen.")
         _, _, w, h = self.dsp.extents
         rawinput.absoluteMotion(w/2, 0)
         rawinput.click(w/2+1, 0)
     self.drawing_area.grabFocus()
     # It makes me crazy. It says it always is un-focused when it runs in
     # auto-mode. But, it is focused when I run it manually.
     #is_focused(self.drawing_area)
     if not self.is_fullscreen():
         logger.info("Display is window.")
         n = self.dsp.child(roleName="menu bar")
         do_click(n)
     logger.info("Push app front: success.")
예제 #22
0
파일: rv6.py 프로젝트: spiceqa/tp-spice
 def push_front(self):
     logger.info("Push app front.")
     if self.is_fullscreen():
         logger.info("Display is fullscreen.")
         _, _, w, h = self.dsp.extents
         rawinput.absoluteMotion(w/2, 0)
         rawinput.click(w/2+1, 0)
     self.drawing_area.grabFocus()
     # It makes me crazy. It says it always is un-focused when it runs in
     # auto-mode. But, it is focused when I run it manually.
     #is_focused(self.drawing_area)
     if not self.is_fullscreen():
         logger.info("Display is window.")
         n = self.dsp.child(roleName="menu bar")
         do_click(n)
     logger.info("Push app front: success.")
예제 #23
0
    def __init__(self, appName, shortcut='<Control><Q>', desktopFileName=None,
                 timeout=5, a11yAppName=None, forceKill=True, parameters='',
                 recordVideo=False, recordVideoName=None):
        """
        Initialize object App
        appName     command to run the app
        shortcut    default quit shortcut
        a11yAppName app's a11y name is different than binary
        timeout     timeout for starting and shuting down the app
        forceKill   is the app supposed to be kill before/after test?
        parameters  has the app any params needed to start? (only for
                    startViaCommand)
        recordVideo start gnome-shell recording while running the app
        recordVideoName filename template for renaming the screencast video
        desktopFileName = name of the desktop file if other than
                          appName (without .desktop extension)
        """
        self.appCommand = appName
        self.shortcut = shortcut
        self.timeout = timeout
        self.forceKill = forceKill
        self.parameters = parameters
        self.internCommand = self.appCommand.lower()
        self.a11yAppName = a11yAppName
        self.recordVideo = recordVideo
        self.recordVideoName = recordVideoName
        self.pid = None

        # a way of overcoming overview autospawn when mouse in 1,1 from start
        pressKey('Esc')
        absoluteMotion(100, 100, 2)

        # set correct desktop file name
        if desktopFileName is None:
            desktopFileName = self.appCommand
        self.desktopFileName = desktopFileName

        # attempt to make a recording of the test
        if self.recordVideo:
            # Screencasts stop after 30 secs by default, see https://bugzilla.redhat.com/show_bug.cgi?id=1163186#c1
            cmd = "gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 600"
            Popen(cmd, shell=True, stdout=PIPE).wait()
            keyCombo('<Control><Alt><Shift>R')
예제 #24
0
def traversePath(points, click=False, ref=-1):
    '''
    Traverse the given game path.
    Do not mix ratio and relative point formats.
    Set click to True to click at each point on the path.
    '''
    global gamePos
    if ref == -1:
        ref = gamePos
    mode = 'absolute'
    if 0 < points[0][0] < 1:
        mode = 'ratio'
    for p in points:
        if mode == 'ratio':
            pos = int(p[0]*gameLen)+ref[0], int(p[1]*gameHeight)+ref[1]
        else:
            pos = p[0]+ref[0], p[1]+ref[1]
        rawinput.absoluteMotion(pos[0], pos[1])
        if click:
            click()
    def __init__(
        self, appName, critical=None, shortcut='<Control><Q>', desktopFileName=None, a11yAppName=None, quitButton=None, timeout=5,
            forceKill=True, parameters='', polkit=False, recordVideo=True):
        """
        Initialize object App
        appName     command to run the app
        critical    what's the function we check? {start,quit}
        shortcut    default quit shortcut
        timeout     timeout for starting and shuting down the app
        forceKill   is the app supposed to be kill before/after test?
        parameters  has the app any params needed to start? (only for startViaCommand)
        desktopFileName = name of the desktop file if other than appName (without .desktop extension)
        """
        self.appCommand = appName
        self.shortcut = shortcut
        self.timeout = timeout
        self.forceKill = forceKill
        self.critical = critical
        self.quitButton = quitButton
        # the result remains false until the correct result is verified
        self.result = False
        self.updateCorePattern()
        self.parameters = parameters
        self.internCommand = self.appCommand.lower()
        self.polkit = polkit
        self.polkitPass = '******'
        self.a11yAppName = a11yAppName
        self.recordVideo = recordVideo

        if desktopFileName is None:
            desktopFileName = self.appCommand
        self.desktopFileName = desktopFileName

        # a way of overcoming overview autospawn when mouse in 1,1 from start
        pressKey('Esc')
        absoluteMotion(100, 100, 2)
        # attempt to make a recording of the test
        if self.recordVideo:
            keyCombo('<Control><Alt><Shift>R')
    def startViaMenu(self, throughCategories = False):
        self.parseDesktopFile()
        if self.forceKill and self.isRunning():
            self.kill()
            sleep(2)
            assert not self.isRunning(), "Application cannot be stopped"
        try:
            gnomeShell = root.application('gnome-shell')
            pressKey('Super_L')
            sleep(6)
            if throughCategories:
                # menu Applications
                x, y = getDashIconPosition('Show Applications')
                absoluteMotion(x, y)
                time.sleep(1)
                click(x, y)
                time.sleep(4) # time for all the oversized app icons to appear

                # submenu that contains the app
                submenu = gnomeShell.child(
                    name=self.getMenuGroups(), roleName='list item')
                submenu.click()
                time.sleep(4)

                # the app itself
                app = gnomeShell.child(
                    name=self.getName(), roleName='label')
                app.click()
            else:
                typeText(self.getName())
                sleep(2)
                pressKey('Enter')

            assert self.isRunning(), "Application failed to start"
        except SearchError:
            print("!!! Lookup error while passing the path")
        
        return root.application(self.a11yAppName)
예제 #27
0
    def testOpenFileManager(self):
        launcher = self.ddedockobject.child("Launcher")
        launcher.point()
        managerobj = self.ddedockobject.child(self.filemanager)
        managerobj.click()
        ddedock = self.ddedockobject.child(self.dock_mainwindow)
        (width, height) = ddedock.size
        if utils.dock.hidemode_smarthide != self.defaulthidemode:
            utils.setDdeDockHideMode(utils.dock.hidemode_smarthide)

        rawinput.absoluteMotion(int(utils.resolution.width / 2),
                                int(utils.resolution.height / 2))
        time.sleep(3)

        hidemode = utils.getDdeDockHideMode()
        hidestate = utils.getDdeDockHideState()
        self.assertTrue(hidemode == utils.dock.hidemode_smarthide)
        time.sleep(2)
        win = utils.findWindow(self.filemanager_windowname)
        utils.resizeWindow(win, height + 1, height + 1,
                           utils.resolution.width - 2 * height - 20,
                           utils.resolution.height - 2 * height - 20)
        self.assertTrue(win != None)
    def startViaMenu(self, throughCategories=False):
        self.parseDesktopFile()
        if self.forceKill and self.isRunning():
            self.kill()
            sleep(2)
            assert not self.isRunning(), "Application cannot be stopped"
        try:
            gnomeShell = root.application('gnome-shell')
            pressKey('Super_L')
            sleep(6)
            if throughCategories:
                # menu Applications
                x, y = getDashIconPosition('Show Applications')
                absoluteMotion(x, y)
                time.sleep(1)
                click(x, y)
                time.sleep(4)  # time for all the oversized app icons to appear

                # submenu that contains the app
                submenu = gnomeShell.child(name=self.getMenuGroups(),
                                           roleName='list item')
                submenu.click()
                time.sleep(4)

                # the app itself
                app = gnomeShell.child(name=self.getName(), roleName='label')
                app.click()
            else:
                typeText(self.getName())
                sleep(2)
                pressKey('Enter')

            assert self.isRunning(), "Application failed to start"
        except SearchError:
            print("!!! Lookup error while passing the path")

        return root.application(self.a11yAppName)
    def testMoveMouseToDock(self):
        position = utils.getDdeDockPosition()
        if utils.dock.position_top == position:
            rawinput.absoluteMotion(int(utils.resolution.width / 2), 0)
        elif utils.dock.position_right == position:
            rawinput.absoluteMotion(utils.resolution.width,
                                    int(utils.resolution.height / 2))
        elif utils.dock.position_left == position:
            rawinput.absoluteMotion(0, int(utils.resolution.height / 2))

        time.sleep(3)
        main_window = self.ddedockobject.child(self.dock_mainwindow)
        (width, height) = main_window.size
        self.assertTrue(height > 1,
                        " the size is : %s" % str(main_window.size))
        self.assertTrue(width > 1, " the size is : %s" % str(main_window.size))
예제 #30
0
def outMov(coord, mode, click=False, postDelay=0):
    global gamePos

    if mode == 'abs':
        rawinput.absoluteMotion(coord[0], coord[1], postDelay)
        if click:
            outClick(postDelay)
    elif mode == 'rel':
        rawinput.absoluteMotion((int(gamePos[0][0]+relPos[0]),
            int(gamePos[0][1]+relPos[1])), postDelay)
        if click:
            outClick(postDelay)
    elif mode == 'ratio':
        rawinput.absoluteMotion((int(ratioPos[0]*gameLen),
            int(ratioPos[1]*gameHeight)), postDelay)
        if click:
            outClick(postDelay)
예제 #31
0
파일: helpers.py 프로젝트: mcepl/cucutags
    def startViaMenu(self):
        """
        Start the app via Gnome Shell menu
        """
        internCritical = (self.critical == 'start')

        #check if the app is running
        if self.forceKill and self.isRunning():
            self.kill()
            sleep(2)
            if self.isRunning():
                if internCritical:
                    self.updateResult(False)
                #print "!!! The app is running but it shouldn't be"
                return False
            else:
                #print "*** The app has been killed succesfully"
                pass

        try:
            #panel button Activities
            gnomeShell = root.application('gnome-shell')
            activities = gnomeShell.child(name='Activities', roleName='label')
            activities.click()
            sleep(6)  # time for overview to appear

            #menu Applications
            x, y = getDashIconPosition('Show Applications')
            absoluteMotion(x, y)
            sleep(1)
            click(x, y)
            sleep(4)  # time for all the oversized app icons to appear

            #submenu that contains the app
            submenu = gnomeShell.child(name=self.getMenuGroups(),
                                       roleName='list item')
            submenu.click()
            sleep(4)

            #the app itself
            app = gnomeShell.child(name=self.getName(), roleName='label')
            app.click()

            #if there is a polkit
            if self.polkit:
                sleep(3)
                typeText(self.polkitPass)
                keyCombo('<Enter>')

            sleep(self.timeout)

            if self.isRunning():
                #print "*** The app started successfully"
                if internCritical:
                    self.updateResult(True)
                return True
            else:
                #print "!!! The app is not running but it should be"
                if internCritical:
                    self.updateResult(False)
                return False
        except SearchError:
            #print "!!! Lookup error while passing the path"
            if internCritical:
                self.updateResult(False)
            return False
예제 #32
0
        img.save(fd, args.file_n.split(".")[-1])
    logger.info('Image file of size %s generated and saved as %s', size_img,
                args.file_n)
else:
    app_nau = tree.root.application('nautilus')[0]
    app_rv = tree.root.application('remote-viewer')
    app_nau.click()
    time.sleep(0.6)
    keyCombo('<Super_L>Left')
    time.sleep(0.6)
    srcf = app_nau.findChildren(lambda x: x.name == args.file_n)[0]
    src_position = (srcf.position[0] + srcf.size[0] / 2,
                    srcf.position[1] + srcf.size[1] / 2)
    press(*src_position)
    trgt = app_rv[0].findChildren(lambda x: x.roleName == "drawing area")[0]
    dest_position = (trgt.position[0] + (3 * trgt.size[0]) / 4,
                     trgt.position[1] + trgt.size[1] / 2)
    absoluteMotion(*dest_position)
    # magic in dogtail
    absoluteMotion(*dest_position)
    release(*dest_position)
    # checking the results:
    if args.progress:
        app_rv.findChild(
            lambda x: x.name == 'File Transfers' and x.roleName == 'dialog')
        logger.info('Progress bar detected.')
    if args.negative:
        err_msg = 'An error caused the following file transfers to fail:\n%s'
        app_rv.findChildren(lambda x: x.text == err_msg % args.file_n)
        logger.info('Error message detected.')
 def testMoveMouseToDock(self):
     rawinput.absoluteMotion(int(utils.resolution.width/2), utils.resolution.height)
     time.sleep(3)
     main_window = self.ddedockobject.child(self.dock_mainwindow)
     (width, height) = main_window.size
     self.assertTrue(height > 1, " the size is : %s" % str(main_window.size))