use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class DeviceSpecUtilsTest method deviceSpecFromTargetingBuilder_setDeviceTier.
@Test
public void deviceSpecFromTargetingBuilder_setDeviceTier() {
DeviceSpec deviceSpec = new DeviceSpecFromTargetingBuilder(DeviceSpec.getDefaultInstance()).setDeviceTier(deviceTierTargeting(/* value= */
2, /* alternatives= */
ImmutableList.of(1))).build();
assertThat(deviceSpec.getDeviceTier().getValue()).isEqualTo(2);
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class ModuleMatcherTest method matchesModuleTargeting_negative_wrongDeviceTier.
@Test
public void matchesModuleTargeting_negative_wrongDeviceTier() {
ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"), moduleDeviceGroupsTargeting("highRam"));
DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceGroups("lowRam"));
ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class ModuleMatcherTest method matchesModuleTargeting_negative_sdkTooLow.
@Test
public void matchesModuleTargeting_negative_sdkTooLow() {
ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"));
DeviceSpec deviceSpecLowSdk = mergeSpecs(deviceWithSdk(19), deviceFeatures("feature1", "feature2"));
ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpecLowSdk);
assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class ModuleMatcherTest method matchesModuleTargeting_negative_openGlVersionTooLow.
@Test
public void matchesModuleTargeting_negative_openGlVersionTooLow() {
ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting(CONDITIONAL_MODULES_OPEN_GL_NAME, 0x30001));
DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceFeatures("reqGlEsVersion=0x30000"));
ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
use of com.android.bundle.Devices.DeviceSpec in project bundletool by google.
the class ModuleMatcherTest method matchesModuleTargeting_positive.
@Test
public void matchesModuleTargeting_positive() {
ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"), moduleFeatureTargeting(CONDITIONAL_MODULES_OPEN_GL_NAME, 0x30001), moduleDeviceGroupsTargeting("highRam"));
DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceFeatures("feature1", "feature2", "reqGlEsVersion=0x30002"), deviceGroups("highRam"));
ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isTrue();
}
Aggregations