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 test_doubleClick(self): btn = self.app.child('Builder') doubleClick(btn.position[0], btn.position[1]) self.assertEqual( len([ x for x in self.app.children if x.name in ['GtkBuilder demo', 'Builder'] ]), 2)
def doubleClick(self, button=1): """ Generates a raw mouse double-click event, using the specified button. """ clickX = self.position[0] + self.size[0] / 2 clickY = self.position[1] + self.size[1] / 2 if config.debugSearching: logger.log("raw click on %s %s at (%s,%s)" % (self.name, self.getLogString(), str(clickX), str(clickY))) rawinput.doubleClick(clickX, clickY, button)
def doubleClick(self, button=1): """ Generates a raw mouse double-click event, using the specified button. """ clickX = self.position[0] + self.size[0] / 2 clickY = self.position[1] + self.size[1] / 2 if config.debugSearching: logger.log(str("raw click on %s %s at (%s,%s)") % (str(self.name), self.getLogString(), str(clickX), str(clickY))) rawinput.doubleClick(clickX, clickY, button)
def clickFocus(self, maximize=None): """ Will focus on the app by clicking in the middle of its window titlebar""" try: main_win = self.app.child(roleName='window', recursive=False) coordinates = (main_win.position[0]+main_win.size[0]/2, main_win.position[1]-10) if maximize is None: click(coordinates[0],coordinates[1]) else: #a doubleClick to maximize as well doubleClick(coordinates[0],coordinates[1]) except: printException() return False
def configure_openpgp_account(tb): keyid = get_key_fpr() export_pub_key() open_account_setup(tb) settings = tb.findChild( orPredicate( GenericPredicate(name='Account Settings.*', roleName='frame'), GenericPredicate(name='Account Settings', roleName='dialog'), )) # assume only one account... settings.childNamed('End-To-End Encryption').doActionNamed('activate') settings.childNamed('Add Key.*').doActionNamed('press') settings.childNamed('Use your external key.*').doActionNamed('select') settings.childNamed('Continue').doActionNamed('press') settings.findChild(TBEntry('123456789.*')).text = keyid settings.button('Save key ID').doActionNamed('press') settings.findChild( GenericPredicate(name='0x%s.*' % keyid, roleName='radio button')).doActionNamed('select') settings.childNamed('OpenPGP Key Manager.*').doActionNamed('press') key_manager = tb.findChild( GenericPredicate(name='OpenPGP Key Manager', roleName='frame')) key_manager.findChild(GenericPredicate( name='File', roleName='menu')).doActionNamed('click') key_manager.findChild( GenericPredicate(name='Import Public Key(s) From File', roleName='menu item')).doActionNamed('click') file_chooser = tb.findChild( GenericPredicate(name='Import OpenPGP Key File', roleName='file chooser')) click(*file_chooser.childNamed('Home').position) click(*file_chooser.childNamed('pub.asc').position) file_chooser.childNamed('Open').doActionNamed('click') accept_dialog = tb.findChild( orPredicate( GenericPredicate(name='.*(%s).*' % keyid), GenericPredicate(name='.[0-9A-F]*%s' % keyid), )).parent accept_dialog.childNamed('OK').doActionNamed('press') tb.childNamed('Success! Keys imported.*').childNamed('OK').doActionNamed( 'press') doubleClick(*key_manager.findChild( GenericPredicate(name='Qubes test <user@localhost>.*')).position) key_property = tb.findChild( GenericPredicate(name="Key Properties.*", roleName='frame')) key_property.findChild( GenericPredicate(name="Yes, I've verified in person.*", roleName='radio button')).doActionNamed('select') key_property.childNamed('OK').doActionNamed('press') key_manager.findChild(GenericPredicate( name='Close', roleName='menu item')).doActionNamed('click')
def configure_openpgp_global(tb): menu = tb.menu('Edit') menu.doActionNamed('click') menu.menuItem('Preferences').doActionNamed('click') preferences = tb.findChild( GenericPredicate(name='Preferences.*', roleName='frame')) config_editor = preferences.findChild( GenericPredicate(name='Config Editor.*', roleName='push button')) config_editor.doActionNamed('press') preferences.findChild( GenericPredicate(name='I accept the risk!', roleName='push button')).doActionNamed('press') about_config = preferences.findChild( GenericPredicate(name='about:config', roleName='embedded')) search = about_config.findChild( GenericPredicate(name='Search:', roleName='unknown')) search.children[0].text = 'mail.openpgp.allow_external_gnupg' allow_external_gnupg = preferences.findChild( GenericPredicate( name='mail.openpgp.allow_external_gnupg default boolean false', roleName='table row')) doubleClick(*allow_external_gnupg.position) search.children[0].text = 'mail.openpgp.alternative_gpg_path' alternative_gpg_path = preferences.findChild( GenericPredicate( name='mail.openpgp.alternative_gpg_path default string.*', roleName='table row')) doubleClick(*alternative_gpg_path.position) gpg_entry_value = tb.findChild( GenericPredicate(name='Enter string value', roleName='frame')) gpg_entry_value.findChild(GenericPredicate( roleName='entry')).text = '/usr/bin/qubes-gpg-client-wrapper' gpg_entry_value.findChild( GenericPredicate(name='OK', roleName='push button')).doActionNamed('press') file = preferences.menu('File') file.doActionNamed('click') file.child('Close').doActionNamed('click')
def test_doubleClick(self): btn = focus.application.node.child('Builder') doubleClick(btn.position[0], btn.position[1]) focus.window('GtkBuilder demo')
def test_doubleClick(self): btn = self.app.child('Builder') doubleClick(btn.position[0], btn.position[1]) self.assertEqual(len([x for x in self.app.children if x.name in ['GtkBuilder demo', 'Builder']]), 2)