Force insertion of the first completion for handler test (Leda only)

This commit is contained in:
Nikolay Krasko
2012-07-25 19:23:47 +04:00
parent 2a16ec0b0f
commit 27b22105b4
2 changed files with 14 additions and 4 deletions
@@ -89,14 +89,17 @@ public class CompletionHandlerTest extends LightCompletionTestCase {
configureByFileNoComplete(getBeforeFileName()); configureByFileNoComplete(getBeforeFileName());
setType(type); setType(type);
complete(time);
if (lookupString != null || tailText != null) { if (lookupString != null || tailText != null) {
complete(time);
LookupElement item = getExistentLookupElement(lookupString, tailText); LookupElement item = getExistentLookupElement(lookupString, tailText);
if (item != null) { if (item != null) {
selectItem(item, '\t'); selectItem(item, '\n');
} }
} }
else {
forceCompleteFirst(time);
}
checkResultByFile(getAfterFileName()); checkResultByFile(getAfterFileName());
} }
@@ -164,4 +167,11 @@ public class CompletionHandlerTest extends LightCompletionTestCase {
protected Sdk getProjectJDK() { protected Sdk getProjectJDK() {
return PluginTestCaseBase.jdkFromIdeaHome(); return PluginTestCaseBase.jdkFromIdeaHome();
} }
protected void forceCompleteFirst(int time) {
complete(time);
if (myItems != null && myItems.length > 1) {
selectItem(myItems[0]);
}
}
} }
@@ -31,7 +31,7 @@ public class CompletionWeigherTest extends CompletionAutoPopupTestCase {
} }
public void testTemplatesAndKeywordsFirst() { public void testTemplatesAndKeywordsFirst() {
doTest("va", "val ... = ...", "var ... = ...", "vararg", "private", "values", "variables"); doTest("va", "val ... = ...", "var ... = ...", "vararg", "values", "variables");
} }
public void doTest(String type, @NonNls String... expected) { public void doTest(String type, @NonNls String... expected) {