mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move FilePathClassNameCompletionTest to java-tests module
GitOrigin-RevId: f826253ea78093ff656ac60fb674009e56cce982
This commit is contained in:
committed by
intellij-monorepo-bot
parent
285a5acd66
commit
224ab75fc5
@@ -0,0 +1,3 @@
|
||||
public class Test {
|
||||
public static final String TEST = "71<caret>x";
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 587 B |
@@ -0,0 +1,3 @@
|
||||
public class Test {
|
||||
public static final String TEST = "i/i2/717_image.png<caret>";
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class Test {
|
||||
public static final String TEST = "i/i2/717_image.png <caret>";
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
public class TestWrongCase {
|
||||
public static final String TEST = "Fake<caret>x";
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class TestWrongCase {
|
||||
public static final String TEST = "fake_file.txt<caret>";
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
*/
|
||||
public class FilePathClassNameCompletionTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/codeInsight/completion/filePath2/";
|
||||
}
|
||||
|
||||
public void testJava() {
|
||||
myFixture.copyFileToProject("src1/i/i2/717_image.png", "i/i2/717_image.png");
|
||||
myFixture.configureByFile("src1/Test.java");
|
||||
LookupElement[] myItems = complete();
|
||||
|
||||
assertEquals(1, myItems.length);
|
||||
assertEquals("717_image.png (16x16)", myItems[0].toString());
|
||||
|
||||
final LookupElement element = myItems[0];
|
||||
assertInstanceOf(element.getObject(), PsiElement.class);
|
||||
|
||||
myFixture.type('\t');
|
||||
checkResultByFile("src1_after/Test.java");
|
||||
}
|
||||
|
||||
private void checkResultByFile(String path) {
|
||||
myFixture.checkResultByFile(path);
|
||||
}
|
||||
|
||||
public void testJava_wrongCase() {
|
||||
myFixture.addFileToProject("fake_file.txt", "");
|
||||
myFixture.configureByFile("src3/TestWrongCase.java");
|
||||
LookupElement[] myItems = complete();
|
||||
|
||||
assertEquals(1, myItems.length);
|
||||
assertEquals("fake_file.txt", myItems[0].getLookupString());
|
||||
|
||||
final LookupElement element = myItems[0];
|
||||
assertInstanceOf(element.getObject(), PsiElement.class);
|
||||
|
||||
myFixture.type('\t');
|
||||
checkResultByFile("src3_after/TestWrongCase.java");
|
||||
}
|
||||
|
||||
public void testFileReferenceVariantsFiltered() {
|
||||
myFixture.addFileToProject("foo.txt", "");
|
||||
myFixture.configureByText("FooBar.java", "class FooBar { String barName = \"foo<caret>\"}");
|
||||
complete();
|
||||
|
||||
myFixture.checkResult("class FooBar { String barName = \"foo.txt\"}");
|
||||
}
|
||||
|
||||
private LookupElement[] complete() {
|
||||
return myFixture.complete(CompletionType.BASIC, 2);
|
||||
}
|
||||
|
||||
public void testUnblockDocument() {
|
||||
myFixture.addFileToProject("i/i2/717_image.png", "");
|
||||
myFixture.configureByFile("src1/Test.java");
|
||||
complete();
|
||||
|
||||
myFixture.type("7_image.png ");
|
||||
|
||||
checkResultByFile("src1_after/UnblockDocument.java");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user