Skip to content

Commit f1c71bb

Browse files
committed
Add a test for Screenshot.bgra
1 parent 3ce3ce4 commit f1c71bb

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ History:
44

55
dev 2018/xx/xx
66
- add PNG compression level control
7+
- MSS: add Screenshot.bgra attribute
78

89
3.1.2 2018/01/05
910
- removed support for Python 3.3

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ base.py
55
-------
66
- Added ``MSSBase.compression_level`` to control the PNG compression level
77

8+
screenshot.py
9+
-------------
10+
- Added ``Screenshot.bgra`` to get BGRA bytes.
11+
812
tools.py
913
--------
1014
- Changed signature of ``to_png(data, size, output=None)`` to ``to_png(data, size, level=6, output=None)``. ``level`` is the Zlib compression level.

tests/test_third_party.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ def test_pil(sct):
4646
assert os.path.isfile('box.png')
4747

4848

49+
@pytest.mark.skipif(
50+
Image is None,
51+
reason='PIL module not available.')
52+
def test_pil_bgra(sct):
53+
width, height = 16, 16
54+
box = {'top': 0, 'left': 0, 'width': width, 'height': height}
55+
sct_img = sct.grab(box)
56+
57+
img = Image.frombytes('RGBX', sct_img.size, sct_img.bgra)
58+
assert img.mode == 'RGBX'
59+
assert img.size == sct_img.size
60+
61+
4962
@pytest.mark.skipif(
5063
Image is None,
5164
reason='PIL module not available.')

0 commit comments

Comments
 (0)