use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceFeatureMatcherTest method deviceFeaturePresent_match.
@Test
public void deviceFeaturePresent_match() {
DeviceSpec deviceSpec = deviceFeatures("com.software.soft.feature1", "com.hardware.cool.feature", "com.hardware.even.cooler.feature");
DeviceFeatureMatcher matcher = new DeviceFeatureMatcher(deviceSpec);
assertThat(matcher.matchesTargeting(deviceFeatureTargetingList("com.hardware.cool.feature"))).isTrue();
assertThat(matcher.matchesTargeting(deviceFeatureTargetingList("com.software.soft.feature1", "com.hardware.even.cooler.feature"))).isTrue();
assertThat(matcher.matchesTargeting(ImmutableList.of())).isTrue();
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceFeatureMatcherTest method skipOpenGlFeature.
@Test
public void skipOpenGlFeature() {
DeviceSpec deviceSpec = deviceFeatures("com.hardware.cool.feature");
DeviceFeatureMatcher matcher = new DeviceFeatureMatcher(deviceSpec);
ImmutableList<DeviceFeatureTargeting> deviceFeatureTargetings = ImmutableList.of(deviceFeatureTargeting(OpenGlFeatureMatcher.CONDITIONAL_MODULES_OPEN_GL_NAME, 0x30000), deviceFeatureTargeting("com.hardware.cool.feature"));
assertThat(matcher.matchesTargeting(deviceFeatureTargetings)).isTrue();
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceSpecParserTest method parsePartialDeviceSpec_acceptZeroSdk.
@Test
public void parsePartialDeviceSpec_acceptZeroSdk() throws Exception {
DeviceSpec deviceSpec = DeviceSpecParser.parsePartialDeviceSpec(TestData.openReader("testdata/device/invalid_spec_sdk_zero.json"));
assertThat(deviceSpec.getSupportedAbisList()).containsExactly("armeabi-v7a");
assertThat(deviceSpec.getScreenDensity()).isEqualTo(411);
assertThat(deviceSpec.getSdkVersion()).isEqualTo(0);
assertThat(deviceSpec.getSupportedLocalesList()).containsExactly("en-US", "es-US");
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceSpecParserTest method parsePartialDeviceSpec_acceptEmptyAbi.
@Test
public void parsePartialDeviceSpec_acceptEmptyAbi() throws Exception {
DeviceSpec deviceSpec = DeviceSpecParser.parsePartialDeviceSpec(TestData.openReader("testdata/device/invalid_spec_abi_empty.json"));
assertThat(deviceSpec.getSupportedAbisList()).isEmpty();
assertThat(deviceSpec.getScreenDensity()).isEqualTo(411);
assertThat(deviceSpec.getSdkVersion()).isEqualTo(1);
assertThat(deviceSpec.getSupportedLocalesList()).containsExactly("en-US", "es-US");
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceSpecUtilsTest method getDeviceSupportedTextureCompressionFormats.
@Test
public void getDeviceSupportedTextureCompressionFormats() {
DeviceSpec deviceSpec = new DeviceSpecFromTargetingBuilder(DeviceSpec.getDefaultInstance()).setSupportedTextureCompressionFormats(textureCompressionTargeting(/* values= */
ImmutableSet.of(TextureCompressionFormatAlias.ETC2, TextureCompressionFormatAlias.ASTC), /* alternatives= */
ImmutableSet.of())).build();
assertThat(DeviceSpecUtils.getDeviceSupportedTextureCompressionFormats(deviceSpec)).containsExactly(TextureCompressionFormatAlias.ETC2, TextureCompressionFormatAlias.ASTC);
}
Aggregations