Search in sources :

Example 1 with AbstractWizard

use of com.intellij.ide.wizard.AbstractWizard 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 2 with AbstractWizard

use of com.intellij.ide.wizard.AbstractWizard 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)2 AbstractWizard (com.intellij.ide.wizard.AbstractWizard)2