use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowSoundPoolTest method shouldCreateSoundPool_JellyBean.
@Test
@Config(maxSdk = JELLY_BEAN_MR2)
public void shouldCreateSoundPool_JellyBean() {
SoundPool soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
assertThat(soundPool).isNotNull();
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowRelativeLayoutTest method getRules_shouldShowAddRuleData_uptoApiLevel16.
@Test
@Config(maxSdk = JELLY_BEAN)
public void getRules_shouldShowAddRuleData_uptoApiLevel16() throws Exception {
ImageView imageView = new ImageView(RuntimeEnvironment.application);
RelativeLayout layout = new RelativeLayout(RuntimeEnvironment.application);
layout.addView(imageView, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams.addRule(RelativeLayout.ALIGN_TOP, 1234);
int[] rules = layoutParams.getRules();
assertThat(rules).isEqualTo(new int[] { 0, 0, 0, 0, 0, 0, 1234, 0, 0, 0, 0, -1, 0, 0, 0, 0 });
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowResourcesTest method shouldLoadRawResources_supportsDrawableWithQualifiers.
@Test
@Config(qualifiers = "hdpi")
public void shouldLoadRawResources_supportsDrawableWithQualifiers() throws Exception {
InputStream resourceStream = resources.openRawResource(R.drawable.text_file_posing_as_image);
assertThat(resourceStream).isNotNull();
assertThat(TestUtil.readString(resourceStream)).isEqualTo("drawable-hdpi.png image\n");
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowTelecomManagerTest method getPhoneAccountsForPackage.
@Test
@Config(minSdk = LOLLIPOP_MR1)
public void getPhoneAccountsForPackage() {
PhoneAccountHandle handleInThisApplicationsPackage = createHandle("id1");
telecomService.registerPhoneAccount(PhoneAccount.builder(handleInThisApplicationsPackage, "this_package").build());
PhoneAccountHandle anotherPackageHandle = createHandle("some.other.package", "id2");
telecomService.registerPhoneAccount(PhoneAccount.builder(anotherPackageHandle, "another_package").build());
List<PhoneAccountHandle> phoneAccountsForPackage = telecomService.getPhoneAccountsForPackage();
assertThat(phoneAccountsForPackage).contains(handleInThisApplicationsPackage);
assertThat(phoneAccountsForPackage).doesNotContain(anotherPackageHandle);
}
use of org.robolectric.annotation.Config in project robolectric by robolectric.
the class ShadowTelephonyManagerTest method shouldGiveAllCellInfo.
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void shouldGiveAllCellInfo() {
TelephonyManager telephonyManager = (TelephonyManager) application.getSystemService(TELEPHONY_SERVICE);
ShadowTelephonyManager shadowTelephonyManager = shadowOf(telephonyManager);
List<CellInfo> allCellInfo = new ArrayList<CellInfo>();
shadowTelephonyManager.setAllCellInfo(allCellInfo);
assertEquals(allCellInfo, telephonyManager.getAllCellInfo());
}
Aggregations