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);
}
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");
}
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);
}
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");
}
Aggregations