use of com.android.tools.idea.testing.TestMessagesDialog in project android by JetBrains.
the class GradleDependencyManagerTest method ignore_testDependencyAarIsExplodedForLayoutLib.
@SuppressWarnings("unused")
public void ignore_testDependencyAarIsExplodedForLayoutLib() throws Exception {
loadSimpleApplication();
List<GradleCoordinate> dependencies = Collections.singletonList(RECYCLER_VIEW_DEPENDENCY);
GradleDependencyManager dependencyManager = GradleDependencyManager.getInstance(getProject());
assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isNotEmpty();
Messages.setTestDialog(new TestMessagesDialog(Messages.OK));
boolean found = dependencyManager.ensureLibraryIsIncluded(myModules.getAppModule(), dependencies, null);
assertThat(found).isTrue();
List<ResourceItem> items = AppResourceRepository.getAppResources(myAndroidFacet, true).getResourceItem(ResourceType.DECLARE_STYLEABLE, "RecyclerView");
assertThat(items).isNotEmpty();
assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isEmpty();
}
use of com.android.tools.idea.testing.TestMessagesDialog in project android by JetBrains.
the class ForcedPluginPreviewVersionUpgradeStepIdeaTest method testCheckAndPerformUpgradeWhenUserDeclinesUpgrade.
// See https://code.google.com/p/android/issues/detail?id=227927
public void testCheckAndPerformUpgradeWhenUserDeclinesUpgrade() {
GradleVersion latestPluginVersion = GradleVersion.parse("2.0.0");
when(myPluginGeneration.getLatestKnownVersion()).thenReturn(latestPluginVersion.toString());
when(myPluginInfo.getPluginVersion()).thenReturn(GradleVersion.parse("2.0.0-alpha9"));
// Simulate user canceling upgrade.
myOriginalTestDialog = ForcedPluginPreviewVersionUpgradeDialog.setTestDialog(new TestMessagesDialog(Messages.CANCEL));
boolean upgraded = myVersionUpgrade.checkAndPerformUpgrade(getProject(), myPluginInfo);
assertTrue(upgraded);
List<SyncMessage> messages = mySyncMessages.getReportedMessages();
assertThat(messages).hasSize(1);
String message = messages.get(0).getText()[1];
assertThat(message).contains("Please update your project to use version 2.0.0.");
verify(mySyncState).syncEnded();
verify(myVersionUpdater, never()).updatePluginVersionAndSync(latestPluginVersion, GradleVersion.parse(GRADLE_LATEST_VERSION), true);
}
use of com.android.tools.idea.testing.TestMessagesDialog in project android by JetBrains.
the class GradleDependencyManagerTest method testDependencyCanBeCancelledByUser.
public void testDependencyCanBeCancelledByUser() throws Exception {
loadSimpleApplication();
List<GradleCoordinate> dependencies = Collections.singletonList(RECYCLER_VIEW_DEPENDENCY);
GradleDependencyManager dependencyManager = GradleDependencyManager.getInstance(getProject());
assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isNotEmpty();
Messages.setTestDialog(new TestMessagesDialog(Messages.NO));
boolean found = dependencyManager.ensureLibraryIsIncluded(myModules.getAppModule(), dependencies, null);
assertThat(found).isFalse();
assertThat(dependencyManager.findMissingDependencies(myModules.getAppModule(), dependencies)).isNotEmpty();
}
use of com.android.tools.idea.testing.TestMessagesDialog in project android by JetBrains.
the class GradleDistributionCleanUpTaskTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
myTestDialog = new TestMessagesDialog(Messages.OK);
Messages.setTestDialog(myTestDialog);
myCleanUpTask = new GradleDistributionCleanUpTask();
}
use of com.android.tools.idea.testing.TestMessagesDialog in project android by JetBrains.
the class ForcedPluginPreviewVersionUpgradeStepIdeaTest method testCheckAndPerformUpgradeWhenUserAcceptsUpgrade.
public void testCheckAndPerformUpgradeWhenUserAcceptsUpgrade() {
GradleVersion latestPluginVersion = GradleVersion.parse("2.0.0");
when(myPluginGeneration.getLatestKnownVersion()).thenReturn(latestPluginVersion.toString());
when(myPluginInfo.getPluginVersion()).thenReturn(GradleVersion.parse("2.0.0-alpha9"));
// Simulate user accepting the upgrade.
myOriginalTestDialog = ForcedPluginPreviewVersionUpgradeDialog.setTestDialog(new TestMessagesDialog(OK));
boolean upgraded = myVersionUpgrade.checkAndPerformUpgrade(getProject(), myPluginInfo);
assertTrue(upgraded);
verify(mySyncState).syncEnded();
verify(myVersionUpdater).updatePluginVersionAndSync(latestPluginVersion, GradleVersion.parse(GRADLE_LATEST_VERSION), true);
assertThat(mySyncMessages.getReportedMessages()).isEmpty();
}
Aggregations