Skip to content

Commit

Permalink
tests: added regression tests for #128 and #135
Browse files Browse the repository at this point in the history
  • Loading branch information
BoboTiG committed Dec 30, 2019
1 parent 60d19df commit 54de3d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ History:
- Windows: use our own instances of GDI32 and User32 DLLs
- doc: add project_urls to setup.cfg
- doc: add an example using the multiprocessing module (closes #82)
- tests: added regression tests for #128 and #135

4.0.2 2019/02/23
- new contributor: foone
Expand Down
22 changes: 22 additions & 0 deletions tests/test_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ def with_context_manager():
sct.shot()


def regression_issue_128():
"""Regression test for issue #128: areas overlap."""
area1 = {"top": 50, "left": 7, "width": 400, "height": 320, "mon": 1}
area2 = {"top": 200, "left": 200, "width": 320, "height": 320, "mon": 1}
with mss() as sct:
sct.grab(area1)
sct.grab(area2)


def regression_issue_135():
"""Regression test for issue #135: multiple areas."""
bounding_box_notes = {"top": 0, "left": 0, "width": 100, "height": 100}
bounding_box_score = {"top": 110, "left": 110, "width": 100, "height": 100}
bounding_box_test = {"top": 220, "left": 220, "width": 100, "height": 100}
with mss() as sct:
sct.grab(bounding_box_notes)
sct.grab(bounding_box_test)
sct.grab(bounding_box_score)


@pytest.mark.skipif(OS == "darwin", reason="No possible leak on macOS.")
@pytest.mark.parametrize(
"func",
Expand All @@ -88,6 +108,8 @@ def with_context_manager():
bound_instance_without_cm_but_use_close,
unbound_instance_without_cm,
with_context_manager,
regression_issue_128,
regression_issue_135,
),
)
def test_resource_leaks(func, monitor_func):
Expand Down

0 comments on commit 54de3d9

Please sign in to comment.