use of com.android.tools.idea.gradle.dsl.model.android.splits.DensityModel in project android by JetBrains.
the class SplitsModelTest method testEditElements.
public void testEditElements() throws Exception {
writeToBuildFile(SPLITS_TEXT);
verifySplitsValues();
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
SplitsModel splits = android.splits();
AbiModel abi = splits.abi();
abi.setEnable(false);
abi.replaceExclude("abi-exclude-2", "abi-exclude-3");
abi.replaceInclude("abi-include-2", "abi-include-3");
abi.setUniversalApk(true);
DensityModel density = splits.density();
density.setAuto(true);
density.replaceCompatibleScreen("screen2", "screen3");
density.setEnable(false);
density.replaceExclude("density-exclude-2", "density-exclude-3");
density.replaceInclude("density-include-2", "density-include-3");
LanguageModel language = splits.language();
language.setEnable(true);
language.replaceInclude("language-include-2", "language-include-3");
applyChangesAndReparse(buildModel);
android = buildModel.android();
assertNotNull(android);
splits = android.splits();
abi = splits.abi();
assertEquals("enable", Boolean.FALSE, abi.enable());
assertEquals("exclude", ImmutableList.of("abi-exclude-1", "abi-exclude-3"), abi.exclude());
assertEquals("include", ImmutableList.of("abi-include-1", "abi-include-3"), abi.include());
assertEquals("universalApk", Boolean.TRUE, abi.universalApk());
density = splits.density();
assertEquals("auto", Boolean.TRUE, density.auto());
assertEquals("compatibleScreens", ImmutableList.of("screen1", "screen3"), density.compatibleScreens());
assertEquals("enable", Boolean.FALSE, density.enable());
assertEquals("exclude", ImmutableList.of("density-exclude-1", "density-exclude-3"), density.exclude());
assertEquals("include", ImmutableList.of("density-include-1", "density-include-3"), density.include());
language = splits.language();
assertEquals("enable", Boolean.TRUE, language.enable());
assertEquals("include", ImmutableList.of("language-include-1", "language-include-3"), language.include());
}
use of com.android.tools.idea.gradle.dsl.model.android.splits.DensityModel in project android by JetBrains.
the class SplitsModel method density.
@NotNull
public DensityModel density() {
DensityDslElement densityDslElement = myDslElement.getPropertyElement(DENSITY_BLOCK_NAME, DensityDslElement.class);
if (densityDslElement == null) {
densityDslElement = new DensityDslElement(myDslElement);
myDslElement.setNewElement(DENSITY_BLOCK_NAME, densityDslElement);
}
return new DensityModel(densityDslElement);
}
use of com.android.tools.idea.gradle.dsl.model.android.splits.DensityModel in project android by JetBrains.
the class SplitsModelTest method testRemoveElements.
public void testRemoveElements() throws Exception {
writeToBuildFile(SPLITS_TEXT);
verifySplitsValues();
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
SplitsModel splits = android.splits();
assertTrue(splits.hasValidPsiElement());
AbiModel abi = splits.abi();
assertTrue(abi.hasValidPsiElement());
abi.removeEnable();
abi.removeAllExclude();
abi.removeAllInclude();
abi.removeUniversalApk();
DensityModel density = splits.density();
assertTrue(density.hasValidPsiElement());
density.removeAuto();
density.removeAllCompatibleScreens();
density.removeEnable();
density.removeAllExclude();
density.removeAllInclude();
LanguageModel language = splits.language();
assertTrue(language.hasValidPsiElement());
language.removeEnable();
language.removeAllInclude();
applyChangesAndReparse(buildModel);
verifyNullSplitsValues();
android = buildModel.android();
assertNotNull(android);
splits = android.splits();
assertFalse(splits.hasValidPsiElement());
}
Aggregations