5package io.flutter.util;
7import static org.junit.Assert.assertEquals;
8import static org.junit.Assert.assertFalse;
9import static org.junit.Assert.assertTrue;
10import static org.mockito.Mockito.mock;
11import static org.mockito.Mockito.when;
15import android.content.ContextWrapper;
18import androidx.test.ext.junit.runners.AndroidJUnit4;
20import org.junit.runner.RunWith;
21import org.robolectric.annotation.Config;
24@RunWith(AndroidJUnit4.class)
29 Context nonActivityContext = mock(Context.class);
32 Activity activity = mock(Activity.class);
35 ContextWrapper wrapper =
new ContextWrapper(
new ContextWrapper(activity));
41 final View rootView = mock(View.class);
42 when(rootView.hasFocus()).thenReturn(
true);
48 final View rootView = mock(View.class);
49 when(rootView.hasFocus()).thenReturn(
false);
60 final View childView = mock(View.class);
61 when(childView.hasFocus()).thenReturn(
true);
63 final ViewGroup rootView = mock(ViewGroup.class);
64 when(rootView.getChildCount()).thenReturn(1);
65 when(rootView.getChildAt(0)).thenReturn(childView);
72 final View childView = mock(View.class);
73 when(childView.hasFocus()).thenReturn(
false);
75 final ViewGroup rootView = mock(ViewGroup.class);
76 when(rootView.getChildCount()).thenReturn(1);
77 when(rootView.getChildAt(0)).thenReturn(childView);
void childHasFocus_childHasFocus()
void childHasFocus_childDoesNotHaveFocus()
void childHasFocus_rootDoesNotHaveFocus()
void childHasFocus_rootHasFocus()
void childHasFocus_rootIsNull()
static Activity getActivity(@Nullable Context context)
static boolean childHasFocus(@Nullable View root)