Search in sources :

Example 71 with TabHost

use of android.widget.TabHost in project robolectric by robolectric.

the class ShadowTabSpecTest method shouldGetAndSetTheIntentContent.

@Test
public void shouldGetAndSetTheIntentContent() {
    TabHost.TabSpec spec = new TabHost(context).newTabSpec("foo");
    Intent intent = new Intent();
    TabHost.TabSpec self = spec.setContent(intent);
    assertThat(self).isSameInstanceAs(spec);
    assertThat(shadowOf(spec).getContentAsIntent()).isSameInstanceAs(intent);
}
Also used : TabHost(android.widget.TabHost) Intent(android.content.Intent) Test(org.junit.Test)

Example 72 with TabHost

use of android.widget.TabHost in project robolectric by robolectric.

the class ShadowTabSpecTest method shouldGetAndSetTheIndicatorLabel.

@Test
public void shouldGetAndSetTheIndicatorLabel() {
    TabHost.TabSpec spec = new TabHost(context).newTabSpec("foo").setContent(R.layout.main).setIndicator("labelText");
    assertThat(shadowOf(spec).getIndicatorLabel()).isEqualTo("labelText");
    assertThat(shadowOf(spec).getText()).isEqualTo("labelText");
}
Also used : TabHost(android.widget.TabHost) Test(org.junit.Test)

Example 73 with TabHost

use of android.widget.TabHost in project robolectric by robolectric.

the class ShadowTabActivityTest method tabActivityShouldNotMakeNewTabHostEveryGet.

@Test
public void tabActivityShouldNotMakeNewTabHostEveryGet() {
    TabActivity activity = Robolectric.buildActivity(TabActivity.class).create().get();
    TabHost tabHost1 = activity.getTabHost();
    TabHost tabHost2 = activity.getTabHost();
    assertThat(tabHost1).isEqualTo(tabHost2);
}
Also used : TabActivity(android.app.TabActivity) TabHost(android.widget.TabHost) Test(org.junit.Test)

Example 74 with TabHost

use of android.widget.TabHost in project robolectric by robolectric.

the class ShadowTabHostTest method shouldFireTheTabChangeListenerWhenTheCurrentTabIsSetByTag.

@Test
public void shouldFireTheTabChangeListenerWhenTheCurrentTabIsSetByTag() {
    TabHost tabHost = new TabHost(context);
    TabHost.TabSpec foo = tabHost.newTabSpec("Foo");
    TabHost.TabSpec bar = tabHost.newTabSpec("Bar");
    TabHost.TabSpec baz = tabHost.newTabSpec("Baz");
    tabHost.addTab(foo);
    tabHost.addTab(bar);
    tabHost.addTab(baz);
    TestOnTabChangeListener listener = new TestOnTabChangeListener();
    tabHost.setOnTabChangedListener(listener);
    tabHost.setCurrentTabByTag("Bar");
    assertThat(listener.tag).isEqualTo("Bar");
}
Also used : TabHost(android.widget.TabHost) Test(org.junit.Test)

Aggregations

TabHost (android.widget.TabHost)74 View (android.view.View)29 Intent (android.content.Intent)21 ViewGroup (android.view.ViewGroup)19 ListView (android.widget.ListView)18 Test (org.junit.Test)17 TabWidget (android.widget.TabWidget)15 AdapterView (android.widget.AdapterView)13 AbsListView (android.widget.AbsListView)12 ExpandableListView (android.widget.ExpandableListView)12 TextView (android.widget.TextView)12 ActionMenuView (android.widget.ActionMenuView)10 ActionMenuItemView (com.android.internal.view.menu.ActionMenuItemView)10 IconMenuItemView (com.android.internal.view.menu.IconMenuItemView)10 ListMenuItemView (com.android.internal.view.menu.ListMenuItemView)10 MenuView (com.android.internal.view.menu.MenuView)10 FrameLayout (android.widget.FrameLayout)7 LinearLayout (android.widget.LinearLayout)7 AbsSpinner (android.widget.AbsSpinner)6 QuickContactBadge (android.widget.QuickContactBadge)6