KT-1389 Ctrl-Alt-B on class declaration does not work - Include location part into test data

#KT-1389 In Progress
This commit is contained in:
Nikolay Krasko
2012-08-16 16:53:12 +04:00
parent 5d1a488312
commit 60b20374da
3 changed files with 18 additions and 9 deletions
@@ -6,6 +6,6 @@ open class TestOther : <caret>Test()
class TestOtherMore : TestOther()
// REF: Test
// REF: TestOther
// REF: TestOtherMore
// REF: (testing).Test
// REF: (testing).TestOther
// REF: (testing).TestOtherMore
@@ -6,5 +6,5 @@ open class TestOther : Test()
class TestOtherMore : TestOther()
// REF: TestOtherMore
// REF: TestOther
// REF: (testing).TestOther
// REF: (testing).TestOtherMore
@@ -27,7 +27,9 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiElement;
import com.intellij.testFramework.LightCodeInsightTestCase;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.asJava.JetLightClass;
import org.jetbrains.jet.plugin.PluginTestCaseBase;
import org.jetbrains.jet.plugin.presentation.JetLightClassListCellRenderer;
import org.jetbrains.jet.testing.InTextDirectivesUtils;
import java.io.File;
@@ -65,17 +67,24 @@ public class JetGotoImplementationTest extends LightCodeInsightTestCase {
InTextDirectivesUtils.findListWithPrefix("// REF:", getEditor().getDocument().getText()));
Collections.sort(expectedReferences);
GotoTargetHandler.GotoData elements = new GotoImplementationHandler().getSourceAndTargetElements(getEditor(), getFile());
final GotoTargetHandler.GotoData gotoData = new GotoImplementationHandler().getSourceAndTargetElements(getEditor(), getFile());
if (elements != null) {
List<String> psiElements = Lists.transform(Arrays.asList(elements.targets), new Function<PsiElement, String>() {
if (gotoData != null) {
List<String> psiElements = Lists.transform(Arrays.asList(gotoData.targets), new Function<PsiElement, String>() {
@Override
public String apply(@Nullable PsiElement element) {
assertNotNull(element);
if (element instanceof JetLightClass) {
JetLightClass jetLightClass = (JetLightClass) element;
JetLightClassListCellRenderer renderer = new JetLightClassListCellRenderer();
return JetLightClassListCellRenderer.getContainerTextStatic(jetLightClass) + "." +
renderer.getElementText(jetLightClass);
}
assertTrue(element instanceof NavigationItem);
ItemPresentation presentation = ((NavigationItem)element).getPresentation();
assertNotNull(presentation);
return presentation.getPresentableText();
return presentation.getLocationString() + "." + presentation.getPresentableText();
}
});