mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
on demand expandAll=false option (2)
This commit is contained in:
@@ -16,9 +16,11 @@
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -34,7 +36,7 @@ public abstract class FileStructureTestBase extends CodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
protected void configureDefault() {
|
||||
myFixture.configureByFile(getFileName(getFileExtension()));
|
||||
myFixture.configureByFile(PathUtil.makeFileName(getTestName(false), getFileExtension()));
|
||||
}
|
||||
|
||||
protected abstract String getFileExtension();
|
||||
@@ -50,37 +52,38 @@ public abstract class FileStructureTestBase extends CodeInsightFixtureTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private String getFileName(String ext) {
|
||||
return getTestName(false) + (StringUtil.isEmpty(ext) ? "" : "." + ext);
|
||||
}
|
||||
|
||||
protected String getTreeFileName() {
|
||||
return getFileName("tree");
|
||||
}
|
||||
|
||||
protected void checkTree(String filter) {
|
||||
configureDefault();
|
||||
myPopupFixture.update();
|
||||
myPopupFixture.getPopup().setSearchFilterForTests(filter);
|
||||
PlatformTestUtil.waitForPromise(myPopupFixture.getPopup().rebuildAndUpdate());
|
||||
myPopupFixture.getSpeedSearch().findAndSelectElement(filter);
|
||||
checkResult();
|
||||
checkTree(filter, true);
|
||||
}
|
||||
|
||||
protected void checkTree() {
|
||||
checkTree(true);
|
||||
checkTree(null, true);
|
||||
}
|
||||
|
||||
protected void checkTree(boolean expandAll) {
|
||||
checkTree(null, expandAll);
|
||||
}
|
||||
|
||||
protected void checkTree(@Nullable String filter, boolean expandAll) {
|
||||
configureDefault();
|
||||
myPopupFixture.update();
|
||||
if (filter != null) {
|
||||
setSearchFilter(filter);
|
||||
}
|
||||
if (expandAll) {
|
||||
TreeUtil.expandAll(myPopupFixture.getTree());
|
||||
}
|
||||
checkResult();
|
||||
}
|
||||
|
||||
protected void setSearchFilter(@NotNull String filter) {
|
||||
myPopupFixture.getPopup().setSearchFilterForTests(filter);
|
||||
PlatformTestUtil.waitForPromise(myPopupFixture.getPopup().rebuildAndUpdate());
|
||||
myPopupFixture.getSpeedSearch().findAndSelectElement(filter);
|
||||
}
|
||||
|
||||
protected void checkResult() {
|
||||
assertSameLinesWithFile(getTestDataPath() + "/" + getTreeFileName(), PlatformTestUtil.print(myPopupFixture.getTree(), true).trim());
|
||||
String expectedFileName = getTestDataPath() + "/" + PathUtil.makeFileName(getTestName(false), "tree");
|
||||
assertSameLinesWithFile(expectedFileName, PlatformTestUtil.print(myPopupFixture.getTree(), true).trim());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user