Skip to content

Commit 0201707

Browse files
authored
Merge pull request #8159 from radarhere/qt6
Removed support for Qt 5
2 parents 1c8d270 + c155677 commit 0201707

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Tests/test_imageqt.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@ def checkrgb(r: int, g: int, b: int) -> None:
4141
checkrgb(0, 0, 255)
4242

4343

44-
def test_image() -> None:
45-
modes = ["1", "RGB", "RGBA", "L", "P"]
46-
qt_format = ImageQt.QImage.Format if ImageQt.qt_version == "6" else ImageQt.QImage
47-
if hasattr(qt_format, "Format_Grayscale16"): # Qt 5.13+
48-
modes.append("I;16")
49-
50-
for mode in modes:
51-
im = hopper(mode)
52-
roundtripped_im = ImageQt.fromqimage(ImageQt.ImageQt(im))
53-
if mode not in ("RGB", "RGBA"):
54-
im = im.convert("RGB")
55-
assert_image_similar(roundtripped_im, im, 1)
44+
@pytest.mark.parametrize("mode", ("1", "RGB", "RGBA", "L", "P", "I;16"))
45+
def test_image(mode: str) -> None:
46+
im = hopper(mode)
47+
roundtripped_im = ImageQt.fromqimage(ImageQt.ImageQt(im))
48+
if mode not in ("RGB", "RGBA"):
49+
im = im.convert("RGB")
50+
assert_image_similar(roundtripped_im, im, 1)
5651

5752

5853
def test_closed_file() -> None:

src/PIL/ImageQt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _toqclass_helper(im):
152152
elif im.mode == "RGBA":
153153
data = im.tobytes("raw", "BGRA")
154154
format = qt_format.Format_ARGB32
155-
elif im.mode == "I;16" and hasattr(qt_format, "Format_Grayscale16"): # Qt 5.13+
155+
elif im.mode == "I;16":
156156
im = im.point(lambda i: i * 256)
157157

158158
format = qt_format.Format_Grayscale16

0 commit comments

Comments
 (0)