@@ -86,6 +86,24 @@ def _wait_for_drawer_open(self, timeout_ms=2000):
8686 wait_for_render (iterations = 10 )
8787 return False
8888
89+ def _wait_for_bar_hidden (self , bar , timeout_ms = 3500 ):
90+ start = time .ticks_ms ()
91+ while time .ticks_diff (time .ticks_ms (), start ) < timeout_ms :
92+ if not topmenu .bar_open :
93+ return True
94+ coords = get_widget_coords (bar )
95+ if coords and coords ["y2" ] < 0 :
96+ return True
97+ wait_for_render (iterations = 20 )
98+ return False
99+
100+ def _ensure_bar_closed (self , bar_coords , bar ):
101+ if self ._swipe_up_on_bar (bar_coords , bar ):
102+ return True
103+ topmenu .close_bar ()
104+ wait_for_render (iterations = 100 )
105+ return self ._wait_for_bar_hidden (bar , timeout_ms = 4000 )
106+
89107 def _ensure_drawer_open (self , bar_coords ):
90108 if self ._swipe_down_on_bar (bar_coords ):
91109 return True
@@ -108,6 +126,20 @@ def _swipe_down_on_bar(self, bar_coords):
108126 wait_for_render (iterations = 50 )
109127 return self ._wait_for_drawer_open ()
110128
129+ def _swipe_up_on_bar (self , bar_coords , bar ):
130+ start_x = DisplayMetrics .width () // 2
131+ start_y = max (1 , (bar_coords ["y1" ] + bar_coords ["y2" ]) // 2 )
132+ end_y = - AppearanceManager .NOTIFICATION_BAR_HEIGHT
133+ simulate_drag (start_x , start_y , start_x , end_y , steps = 30 , step_delay_ms = 45 )
134+ wait_for_render (iterations = 80 )
135+ if self ._wait_for_bar_hidden (bar ):
136+ return True
137+
138+ end_y = - AppearanceManager .NOTIFICATION_BAR_HEIGHT * 2
139+ simulate_drag (start_x , start_y , start_x , end_y , steps = 36 , step_delay_ms = 45 )
140+ wait_for_render (iterations = 100 )
141+ return self ._wait_for_bar_hidden (bar )
142+
111143 def test_notification_bar_widgets_visible (self ):
112144 bar = topmenu .notification_bar
113145 self .assertIsNotNone (bar , "Notification bar was not created" )
@@ -117,11 +149,11 @@ def test_notification_bar_widgets_visible(self):
117149 self .assertIsNotNone (bar_coords , "Notification bar coords not available" )
118150 if bar_coords ["y1" ] < 0 :
119151 topmenu .open_bar ()
120- wait_for_render (iterations = 40 )
152+ wait_for_render (iterations = 60 )
121153 bar_coords = get_widget_coords (bar )
122154 if bar_coords and bar_coords ["y1" ] < 0 :
123155 bar .set_y (0 )
124- wait_for_render (iterations = 20 )
156+ wait_for_render (iterations = 30 )
125157 bar_coords = get_widget_coords (bar )
126158 self .assertIsNotNone (bar_coords , "Notification bar coords not available" )
127159 self .assertGreaterEqual (
@@ -181,3 +213,13 @@ def test_notification_bar_widgets_visible(self):
181213 any ("Off" in text or lv .SYMBOL .POWER in text for _ , text in drawer_labels ),
182214 "Power-off label not found in drawer" ,
183215 )
216+
217+ topmenu .close_drawer ()
218+ wait_for_render (iterations = 40 )
219+ bar_coords = get_widget_coords (bar )
220+ self .assertIsNotNone (bar_coords , "Notification bar coords not available" )
221+ self .assertTrue (
222+ self ._ensure_bar_closed (bar_coords , bar ),
223+ "Notification bar did not close after swipe up" ,
224+ )
225+ self .assertFalse (topmenu .bar_open , "Notification bar is still open after swipe up" )
0 commit comments