IDEA-119983 Smart type completion mixes order for Color.RED

This commit is contained in:
peter
2014-01-29 19:40:25 +01:00
parent 589208ff99
commit 4037871a23
8 changed files with 46 additions and 18 deletions
@@ -0,0 +1,14 @@
class MyColor {
static final MyColor RED = null;
}
class Another {
static final MyColor RED = null;
}
class Foo {
public static final MyColor MARKED_BACKGROUND = new MyColor();
{
MyColor color = RED<caret>
}
}
@@ -203,7 +203,7 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
public void testGlobalFactoryMethods() {
configure();
assertStringItems("createExpected", "Constants.SUBSTRING", "createSubGeneric", "createSubRaw", "createSubString");
assertStringItems("Constants.SUBSTRING", "createExpected", "createSubGeneric", "createSubRaw", "createSubString");
}
public void testEmptyMapPresentation() {
@@ -149,7 +149,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testBooleanValueOf() throws Throwable {
checkPreferredItems(0, "b", "valueOf", "valueOf", "Boolean.FALSE", "Boolean.TRUE");
checkPreferredItems(0, "b", "Boolean.FALSE", "Boolean.TRUE", "equals", "false", "true", "valueOf", "valueOf");
}
public void testXmlTagGetAttribute() throws Throwable {
@@ -333,6 +333,13 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
assertPreferredItems 0, 'newLinkedSet1', 'newLinkedSet0', 'newLinkedSet2'
}
public void testPreferExpectedTypeMembers() {
configureNoCompletion(getTestName(false) + ".java")
myFixture.complete(CompletionType.SMART, 2)
assertPreferredItems 0, 'MyColor.RED', 'Another.RED'
assert lookup.items.size() == 2
}
@Override
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath() + BASE_PATH;
@@ -774,7 +774,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
}
public void testNoClassLiteral() throws Exception {
doActionTest();
assertStringItems("Object.class", "forName", "forName", "getClass");
assertStringItems("Object.class", "getClass", "forName", "forName");
}
public void testClassLiteralInAnno2() throws Throwable {