@@ -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)
93115def test_resource_leaks (func , monitor_func ):
0 commit comments