mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
Remove unnecessary looper calls in TextInputLayout's ViewActions.
Espresso does not need the uiController.loopMainThreadUntilIdle() calls, so I removed them. Verified that removing these calls didn't add flakiness by running them with --runs_per_test=100. PiperOrigin-RevId: 161989235
This commit is contained in:
parent
680e3c3a25
commit
10fa73def7
@ -41,17 +41,13 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setErrorEnabled(enabled);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static ViewAction setError(final CharSequence error) {
|
||||
public static ViewAction setError(final CharSequence errorText) {
|
||||
return new ViewAction() {
|
||||
@Override
|
||||
public Matcher<View> getConstraints() {
|
||||
@ -65,12 +61,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setError(error);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
layout.setError(errorText);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -89,12 +81,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setErrorTextAppearance(resId);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -113,12 +101,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setTypeface(typeface);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -137,12 +121,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setPasswordVisibilityToggleEnabled(enabled);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -161,12 +141,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setCounterEnabled(enabled);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -185,12 +161,8 @@ public class TextInputLayoutActions {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
|
||||
TextInputLayout layout = (TextInputLayout) view;
|
||||
layout.setCounterMaxLength(maxLength);
|
||||
|
||||
uiController.loopMainThreadUntilIdle();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -459,8 +459,7 @@ public class TextInputLayoutTest {
|
||||
|
||||
@Test
|
||||
public void testTextSetViaAttributeCollapsedHint() {
|
||||
onView(withId(R.id.textinput_with_text))
|
||||
.check(isHintExpanded(false));
|
||||
onView(withId(R.id.textinput_with_text)).check(isHintExpanded(false));
|
||||
}
|
||||
|
||||
private static ViewAssertion isHintExpanded(final boolean expanded) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user