aboutsummaryrefslogtreecommitdiffstats
path: root/test_upscale_qt.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-14 10:47:48 +0100
committerDanilo M. <danix@danix.xyz>2026-11-14 10:47:48 +0100
commit14ae5e98e9ccbb48d3f1b5e6fda7d5b88007aca3 (patch)
tree555d9103e2be4b64fc9f4bb1131a3ec1c470c8ce /test_upscale_qt.py
parenta23a2f6dea1be750fbe9462fce25a49b8f1cb61b (diff)
downloadupscale-qt-14ae5e98e9ccbb48d3f1b5e6fda7d5b88007aca3.tar.gz
upscale-qt-14ae5e98e9ccbb48d3f1b5e6fda7d5b88007aca3.zip
sd-cli has no scale factor for image upscale, the model fixes it. A
2x/3x/4x dropdown shrinks the model result to the chosen factor with smooth scaling. It never enlarges, so a native 2x model stays 2x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'test_upscale_qt.py')
-rw-r--r--test_upscale_qt.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test_upscale_qt.py b/test_upscale_qt.py
index 7d7307c..70608b6 100644
--- a/test_upscale_qt.py
+++ b/test_upscale_qt.py
@@ -67,6 +67,14 @@ def test_progress():
assert uq.progress(b'[I] load model') is None
+def test_fit_scale():
+ from PyQt6.QtCore import QSize
+ big = QImage(40, 20, QImage.Format.Format_RGB32)
+ assert uq.fit_scale(big, QSize(10, 5), 2).size() == QSize(20, 10)
+ assert uq.fit_scale(big, QSize(10, 5), 4).size() == QSize(40, 20)
+ assert uq.fit_scale(big, QSize(20, 10), 4).size() == QSize(40, 20) # 2x model
+
+
def test_save_over():
path = os.path.join(TMP, 'photo.JPG') # uppercase suffix on purpose
small = QImage(4, 4, QImage.Format.Format_RGB32)