def test_noise(self): """ Check that RandomNoise works. """ # Check that RandomNoise updates every frame. screen = MagicMock(spec=Screen, colours=8, unicode_aware=False) canvas = Canvas(screen, 10, 40, 0, 0) effect = RandomNoise(canvas) effect.reset() self.assert_blank(canvas) my_buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual(self.check_canvas( canvas, my_buffer, lambda value: self.assertLess(value[0], 129)), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0) # This effect should ignore events. event = object() self.assertEqual(event, effect.process_event(event))
def test_noise(self): """ Check that RandomNoise works. """ # Check that RandomNoise updates every frame. screen = MagicMock(spec=Screen, colours=8, unicode_aware=False) canvas = Canvas(screen, 10, 40, 0, 0) effect = RandomNoise(canvas) effect.reset() self.assert_blank(canvas) my_buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual(self.check_canvas( canvas, my_buffer, lambda value: self.assertLess(value[0], 129)), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0) # This effect should ignore events. event = object() self.assertEqual(event, effect.process_event(event))
def test_noise(self): """ Check that RandomNoise works. """ # Check that RandomNoise updates every frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = RandomNoise(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual( self.check_canvas( canvas, buffer, lambda value: self.assertLess(value[0], 129)), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)
def test_noise(self): """ Check that RandomNoise works. """ # Check that RandomNoise updates every frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = RandomNoise(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(20): effect.update(i) self.assertEqual(self.check_canvas( canvas, buffer, lambda value: self.assertLess(value[0], 129)), True) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)