Fix completion tests after "cast required" color change (KT-18089)

#KT-18089 Fixed
This commit is contained in:
Nikolay Krasko
2018-11-22 21:31:24 +03:00
parent d06b04f025
commit b79f8ff8fa
2 changed files with 5 additions and 5 deletions
@@ -77,6 +77,8 @@ class LookupElementFactory(
val parameter = descriptor.original.valueParameters.singleOrNull() ?: return false
return parameter.type.isFunctionType
}
val CAST_REQUIRED_COLOR = JBColor(0x4E4040, 0x969696)
}
val insertHandlerProvider = basicFactory.insertHandlerProvider
@@ -272,8 +274,6 @@ class LookupElementFactory(
return element
}
private val castRequiredColor = JBColor(0x4E4040, 0x969696)
private fun LookupElement.boldIfImmediate(weight: CallableWeight?): LookupElement {
val style = when (weight?.enum) {
CallableWeightEnum.thisClassMember, CallableWeightEnum.thisTypeExtension -> Style.BOLD
@@ -288,7 +288,7 @@ class LookupElementFactory(
presentation.isItemTextBold = true
}
else {
presentation.itemTextForeground = castRequiredColor
presentation.itemTextForeground = CAST_REQUIRED_COLOR
// gray all tail fragments too:
val fragments = presentation.tailFragments
presentation.clearTail()
@@ -24,9 +24,9 @@ import com.google.gson.JsonParser
import com.intellij.codeInsight.completion.CompletionType
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.codeInsight.lookup.LookupElementPresentation
import com.intellij.codeInsight.lookup.impl.LookupCellRenderer
import com.intellij.ui.JBColor
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.idea.completion.LookupElementFactory
import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
import org.jetbrains.kotlin.idea.test.AstAccessControl
import org.jetbrains.kotlin.idea.util.module
@@ -346,7 +346,7 @@ object ExpectedCompletionUtils {
}
val foreground = presentation.itemTextForeground
if (foreground != JBColor.foreground()) {
assert(foreground == LookupCellRenderer.getGrayedForeground(false))
assert(foreground == LookupElementFactory.CAST_REQUIRED_COLOR)
if (length > 0) append(" ")
append("grayed")
}