From fd5eb858f89c7a39506abb2aeea8756fd1228763 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 30 Oct 2026 19:03:12 +0100 Subject: 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 --- test_upscale_qt.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test_upscale_qt.py') 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_'): -- cgit v1.2.3