mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 04:56:57 +03:00
Merge 2bf482230d
into 0013f9590a
This commit is contained in:
commit
5bbc30acf6
|
@ -6,6 +6,8 @@ from pathlib import Path
|
|||
import pytest
|
||||
|
||||
from PIL import BmpImagePlugin, Image, _binary
|
||||
from PIL._binary import o16le as o16
|
||||
from PIL._binary import o32le as o32
|
||||
|
||||
from .helper import (
|
||||
assert_image_equal,
|
||||
|
@ -114,7 +116,7 @@ def test_save_float_dpi(tmp_path: Path) -> None:
|
|||
|
||||
|
||||
def test_load_dib() -> None:
|
||||
# test for #1293, Imagegrab returning Unsupported Bitfields Format
|
||||
# test for #1293, ImageGrab returning Unsupported Bitfields Format
|
||||
with Image.open("Tests/images/clipboard.dib") as im:
|
||||
assert im.format == "DIB"
|
||||
assert im.get_format_mimetype() == "image/bmp"
|
||||
|
@ -219,6 +221,18 @@ def test_rle8_eof(file_name: str, length: int) -> None:
|
|||
im.load()
|
||||
|
||||
|
||||
def test_unsupported_bmp_bitfields_layout() -> None:
|
||||
fp = io.BytesIO(
|
||||
o32(40) # header size
|
||||
+ b"\x00" * 10
|
||||
+ o16(1) # bits
|
||||
+ o32(3) # BITFIELDS compression
|
||||
+ b"\x00" * 32
|
||||
)
|
||||
with pytest.raises(OSError, match="Unsupported BMP bitfields layout"):
|
||||
Image.open(fp)
|
||||
|
||||
|
||||
def test_offset() -> None:
|
||||
# This image has been hexedited
|
||||
# to exclude the palette size from the pixel data offset
|
||||
|
|
Loading…
Reference in New Issue
Block a user