@@ -26,6 +26,7 @@ package com.mituuz.fuzzier
2626import com.intellij.openapi.actionSystem.AnActionEvent
2727import com.intellij.openapi.actionSystem.IdeActions
2828import com.intellij.openapi.editor.actionSystem.EditorActionManager
29+ import com.intellij.openapi.fileTypes.FileTypeManager
2930import com.intellij.openapi.project.Project
3031import com.intellij.openapi.ui.popup.JBPopup
3132import com.intellij.openapi.ui.popup.JBPopupFactory
@@ -168,6 +169,21 @@ class FuzzyActionTest {
168169 assertEquals(" /src/asd" , component.text)
169170 }
170171
172+ @Test
173+ fun `Check renderer icon for different file types` () {
174+ val action = getAction()
175+ action.setFiletype(FILENAME_ONLY )
176+ action.component = SimpleFinderComponent ()
177+ action.component.isDirSelector = true
178+ val renderer = action.getCellRenderer()
179+ val dummyList = JList <FuzzyMatchContainer >()
180+ val container = FuzzyMatchContainer (FuzzyScore (), " /src/asd" , " asd.kt" , " " )
181+ val expectedIcon = FileTypeManager .getInstance().getFileTypeByFileName(" asd.kt" ).icon
182+ val component = renderer.getListCellRendererComponent(dummyList, container, 0 , false , false ) as JLabel
183+ assertNotNull(component.icon)
184+ assertEquals(expectedIcon, component.icon)
185+ }
186+
171187 private fun getAction (): FuzzyAction {
172188 return object : FuzzyAction () {
173189 override fun actionPerformed (actionEvent : AnActionEvent ) {
0 commit comments