Example #1
0
    def test_calls_save_scene_when_record_is_on(self):
        # Given
        mm = MovieMaker(record=True)
        mm._save_scene = MagicMock()

        # When
        mm.animation_start()
        mm.animation_step()
        mm.animation_step()
        mm.animation_stop()

        # Then
        self.assertEqual(mm._save_scene.call_count, 3)
Example #2
0
    def test_does_nothing_when_record_is_off(self):
        # Given
        mm = MovieMaker(record=False)
        mm._save_scene = MagicMock()

        # When
        mm.animation_start()
        mm.animation_step()
        mm.animation_step()
        mm.animation_stop()

        # Then
        mm._save_scene.assert_not_called()
Example #3
0
    def test_calls_save_scene_when_record_is_on(self):
        # Given
        mm = MovieMaker(record=True)
        mm._save_scene = mock.MagicMock()

        # When
        mm.animation_start()
        mm.animation_step()
        mm.animation_step()
        mm.animation_stop()

        # Then
        self.assertEqual(mm._save_scene.call_count, 3)
Example #4
0
    def test_does_nothing_when_record_is_off(self):
        # Given
        mm = MovieMaker(record=False)
        mm._save_scene = mock.MagicMock()

        # When
        mm.animation_start()
        mm.animation_step()
        mm.animation_step()
        mm.animation_stop()

        # Then
        mm._save_scene.assert_not_called()
Example #5
0
    def test_calls_save_scene_with_record_movie(self):
        # Given
        mm = MovieMaker(record=False)
        mm._save_scene = MagicMock()
        mm.animation_start = MagicMock()
        mm.animation_stop = MagicMock()

        # When
        with mm.record_movie():
            mm.animation_step()
            mm.animation_step()

        # Then
        mm.animation_start.assert_called_once_with()
        self.assertEqual(mm._save_scene.call_count, 2)
        mm.animation_stop.assert_called_once_with()
        self.assertEqual(mm.record, False)
Example #6
0
    def test_calls_save_scene_with_record_movie(self):
        # Given
        mm = MovieMaker(record=False)
        mm._save_scene = mock.MagicMock()
        mm.animation_start = mock.MagicMock()
        mm.animation_stop = mock.MagicMock()

        # When
        with mm.record_movie():
            mm.animation_step()
            mm.animation_step()

        # Then
        mm.animation_start.assert_called_once_with()
        self.assertEqual(mm._save_scene.call_count, 2)
        mm.animation_stop.assert_called_once_with()
        self.assertEqual(mm.record, False)