def test_gcalctool1(self): self.p = EasyProcess('gnome-calculator').start() self.wait() focus_wnd() send_key('ctrl+q') time.sleep(1) # img_debug(grab(), 'ctrl+q') self.assertFalse(getbbox(grab()))
def tab_rectangles(): ''' Return rectangles found by sending TAB button events. Does not work if other parts of screen are changing (e.g. blinking cursor) :rtype: rectangles list ''' ls = [] img_orig = focus_wnd() im1 = img_orig while 1: send_key('\t') im2 = pyscreenshot.grab() img_log(im1, 'im1') img_log(im2, 'im2') boxes = tab_rect_pair(im1, im2) if not boxes: return [] if len(ls): if len(boxes) == 2: # TODO: implement almost_equal() assert boxes[0] == ls[-1] if boxes[-1] in ls: break ls += [boxes[-1]] else: # first ls += boxes im1 = im2 img_log_rects(img_orig, ls, 'img_orig') log.debug('rectangles found:%s', ls) return ls
def test_zenity(self): self.p = EasyProcess('zenity --warning').start() self.wait() send_key('\n') self.assertFalse(getbbox(grab())) self.p = EasyProcess('zenity --warning').start() self.wait() send_key_list(['\n']) self.assertFalse(getbbox(grab())) self.p = EasyProcess('zenity --warning').start() self.wait() send_key(' ') self.assertFalse(getbbox(grab())) self.p = EasyProcess('zenity --warning').start() self.wait() send_key('x') self.assertTrue(getbbox(grab()))