From 814fb72645fcf44b3ae095b8391261ea3a04c20c Mon Sep 17 00:00:00 2001 From: Luke Zapart Date: Sat, 26 Aug 2017 18:25:06 -0700 Subject: [PATCH] Test save_screenshot --- tests/ristar/test_ristar.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/ristar/test_ristar.py b/tests/ristar/test_ristar.py index d0448a8..bfa808b 100644 --- a/tests/ristar/test_ristar.py +++ b/tests/ristar/test_ristar.py @@ -1,4 +1,5 @@ import hashlib +import os import tempfile from PySide.QtCore import Qt @@ -37,6 +38,8 @@ def test_ristar(qtbot, mock): - Select every zoom/render filter combo, run for 5 frames and check if the video output (screenshot) is correct. - Enable debug mode, press Start, check if the debug text is correct. + - Disable debug mode, take a screenshot and check if it was created. + """ from kiwi import MainWindow, render_filters window = MainWindow() @@ -82,3 +85,13 @@ def test_ristar(qtbot, mock): expected_debug_text = f.read() assert debug_text == expected_debug_text + + display.toggle_debug() + + run_frames(display, 50) + + filename = display.save_screenshot() + + assert os.path.isfile(filename) + assert 'screenshot' in filename + assert filename.endswith('.png')