Skip to content

Commit 54de3d9

Browse files
committed
tests: added regression tests for #128 and #135
1 parent 60d19df commit 54de3d9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ History:
1111
- Windows: use our own instances of GDI32 and User32 DLLs
1212
- doc: add project_urls to setup.cfg
1313
- doc: add an example using the multiprocessing module (closes #82)
14+
- tests: added regression tests for #128 and #135
1415

1516
4.0.2 2019/02/23
1617
- new contributor: foone

tests/test_leaks.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ def with_context_manager():
8080
sct.shot()
8181

8282

83+
def regression_issue_128():
84+
"""Regression test for issue #128: areas overlap."""
85+
area1 = {"top": 50, "left": 7, "width": 400, "height": 320, "mon": 1}
86+
area2 = {"top": 200, "left": 200, "width": 320, "height": 320, "mon": 1}
87+
with mss() as sct:
88+
sct.grab(area1)
89+
sct.grab(area2)
90+
91+
92+
def regression_issue_135():
93+
"""Regression test for issue #135: multiple areas."""
94+
bounding_box_notes = {"top": 0, "left": 0, "width": 100, "height": 100}
95+
bounding_box_score = {"top": 110, "left": 110, "width": 100, "height": 100}
96+
bounding_box_test = {"top": 220, "left": 220, "width": 100, "height": 100}
97+
with mss() as sct:
98+
sct.grab(bounding_box_notes)
99+
sct.grab(bounding_box_test)
100+
sct.grab(bounding_box_score)
101+
102+
83103
@pytest.mark.skipif(OS == "darwin", reason="No possible leak on macOS.")
84104
@pytest.mark.parametrize(
85105
"func",
@@ -88,6 +108,8 @@ def with_context_manager():
88108
bound_instance_without_cm_but_use_close,
89109
unbound_instance_without_cm,
90110
with_context_manager,
111+
regression_issue_128,
112+
regression_issue_135,
91113
),
92114
)
93115
def test_resource_leaks(func, monitor_func):

0 commit comments

Comments
 (0)