def test_animated_splash_set_frame(): """ Ensure the splash screen's pixmap is updated with the animation's current pixmap. """ mock_gif = mock.MagicMock() asplash = AnimatedSplash(mock_gif) asplash.setPixmap = mock.MagicMock() asplash.setMask = mock.MagicMock() asplash.set_frame() asplash.animation.currentPixmap.assert_called_once_with() pixmap = asplash.animation.currentPixmap() asplash.setPixmap.assert_called_once_with(pixmap) asplash.setMask.assert_called_once_with(pixmap.mask())
def test_animated_splash_set_frame(): """ Ensure the splash screen's pixmap is updated with the animation's current pixmap. """ test_animation = load_movie("splash_screen") test_animation.frameChanged = mock.MagicMock() test_animation.start = mock.MagicMock() asplash = AnimatedSplash(test_animation) asplash.setPixmap = mock.MagicMock() asplash.setMask = mock.MagicMock() test_animation.currentPixmap = mock.MagicMock() asplash.set_frame() asplash.animation.currentPixmap.assert_called_once_with() pixmap = asplash.animation.currentPixmap() asplash.setPixmap.assert_called_once_with(pixmap) asplash.setMask.assert_called_once_with(pixmap.mask())
def test_animated_splash_failed(): """ When instructed to transition to a failed state, ensure the correct image is displayed along with the correct message. """ test_animation = load_movie("splash_screen") asplash = AnimatedSplash(test_animation) asplash.setPixmap = mock.MagicMock() asplash.draw_text = mock.MagicMock() error = ("Something went boom!\n" "This is an error message...\n" "In real life, this would include a stack trace.\n" "It will also include details about the exception.\n") with mock.patch("mu.app.load_pixmap") as load_pix: asplash.failed(error) load_pix.assert_called_once_with("splash_fail.png") asplash.draw_text.assert_called_once_with( error + "\nThis screen will close in a few seconds. " + "Then a crash report tool will open in your browser.") assert asplash.setPixmap.call_count == 1