aboutsummaryrefslogtreecommitdiffstats
path: root/test_upscale_qt.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-30 19:03:12 +0100
committerDanilo M. <danix@danix.xyz>2026-10-30 19:03:12 +0100
commitfd5eb858f89c7a39506abb2aeea8756fd1228763 (patch)
tree7cef158fb54ded3183ba3eab775f43c8286bc104 /test_upscale_qt.py
parent71e6979efcb6ac9593a4618d964504a7f44d490f (diff)
downloadupscale-qt-fd5eb858f89c7a39506abb2aeea8756fd1228763.tar.gz
upscale-qt-fd5eb858f89c7a39506abb2aeea8756fd1228763.zip
Add slider-wipe compare view
Before and after share one transform; before is drawn into after's rectangle so it is never copied at 4x size. Drag the divider to wipe, drag elsewhere to pan, wheel zooms around the cursor, double-click fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test_upscale_qt.py')
-rw-r--r--test_upscale_qt.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test_upscale_qt.py b/test_upscale_qt.py
index 526dc37..439807c 100644
--- a/test_upscale_qt.py
+++ b/test_upscale_qt.py
@@ -77,6 +77,25 @@ def test_save_over():
assert not os.path.exists(path + '.part')
+from PyQt6.QtWidgets import QApplication # noqa: E402
+
+APP = QApplication.instance() or QApplication([])
+
+
+def test_compare_view():
+ before = QImage(10, 10, QImage.Format.Format_RGB32)
+ before.fill(QColor('red'))
+ after = QImage(40, 40, QImage.Format.Format_RGB32)
+ after.fill(QColor('blue'))
+ v = uq.CompareView()
+ v.resize(400, 400) # at or above the minimum size
+ v.set_images(before, after)
+ shot = v.grab().toImage()
+ # left of the divider shows before, right shows after
+ assert shot.pixelColor(100, 200) == QColor('red')
+ assert shot.pixelColor(300, 200) == QColor('blue')
+
+
if __name__ == '__main__':
for name, fn in list(globals().items()):
if name.startswith('test_'):