def test_screen_shot_standardizes_the_screen_image(self): import ImageGrab with patch.object(ImageGrab, 'grab') as m_grab: m_grab.return_value = _generic_image() with patch.object(visuals, '_standardize_image') as m_stdize: m_stdize.return_value = _generic_image(channels=3) visuals.screen_shot() self.assertIsNone(m_stdize.assert_called_with(m_grab.return_value))
def test_screen_shot_gets_an_image_with_same_resolution_as_screen(self): # thanks to jcao219 for the python-only way to get screen resolution # http://stackoverflow.com/a/3129524/377366 import ctypes user32 = ctypes.windll.user32 ss_h_w_spec = user32.GetSystemMetrics(1), user32.GetSystemMetrics(0) # get the actual screen shot and confirm the size screen_shot = visuals.screen_shot() ss_h_w = screen_shot.shape[0:2] self.assertEqual(ss_h_w, ss_h_w_spec)
def _screen_shot(self): return v.screen_shot()