Search in sources :

Example 1 with FlakyTest

use of android.support.test.filters.FlakyTest 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));
}
Also used : FlexboxLayout(com.google.android.flexbox.FlexboxLayout) MainActivity(com.google.android.apps.flexbox.MainActivity) FlakyTest(android.support.test.filters.FlakyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Example 2 with FlakyTest

use of android.support.test.filters.FlakyTest 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));
}
Also used : FlexboxLayout(com.google.android.flexbox.FlexboxLayout) TextView(android.widget.TextView) MainActivity(com.google.android.apps.flexbox.MainActivity) FlakyTest(android.support.test.filters.FlakyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Example 3 with FlakyTest

use of android.support.test.filters.FlakyTest 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()));
}
Also used : FlexboxLayout(com.google.android.flexbox.FlexboxLayout) TextView(android.widget.TextView) MainActivity(com.google.android.apps.flexbox.MainActivity) FlakyTest(android.support.test.filters.FlakyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Example 4 with FlakyTest

use of android.support.test.filters.FlakyTest 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));
}
Also used : FlexboxLayout(com.google.android.flexbox.FlexboxLayout) MainActivity(com.google.android.apps.flexbox.MainActivity) FlakyTest(android.support.test.filters.FlakyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Example 5 with FlakyTest

use of android.support.test.filters.FlakyTest 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"));
}
Also used : FlexboxLayout(com.google.android.flexbox.FlexboxLayout) TextView(android.widget.TextView) MainActivity(com.google.android.apps.flexbox.MainActivity) FlakyTest(android.support.test.filters.FlakyTest) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test)

Aggregations

FlakyTest (android.support.test.filters.FlakyTest)165 Test (org.junit.Test)162 MediumTest (android.support.test.filters.MediumTest)145 FlexboxLayout (com.google.android.flexbox.FlexboxLayout)140 TextView (android.widget.TextView)112 Drawable (android.graphics.drawable.Drawable)19 Ignore (org.junit.Ignore)15 Intent (android.content.Intent)12 TelephonyTest (com.android.internal.telephony.TelephonyTest)12 MainActivity (com.google.android.apps.flexbox.MainActivity)12 SmallTest (android.test.suitebuilder.annotation.SmallTest)11 Message (android.os.Message)8 AsyncResult (android.os.AsyncResult)5 NavigationView (android.support.design.widget.NavigationView)5 MediumTest (android.test.suitebuilder.annotation.MediumTest)5 Pair (android.util.Pair)5 Menu (android.view.Menu)5 ArrayAdapter (android.widget.ArrayAdapter)5 Spinner (android.widget.Spinner)5 HashSet (java.util.HashSet)5