Example #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)
Example #2
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)
Example #3
0
 def test_press(self):
     self.runDemo('Builder')
     focus.window('GtkBuilder demo')
     btn = focus.window.node.button('New')
     press(btn.position[0], btn.position[1])
     self.assertIn(pyatspi.STATE_ARMED, btn.getState().getStates())
     release(btn.position[0], btn.position[1])
     self.assertNotIn(pyatspi.STATE_ARMED, btn.getState().getStates())
Example #4
0
 def test_press_release(self):
     self.runDemo('Builder')
     try:
         wnd = self.app.child('GtkBuilder demo', roleName='frame', recursive=False, retry=False)
     except dogtail.tree.SearchError:
         wnd = self.app.child('Builder', roleName='frame', recursive=False, retry=False)
     btn = wnd.button('New')
     press(btn.position[0] + btn.size[0] / 2, btn.position[1] + btn.size[1] / 2, check=False)
     self.assertIn(pyatspi.STATE_ARMED, btn.getState().getStates())
     release(btn.position[0] + btn.size[0] / 2, btn.position[1] + btn.size[1] / 2, check=False)
     self.assertNotIn(pyatspi.STATE_ARMED, btn.getState().getStates())
Example #5
0
 def test_press_release(self):
     self.runDemo('Builder')
     try:
         wnd = self.app.child('GtkBuilder demo', roleName='frame', recursive=False, retry=False)
     except dogtail.tree.SearchError:
         wnd = self.app.child('Builder', roleName='frame', recursive=False, retry=False)
     btn = wnd.button('New')
     press(btn.position[0] + btn.size[0] / 2, btn.position[1] + btn.size[1] / 2, check=False)
     self.assertIn(pyatspi.STATE_ARMED, btn.getState().getStates())
     release(btn.position[0] + btn.size[0] / 2, btn.position[1] + btn.size[1] / 2, check=False)
     self.assertNotIn(pyatspi.STATE_ARMED, btn.getState().getStates())
Example #6
0
        fill='red')
    with open(args.file_n, 'w') as fd:
        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)