use of android.support.design.testapp.custom.TestFloatingBehavior in project material-components-android by material-components.
the class CoordinatorSnackbarWithFabTest method testBehaviorBasedSlidingFromRuntimeApiCall.
@Test
public void testBehaviorBasedSlidingFromRuntimeApiCall() {
// Use a layout in which an AppCompatTextView child doesn't have any configured Behavior
onView(withId(R.id.coordinator_stub)).perform(inflateViewStub(R.layout.design_snackbar_behavior_runtime));
// and configure that Behavior at runtime by setting it on its LayoutParams
final AppCompatTextView textView = (AppCompatTextView) mCoordinatorLayout.findViewById(R.id.text);
final CoordinatorLayout.LayoutParams textViewLp = (CoordinatorLayout.LayoutParams) textView.getLayoutParams();
textViewLp.setBehavior(new TestFloatingBehavior());
// Create and show a snackbar
mSnackbar = Snackbar.make(mCoordinatorLayout, MESSAGE_TEXT, Snackbar.LENGTH_INDEFINITE).setAction(ACTION_TEXT, mock(View.OnClickListener.class));
SnackbarUtils.showTransientBottomBarAndWaitUntilFullyShown(mSnackbar);
verifySnackbarViewStacking(textView, 0);
}
Aggregations