Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
io.flutter.util.ViewUtilsTest Class Reference

Public Member Functions

void canGetActivity ()
 
void childHasFocus_rootHasFocus ()
 
void childHasFocus_rootDoesNotHaveFocus ()
 
void childHasFocus_rootIsNull ()
 
void childHasFocus_childHasFocus ()
 
void childHasFocus_childDoesNotHaveFocus ()
 

Detailed Description

Definition at line 25 of file ViewUtilsTest.java.

Member Function Documentation

◆ canGetActivity()

void io.flutter.util.ViewUtilsTest.canGetActivity ( )
inline

Definition at line 27 of file ViewUtilsTest.java.

27 {
28 // Non activity context returns null
29 Context nonActivityContext = mock(Context.class);
30 assertEquals(null, ViewUtils.getActivity(nonActivityContext));
31
32 Activity activity = mock(Activity.class);
33 assertEquals(activity, ViewUtils.getActivity(activity));
34
35 ContextWrapper wrapper = new ContextWrapper(new ContextWrapper(activity));
36 assertEquals(activity, ViewUtils.getActivity(wrapper));
37 }

◆ childHasFocus_childDoesNotHaveFocus()

void io.flutter.util.ViewUtilsTest.childHasFocus_childDoesNotHaveFocus ( )
inline

Definition at line 71 of file ViewUtilsTest.java.

71 {
72 final View childView = mock(View.class);
73 when(childView.hasFocus()).thenReturn(false);
74
75 final ViewGroup rootView = mock(ViewGroup.class);
76 when(rootView.getChildCount()).thenReturn(1);
77 when(rootView.getChildAt(0)).thenReturn(childView);
78
79 assertFalse(ViewUtils.childHasFocus(rootView));
80 }

◆ childHasFocus_childHasFocus()

void io.flutter.util.ViewUtilsTest.childHasFocus_childHasFocus ( )
inline

Definition at line 59 of file ViewUtilsTest.java.

59 {
60 final View childView = mock(View.class);
61 when(childView.hasFocus()).thenReturn(true);
62
63 final ViewGroup rootView = mock(ViewGroup.class);
64 when(rootView.getChildCount()).thenReturn(1);
65 when(rootView.getChildAt(0)).thenReturn(childView);
66
67 assertTrue(ViewUtils.childHasFocus(rootView));
68 }

◆ childHasFocus_rootDoesNotHaveFocus()

void io.flutter.util.ViewUtilsTest.childHasFocus_rootDoesNotHaveFocus ( )
inline

Definition at line 47 of file ViewUtilsTest.java.

47 {
48 final View rootView = mock(View.class);
49 when(rootView.hasFocus()).thenReturn(false);
50 assertFalse(ViewUtils.childHasFocus(rootView));
51 }

◆ childHasFocus_rootHasFocus()

void io.flutter.util.ViewUtilsTest.childHasFocus_rootHasFocus ( )
inline

Definition at line 40 of file ViewUtilsTest.java.

40 {
41 final View rootView = mock(View.class);
42 when(rootView.hasFocus()).thenReturn(true);
43 assertTrue(ViewUtils.childHasFocus(rootView));
44 }

◆ childHasFocus_rootIsNull()

void io.flutter.util.ViewUtilsTest.childHasFocus_rootIsNull ( )
inline

Definition at line 54 of file ViewUtilsTest.java.

54 {
55 assertFalse(ViewUtils.childHasFocus(null));
56 }

The documentation for this class was generated from the following file: