def check_buttons(cmd, expect): with SmartDisplay(visible=VISIBLE) as disp: with EasyProcess(cmd): disp.waitgrab(timeout=TIMEOUT) buttons = discover_buttons() eq_(len(buttons), len(expect), msg='dialog does not have expected buttons %s!=%s' % (buttons,expect)) mouse = PyMouse() print 'buttons:',buttons for v, b in zip(expect, buttons): process = EasyProcess(cmd).start().sleep(1) mouse.click(*b.center) process.wait() eq_(process.stdout, str(v)) #dialog does not return expected value
def focus_wnd(): ''' move mouse over window to get focus ''' rct_wnd = getbbox(pyscreenshot.grab()) if not rct_wnd: raise EmptyScreenException('Empty screen!') imglog.set_crop_rect(rct_wnd) # init window focus mouse = PyMouse() mouse.move(*rct_wnd.topleft) img_orig = pyscreenshot.grab() imglog.img_log(img_orig, 'img_orig') return img_orig