Make Settings robotest work with tot Robolectric
Bug: 116278591 Test: make -j RunSettingsRoboTests Change-Id: I32cb2fcf6094675f79d2fc24702ef6298a9691e4
This commit is contained in:
@@ -40,6 +40,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settingslib.drawer.CategoryKey;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.testutils.DrawableTestHelper;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -67,8 +68,8 @@ public class RoundedHomepageIconTest {
|
||||
new RoundedHomepageIcon(mContext, new ColorDrawable(Color.BLACK));
|
||||
|
||||
assertThat(icon.getNumberOfLayers()).isEqualTo(2);
|
||||
assertThat(icon.getDrawable(0))
|
||||
.isEqualTo(mContext.getDrawable(R.drawable.ic_homepage_generic_background));
|
||||
DrawableTestHelper.assertDrawableResId(icon.getDrawable(0),
|
||||
R.drawable.ic_homepage_generic_background);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -60,11 +60,10 @@ public class SwitchBarTest {
|
||||
|
||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||
.isEqualTo(mContext.getString(defaultOffText));
|
||||
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND));
|
||||
|
||||
mBar.setChecked(true);
|
||||
|
||||
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND_ACTIVATED));
|
||||
assertThat(mBar.getBackground()).isInstanceOf(ColorDrawable.class);
|
||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||
.isEqualTo(mContext.getString(defaultOnText));
|
||||
}
|
||||
@@ -75,12 +74,12 @@ public class SwitchBarTest {
|
||||
final int offText = R.string.manage_space_text;
|
||||
|
||||
mBar.setSwitchBarText(onText, offText);
|
||||
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND));
|
||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||
.isEqualTo(mContext.getString(offText));
|
||||
|
||||
mBar.setChecked(true);
|
||||
assertThat(mBar.getBackground()).isEqualTo(new ColorDrawable(COLOR_BACKGROUND_ACTIVATED));
|
||||
assertThat(mBar.getBackground()).isInstanceOf(ColorDrawable.class);
|
||||
|
||||
assertThat(((TextView) mBar.findViewById(R.id.switch_text)).getText())
|
||||
.isEqualTo(mContext.getString(onText));
|
||||
}
|
||||
|
Reference in New Issue
Block a user