Search in sources :

Example 11 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class IdeaWizardAdapterTest method canFinish.

@Test
public void canFinish() {
    AbstractWizard host = new DummyHost("None", null);
    DummyModel model = new DummyModel();
    DummyStep step1 = new DummyStep(model, "");
    ModelWizard guest = new ModelWizard.Builder(step1).build();
    IdeaWizardAdapter adaptor = new IdeaWizardAdapter(host, guest);
    ourInvokeStrategy.updateAllSteps();
    assertThat(guest.onLastStep().get()).isTrue();
    try {
        adaptor.doFinishAction();
    } catch (IllegalStateException e) {
        // TODO: can't mock out the close method on DialogWrapper as it is final, so this exception is generated. Is there a better way
        // to handle this?
        assertThat(e.getStackTrace()[0].getMethodName()).contains("ensureEventDispatchThread");
    }
    ourInvokeStrategy.updateAllSteps();
    assertThat(guest.isFinished()).isTrue();
    assertThat(model.isFinished).isTrue();
    Disposer.dispose(adaptor);
}
Also used : AbstractWizard(com.intellij.ide.wizard.AbstractWizard) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard)

Example 12 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class IdeaWizardAdapterTest method updatesButtonsOnNavigation.

@Test
public void updatesButtonsOnNavigation() {
    DummyHost host = new DummyHost("None", null);
    DummyStep step1 = new DummyStep(new DummyModel(), "");
    DummyStep step2 = new DummyStep(new DummyModel(), "");
    DummyStep step3 = new DummyStep(new DummyModel(), "");
    ModelWizard guest = new ModelWizard.Builder(step1, step2, step3).build();
    IdeaWizardAdapter adaptor = new IdeaWizardAdapter(host, guest);
    ourInvokeStrategy.updateAllSteps();
    assertThat(host.updateButtonsCalled).isTrue();
    assertThat(host.canGoNextValue).isTrue();
    assertThat(host.firstStepValue).isTrue();
    assertThat(host.lastStepValue).isFalse();
    host.Reset();
    adaptor.doNextAction();
    ourInvokeStrategy.updateAllSteps();
    assertThat(host.updateButtonsCalled).isTrue();
    assertThat(host.canGoNextValue).isTrue();
    assertThat(host.firstStepValue).isFalse();
    assertThat(host.lastStepValue).isFalse();
    host.Reset();
    adaptor.doNextAction();
    ourInvokeStrategy.updateAllSteps();
    assertThat(host.updateButtonsCalled).isTrue();
    assertThat(host.canGoNextValue).isTrue();
    assertThat(host.firstStepValue).isFalse();
    assertThat(host.lastStepValue).isTrue();
    Disposer.dispose(adaptor);
}
Also used : ModelWizard(com.android.tools.idea.wizard.model.ModelWizard)

Example 13 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class IdeaWizardAdapterTest method canGoForwardsAndBackwards.

@Test
public void canGoForwardsAndBackwards() {
    AbstractWizard host = new DummyHost("None", null);
    DummyStep step1 = new DummyStep(new DummyModel(), "");
    DummyStep step2 = new DummyStep(new DummyModel(), "");
    ModelWizard guest = new ModelWizard.Builder(step1, step2).build();
    IdeaWizardAdapter adaptor = new IdeaWizardAdapter(host, guest);
    ourInvokeStrategy.updateAllSteps();
    assertThat(guest.onLastStep().get()).isFalse();
    adaptor.doNextAction();
    ourInvokeStrategy.updateAllSteps();
    assertThat(guest.onLastStep().get()).isTrue();
    adaptor.doPreviousAction();
    ourInvokeStrategy.updateAllSteps();
    assertThat(guest.onLastStep().get()).isFalse();
    Disposer.dispose(adaptor);
}
Also used : AbstractWizard(com.intellij.ide.wizard.AbstractWizard) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard)

Aggregations

ModelWizard (com.android.tools.idea.wizard.model.ModelWizard)13 StudioWizardDialogBuilder (com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder)7 Module (com.intellij.openapi.module.Module)3 Project (com.intellij.openapi.project.Project)3 NewModuleModel (com.android.tools.idea.npw.module.NewModuleModel)2 AbstractWizard (com.intellij.ide.wizard.AbstractWizard)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 Nullable (org.jetbrains.annotations.Nullable)2 VisibleForTesting (com.android.annotations.VisibleForTesting)1 GradleVersion (com.android.ide.common.repository.GradleVersion)1 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)1 AndroidVersion (com.android.sdklib.AndroidVersion)1 NewAndroidComponentAction (com.android.tools.idea.actions.NewAndroidComponentAction)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 NewAndroidActivityWizard (com.android.tools.idea.npw.NewAndroidActivityWizard)1 NewProjectWizardDynamic (com.android.tools.idea.npw.NewProjectWizardDynamic)1 GenerateImageIconsModel (com.android.tools.idea.npw.assetstudio.wizard.GenerateImageIconsModel)1 GenerateVectorIconModel (com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel)1 NewImageAssetStep (com.android.tools.idea.npw.assetstudio.wizard.NewImageAssetStep)1 NewVectorAssetStep (com.android.tools.idea.npw.assetstudio.wizard.NewVectorAssetStep)1