def test_matrix(self): """ Check that the Matrix works. """ # Check that Matrix randomly updates the Screen every other frame. screen = MagicMock(spec=Screen, colours=8, unicode_aware=False) canvas = Canvas(screen, 10, 40, 0, 0) effect = Matrix(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(10): effect.update(i) self.assertEqual(self.check_canvas( canvas, my_buffer, lambda value: self.assertTrue(value[0] == 32 or value[1] == 2)), i % 2 == 0) # 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_matrix(self): """ Check that the Matrix works. """ # Check that Matrix randomly updates the Screen every other frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = Matrix(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(10): effect.update(i) self.assertEqual( self.check_canvas( canvas, buffer, lambda value: self.assertTrue(value[ 0] == 32 or value[1] == 2)), i % 2 == 0) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)
def test_matrix(self): """ Check that the Matrix works. """ # Check that Matrix randomly updates the Screen every other frame. screen = MagicMock(spec=Screen, colours=8) canvas = Canvas(screen, 10, 40, 0, 0) effect = Matrix(canvas) effect.reset() self.assert_blank(canvas) buffer = [[(32, 7, 0, 0) for _ in range(40)] for _ in range(10)] for i in range(10): effect.update(i) self.assertEqual(self.check_canvas( canvas, buffer, lambda value: self.assertTrue(value[0] == 32 or value[1] == 2)), i % 2 == 0) # Check there is no stop frame by default. self.assertEqual(effect.stop_frame, 0)