use of com.google.android.apps.flexbox.MainActivity in project flexbox-layout by google.
the class MainActivityTest method testAddFlexItem.
@Test
@FlakyTest
public void testAddFlexItem() {
MainActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
assertNotNull(flexboxLayout);
int beforeCount = flexboxLayout.getChildCount();
onView(withId(R.id.add_fab)).perform(click());
assertThat(flexboxLayout.getChildCount(), is(beforeCount + 1));
}
use of com.google.android.apps.flexbox.MainActivity in project flexbox-layout by google.
the class MainActivityTest method testEditFragment_changeFlexBasisPercent.
@Test
@FlakyTest
public void testEditFragment_changeFlexBasisPercent() {
MainActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
assertNotNull(flexboxLayout);
onView(withId(R.id.textview1)).perform(click());
onView(withId(R.id.edit_text_flex_basis_percent)).perform(replaceText("50"), closeSoftKeyboard());
onView(withId(R.id.button_ok)).perform(click());
TextView first = (TextView) activity.findViewById(R.id.textview1);
TextView second = (TextView) activity.findViewById(R.id.textview2);
TextView third = (TextView) activity.findViewById(R.id.textview3);
assertNotNull(first);
assertNotNull(second);
assertNotNull(third);
assertThat(first.getWidth(), is(flexboxLayout.getWidth() / 2));
}
use of com.google.android.apps.flexbox.MainActivity in project flexbox-layout by google.
the class MainActivityTest method testEditFragment_changeFlexGrowFloat.
@Test
@FlakyTest
public void testEditFragment_changeFlexGrowFloat() {
MainActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
assertNotNull(flexboxLayout);
onView(withId(R.id.textview1)).perform(click());
onView(withId(R.id.edit_text_flex_grow)).perform(replaceText("1.0"), closeSoftKeyboard());
onView(withId(R.id.button_ok)).perform(click());
TextView first = (TextView) activity.findViewById(R.id.textview1);
TextView second = (TextView) activity.findViewById(R.id.textview2);
TextView third = (TextView) activity.findViewById(R.id.textview3);
assertNotNull(first);
assertNotNull(second);
assertNotNull(third);
assertThat(first.getWidth(), is(flexboxLayout.getWidth() - second.getWidth() - third.getWidth()));
}
use of com.google.android.apps.flexbox.MainActivity in project flexbox-layout by google.
the class MainActivityTest method testConfigurationChange.
@Test
@FlakyTest
public void testConfigurationChange() {
MainActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
assertNotNull(flexboxLayout);
onView(withId(R.id.add_fab)).perform(click());
onView(withId(R.id.add_fab)).perform(click());
int beforeCount = flexboxLayout.getChildCount();
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
// Verify the flex items are restored across the configuration change.
assertThat(flexboxLayout.getChildCount(), is(beforeCount));
}
use of com.google.android.apps.flexbox.MainActivity in project flexbox-layout by google.
the class MainActivityTest method testEditFragment_changeOrder.
@Test
@FlakyTest
public void testEditFragment_changeOrder() {
MainActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = (FlexboxLayout) activity.findViewById(R.id.flexbox_layout);
assertNotNull(flexboxLayout);
onView(withId(R.id.textview1)).perform(click());
onView(withId(R.id.edit_text_order)).perform(replaceText("3"), closeSoftKeyboard());
onView(withId(R.id.button_ok)).perform(click());
TextView first = (TextView) flexboxLayout.getReorderedChildAt(0);
TextView second = (TextView) flexboxLayout.getReorderedChildAt(1);
TextView third = (TextView) flexboxLayout.getReorderedChildAt(2);
assertThat(first.getText().toString(), is("2"));
assertThat(second.getText().toString(), is("3"));
assertThat(third.getText().toString(), is("1"));
}
Aggregations