test fixed

This commit is contained in:
Dmitry Avdeev
2014-02-20 12:26:32 +04:00
parent cd39c84585
commit ef685dfb7c
3 changed files with 26 additions and 6 deletions
@@ -19,6 +19,7 @@ import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.platform.ProjectTemplate;
import com.intellij.ui.components.JBCheckBox;
import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -77,4 +78,11 @@ public class ChooseTemplateStep extends ModuleWizardStep {
public ProjectTemplateList getTemplateList() {
return myTemplateList;
}
@TestOnly
public boolean setSelectedTemplate(String name) {
myCreateFromTemplateCheckBox.setSelected(true);
return myTemplateList.setSelectedTemplate(name);
}
}
@@ -31,6 +31,7 @@ import com.intellij.ui.components.JBList;
import com.intellij.ui.popup.list.GroupedItemsListRenderer;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -185,6 +186,11 @@ public class ProjectTemplateList extends JPanel {
myList.addListSelectionListener(listener);
}
public void setPaintBusy(boolean b) {
myList.setPaintBusy(b);
}
@TestOnly
public boolean setSelectedTemplate(String name) {
ListModel model1 = myList.getModel();
for (int j = 0; j < model1.getSize(); j++) {
@@ -196,8 +202,4 @@ public class ProjectTemplateList extends JPanel {
return false;
}
public void setPaintBusy(boolean b) {
myList.setPaintBusy(b);
}
}
@@ -82,7 +82,7 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
return new NewModuleAction().createModuleFromWizard(myProject, null, myWizard);
}
protected void runWizard(String group, String name, Project project, @Nullable Consumer<Step> adjuster) throws IOException {
protected void runWizard(String group, final String name, Project project, @Nullable final Consumer<Step> adjuster) throws IOException {
createWizard(project);
ProjectTypeStep step = (ProjectTypeStep)myWizard.getCurrentStepObject();
@@ -95,7 +95,17 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
adjuster.consume(step);
}
runWizard(adjuster);
runWizard(new Consumer<Step>() {
@Override
public void consume(Step step) {
if (name != null && step instanceof ChooseTemplateStep) {
((ChooseTemplateStep)step).setSelectedTemplate(name);
}
if (adjuster != null) {
adjuster.consume(step);
}
}
});
}
protected void createWizard(Project project) throws IOException {