use of android.support.test.filters.FlakyTest in project flexbox-layout by google.
the class FlexboxAndroidTest method testJustifyContent_spaceBetween.
@Test
@FlakyTest
public void testJustifyContent_spaceBetween() throws Throwable {
final FlexboxTestActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = createFlexboxLayout(R.layout.activity_justify_content_test, new Configuration() {
@Override
public void apply(FlexboxLayout flexboxLayout) {
flexboxLayout.setJustifyContent(FlexboxLayout.JUSTIFY_CONTENT_SPACE_BETWEEN);
}
});
assertThat(flexboxLayout.getJustifyContent(), is(FlexboxLayout.JUSTIFY_CONTENT_SPACE_BETWEEN));
onView(withId(R.id.text1)).check(isTopAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text1)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text2)).check(isTopAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text3)).check(isTopAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text3)).check(isRightAlignedWith(withId(R.id.flexbox_layout)));
TextView textView1 = (TextView) activity.findViewById(R.id.text1);
TextView textView2 = (TextView) activity.findViewById(R.id.text2);
TextView textView3 = (TextView) activity.findViewById(R.id.text3);
int space = flexboxLayout.getWidth() - textView1.getWidth() - textView2.getWidth() - textView3.getWidth();
space = space / 2;
assertThat(textView2.getLeft() - textView1.getRight(), isEqualAllowingError(space));
assertThat(textView3.getLeft() - textView2.getRight(), isEqualAllowingError(space));
}
use of android.support.test.filters.FlakyTest in project flexbox-layout by google.
the class FlexboxAndroidTest method testFlexDirection_column_reverse.
@Test
@FlakyTest
public void testFlexDirection_column_reverse() throws Throwable {
FlexboxLayout flexboxLayout = createFlexboxLayout(R.layout.activity_flex_wrap_test, new Configuration() {
@Override
public void apply(FlexboxLayout flexboxLayout) {
flexboxLayout.setFlexDirection(FlexboxLayout.FLEX_DIRECTION_COLUMN_REVERSE);
}
});
assertThat(flexboxLayout.getFlexDirection(), is(FlexboxLayout.FLEX_DIRECTION_COLUMN_REVERSE));
onView(withId(R.id.text1)).check(isBottomAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text1)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text2)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text2)).check(isAbove(withId(R.id.text1)));
onView(withId(R.id.text3)).check(isRightOf(withId(R.id.text1)));
onView(withId(R.id.text3)).check(isRightOf(withId(R.id.text2)));
onView(withId(R.id.text3)).check(isBottomAlignedWith(withId(R.id.flexbox_layout)));
}
use of android.support.test.filters.FlakyTest in project flexbox-layout by google.
the class FlexboxAndroidTest method testDivider_directionRow_verticalBeginning.
@Test
@FlakyTest
public void testDivider_directionRow_verticalBeginning() throws Throwable {
final FlexboxTestActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = createFlexboxLayout(R.layout.activity_divider_test_direction_row);
assertThat(flexboxLayout.getFlexWrap(), is(FlexboxLayout.FLEX_WRAP_WRAP));
assertThat(flexboxLayout.getFlexDirection(), is(FlexboxLayout.FLEX_DIRECTION_ROW));
assertThat(flexboxLayout.getShowDividerVertical(), is(FlexboxLayout.SHOW_DIVIDER_BEGINNING));
TextView text1 = (TextView) activity.findViewById(R.id.text1);
TextView text2 = (TextView) activity.findViewById(R.id.text2);
TextView text3 = (TextView) activity.findViewById(R.id.text3);
Drawable divider = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.divider, null);
assertNotNull(divider);
int widthSumFirstRow = text1.getWidth() + text2.getWidth() + text3.getWidth() + divider.getIntrinsicWidth();
assertThat(text3.getRight(), is(widthSumFirstRow));
assertThat(text1.getLeft(), is(not(flexboxLayout.getLeft())));
}
use of android.support.test.filters.FlakyTest in project flexbox-layout by google.
the class FlexboxAndroidTest method testDivider_directionColumn_horizontalMiddle.
@Test
@FlakyTest
public void testDivider_directionColumn_horizontalMiddle() throws Throwable {
final FlexboxTestActivity activity = mActivityRule.getActivity();
FlexboxLayout flexboxLayout = createFlexboxLayout(R.layout.activity_divider_test_direction_column, new Configuration() {
@Override
public void apply(FlexboxLayout flexboxLayout) {
flexboxLayout.setShowDividerHorizontal(FlexboxLayout.SHOW_DIVIDER_MIDDLE);
}
});
assertThat(flexboxLayout.getFlexWrap(), is(FlexboxLayout.FLEX_WRAP_WRAP));
assertThat(flexboxLayout.getFlexDirection(), is(FlexboxLayout.FLEX_DIRECTION_COLUMN));
assertThat(flexboxLayout.getShowDividerHorizontal(), is(FlexboxLayout.SHOW_DIVIDER_MIDDLE));
TextView text1 = (TextView) activity.findViewById(R.id.text1);
TextView text2 = (TextView) activity.findViewById(R.id.text2);
TextView text3 = (TextView) activity.findViewById(R.id.text3);
Drawable divider = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.divider, null);
assertNotNull(divider);
int heightSumFirstRow = text1.getHeight() + text2.getHeight() + text3.getHeight() + divider.getIntrinsicHeight() * 2;
assertThat(text3.getBottom(), is(heightSumFirstRow));
assertThat(text1.getTop(), is(flexboxLayout.getTop()));
}
use of android.support.test.filters.FlakyTest in project flexbox-layout by google.
the class FlexboxAndroidTest method testAlignContent_spaceBetween_withPadding.
@Test
@FlakyTest
public void testAlignContent_spaceBetween_withPadding() throws Throwable {
FlexboxLayout flexboxLayout = createFlexboxLayout(R.layout.activity_align_content_test, new Configuration() {
@Override
public void apply(FlexboxLayout flexboxLayout) {
flexboxLayout.setAlignContent(FlexboxLayout.ALIGN_CONTENT_SPACE_BETWEEN);
}
});
assertThat(flexboxLayout.getAlignContent(), is(FlexboxLayout.ALIGN_CONTENT_SPACE_BETWEEN));
onView(withId(R.id.text1)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text1)).check(isTopAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text2)).check(isRightOf(withId(R.id.text1)));
onView(withId(R.id.text2)).check(isTopAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text3)).check(isBottomAlignedWith(withId(R.id.flexbox_layout)));
onView(withId(R.id.text3)).check(isLeftAlignedWith(withId(R.id.flexbox_layout)));
}
Aggregations