use of com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoParameterInfoHandlerTest method getHighlightedItem.
private int getHighlightedItem() {
MockUpdateParameterInfoContext updateCtx = new MockUpdateParameterInfoContext(myFixture.getEditor(), myFixture.getFile());
GoArgumentList psiElement = myParameterInfoHandler.findElementForUpdatingParameterInfo(updateCtx);
assertNotNull(psiElement);
myParameterInfoHandler.updateParameterInfo(psiElement, updateCtx);
return updateCtx.getCurrentParameter();
}
use of com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method doTest2CandidatesWithPreselection.
private void doTest2CandidatesWithPreselection() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertEquals(2, itemsToShow.length);
assertTrue(itemsToShow[0] instanceof MethodCandidateInfo);
ParameterInfoComponent.createContext(itemsToShow, getEditor(), handler, -1);
MockUpdateParameterInfoContext updateParameterInfoContext = updateParameterInfo(handler, list, itemsToShow);
assertTrue(updateParameterInfoContext.isUIComponentEnabled(0) || updateParameterInfoContext.isUIComponentEnabled(1));
}
use of com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method updateParameterInfo.
@NotNull
private MockUpdateParameterInfoContext updateParameterInfo(MethodParameterInfoHandler handler, PsiExpressionList list, Object[] itemsToShow) {
MockUpdateParameterInfoContext updateParameterInfoContext = new MockUpdateParameterInfoContext(getEditor(), getFile(), itemsToShow);
updateParameterInfoContext.setParameterOwner(list);
handler.updateParameterInfo(list, updateParameterInfoContext);
return updateParameterInfoContext;
}
use of com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext in project intellij-plugins by JetBrains.
the class CfmlParameterInfoTest method defaultTest.
private void defaultTest(String s) throws /*, int highlightedParameterIndex*/
Exception {
myFixture.configureByFile(getTestName(false) + ".cfml");
CfmlParameterInfoHandler parameterInfoHandler = new CfmlParameterInfoHandler();
MockCreateParameterInfoContext createContext = new MockCreateParameterInfoContext(myFixture.getEditor(), myFixture.getFile());
PsiElement elt = parameterInfoHandler.findElementForParameterInfo(createContext);
assertNotNull(elt);
parameterInfoHandler.showParameterInfo(elt, createContext);
Object[] items = createContext.getItemsToShow();
assertTrue(items != null);
assertTrue(items.length > 0);
MockParameterInfoUIContext context = new MockParameterInfoUIContext<>(elt);
parameterInfoHandler.updateUI((CfmlFunctionDescription) items[0], context);
assertEquals(s, parameterInfoHandler.getText());
// index check
MockUpdateParameterInfoContext updateContext = new MockUpdateParameterInfoContext(myFixture.getEditor(), myFixture.getFile());
final PsiElement element = parameterInfoHandler.findElementForUpdatingParameterInfo(updateContext);
parameterInfoHandler.updateParameterInfo(element, updateContext);
// assertEquals(highlightedParameterIndex, updateContext.getCurrentParameter());
}
use of com.intellij.testFramework.utils.parameterInfo.MockUpdateParameterInfoContext in project intellij-plugins by JetBrains.
the class DartParameterInfoTest method doTest.
private void doTest(String infoText, int highlightedParameterIndex, int highlightStart, int highlightEnd) {
myFixture.configureByFile(getTestName(false) + "." + DartFileType.DEFAULT_EXTENSION);
// warm up the server
myFixture.doHighlighting();
final DartParameterInfoHandler parameterInfoHandler = new DartParameterInfoHandler();
MockCreateParameterInfoContext createContext = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiElement elt = parameterInfoHandler.findElementForParameterInfo(createContext);
assertNotNull(elt);
parameterInfoHandler.showParameterInfo(elt, createContext);
Object[] items = createContext.getItemsToShow();
assertTrue(items != null);
assertTrue(items.length > 0);
MockParameterInfoUIContext context = new MockParameterInfoUIContext<>(elt);
parameterInfoHandler.updateUI((DartFunctionDescription) items[0], context);
assertEquals(infoText, parameterInfoHandler.getParametersListPresentableText());
// index check
MockUpdateParameterInfoContext updateContext = new MockUpdateParameterInfoContext(getEditor(), getFile());
final PsiElement element = parameterInfoHandler.findElementForUpdatingParameterInfo(updateContext);
assertNotNull(element);
parameterInfoHandler.updateParameterInfo(element, updateContext);
assertEquals(highlightedParameterIndex, updateContext.getCurrentParameter());
// range check
if (highlightStart != -1) {
assertEquals(highlightStart, context.getHighlightStart());
assertEquals(highlightEnd, context.getHighlightEnd());
}
}
Aggregations