|
1 | 1 | package io.flutter.plugin.platform; |
2 | 2 |
|
3 | | -import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; |
4 | | -import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; |
5 | 3 | import static org.junit.Assert.assertFalse; |
6 | 4 | import static org.junit.Assert.assertNotNull; |
7 | 5 | import static org.junit.Assert.assertNull; |
|
22 | 20 | import android.os.Build; |
23 | 21 | import android.view.View; |
24 | 22 | import android.view.Window; |
25 | | -import android.view.WindowInsetsController; |
26 | 23 | import androidx.activity.OnBackPressedCallback; |
27 | 24 | import androidx.fragment.app.FragmentActivity; |
28 | 25 | import io.flutter.embedding.engine.systemchannels.PlatformChannel; |
@@ -219,98 +216,6 @@ public void setNavigationBarDividerColor() { |
219 | 216 | } |
220 | 217 | } |
221 | 218 |
|
222 | | - @Config(sdk = 30) |
223 | | - @Test |
224 | | - public void setNavigationBarIconBrightness() { |
225 | | - if (Build.VERSION.SDK_INT >= 30) { |
226 | | - View fakeDecorView = mock(View.class); |
227 | | - WindowInsetsController fakeWindowInsetsController = mock(WindowInsetsController.class); |
228 | | - Window fakeWindow = mock(Window.class); |
229 | | - when(fakeWindow.getDecorView()).thenReturn(fakeDecorView); |
230 | | - when(fakeWindow.getInsetsController()).thenReturn(fakeWindowInsetsController); |
231 | | - Activity fakeActivity = mock(Activity.class); |
232 | | - when(fakeActivity.getWindow()).thenReturn(fakeWindow); |
233 | | - PlatformChannel fakePlatformChannel = mock(PlatformChannel.class); |
234 | | - PlatformPlugin platformPlugin = new PlatformPlugin(fakeActivity, fakePlatformChannel); |
235 | | - |
236 | | - SystemChromeStyle style = |
237 | | - new SystemChromeStyle( |
238 | | - null, // statusBarColor |
239 | | - null, // statusBarIconBrightness |
240 | | - null, // systemStatusBarContrastEnforced |
241 | | - null, // systemNavigationBarColor |
242 | | - Brightness.LIGHT, // systemNavigationBarIconBrightness |
243 | | - null, // systemNavigationBarDividerColor |
244 | | - null); // systemNavigationBarContrastEnforced |
245 | | - |
246 | | - platformPlugin.mPlatformMessageHandler.setSystemUiOverlayStyle(style); |
247 | | - |
248 | | - verify(fakeWindowInsetsController) |
249 | | - .setSystemBarsAppearance(0, APPEARANCE_LIGHT_NAVIGATION_BARS); |
250 | | - |
251 | | - style = |
252 | | - new SystemChromeStyle( |
253 | | - null, // statusBarColor |
254 | | - null, // statusBarIconBrightness |
255 | | - null, // systemStatusBarContrastEnforced |
256 | | - null, // systemNavigationBarColor |
257 | | - Brightness.DARK, // systemNavigationBarIconBrightness |
258 | | - null, // systemNavigationBarDividerColor |
259 | | - null); // systemNavigationBarContrastEnforced |
260 | | - |
261 | | - platformPlugin.mPlatformMessageHandler.setSystemUiOverlayStyle(style); |
262 | | - |
263 | | - verify(fakeWindowInsetsController) |
264 | | - .setSystemBarsAppearance( |
265 | | - APPEARANCE_LIGHT_NAVIGATION_BARS, APPEARANCE_LIGHT_NAVIGATION_BARS); |
266 | | - } |
267 | | - } |
268 | | - |
269 | | - @Config(sdk = 30) |
270 | | - @Test |
271 | | - public void setStatusBarIconBrightness() { |
272 | | - if (Build.VERSION.SDK_INT >= 30) { |
273 | | - View fakeDecorView = mock(View.class); |
274 | | - WindowInsetsController fakeWindowInsetsController = mock(WindowInsetsController.class); |
275 | | - Window fakeWindow = mock(Window.class); |
276 | | - when(fakeWindow.getDecorView()).thenReturn(fakeDecorView); |
277 | | - when(fakeWindow.getInsetsController()).thenReturn(fakeWindowInsetsController); |
278 | | - Activity fakeActivity = mock(Activity.class); |
279 | | - when(fakeActivity.getWindow()).thenReturn(fakeWindow); |
280 | | - PlatformChannel fakePlatformChannel = mock(PlatformChannel.class); |
281 | | - PlatformPlugin platformPlugin = new PlatformPlugin(fakeActivity, fakePlatformChannel); |
282 | | - |
283 | | - SystemChromeStyle style = |
284 | | - new SystemChromeStyle( |
285 | | - null, // statusBarColor |
286 | | - Brightness.LIGHT, // statusBarIconBrightness |
287 | | - null, // systemStatusBarContrastEnforced |
288 | | - null, // systemNavigationBarColor |
289 | | - null, // systemNavigationBarIconBrightness |
290 | | - null, // systemNavigationBarDividerColor |
291 | | - null); // systemNavigationBarContrastEnforced |
292 | | - |
293 | | - platformPlugin.mPlatformMessageHandler.setSystemUiOverlayStyle(style); |
294 | | - |
295 | | - verify(fakeWindowInsetsController).setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS); |
296 | | - |
297 | | - style = |
298 | | - new SystemChromeStyle( |
299 | | - null, // statusBarColor |
300 | | - Brightness.DARK, // statusBarIconBrightness |
301 | | - null, // systemStatusBarContrastEnforced |
302 | | - null, // systemNavigationBarColor |
303 | | - null, // systemNavigationBarIconBrightness |
304 | | - null, // systemNavigationBarDividerColor |
305 | | - null); // systemNavigationBarContrastEnforced |
306 | | - |
307 | | - platformPlugin.mPlatformMessageHandler.setSystemUiOverlayStyle(style); |
308 | | - |
309 | | - verify(fakeWindowInsetsController) |
310 | | - .setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS); |
311 | | - } |
312 | | - } |
313 | | - |
314 | 219 | @Config(sdk = 29) |
315 | 220 | @Test |
316 | 221 | public void setSystemUiMode() { |
|
0 commit comments