IJPL-189541 Search Everywhere: make backend mock counting presentation refreshes

GitOrigin-RevId: 73baa0744023097e7137c149702913f9369b1304
This commit is contained in:
Aydar Mukhametzyanov
2025-09-02 12:23:49 +00:00
committed by intellij-monorepo-bot
parent 062c571823
commit 3a773d4d98
2 changed files with 11 additions and 3 deletions
@@ -13,7 +13,7 @@ class SeItemsProviderFactoryMockBackend: SeItemsProviderFactory {
override val id: String get() = ID
override suspend fun getItemsProvider(project: Project?, dataContext: DataContext): SeItemsProvider? =
SeItemsProviderMock(resultPrefix = PREFIX, id = ID, displayName = PREFIX, delayMillis = 100, delayStep = 1)
SeItemsProviderMock(resultPrefix = PREFIX, id = ID, displayName = PREFIX, delayMillis = 100, delayStep = 1, shouldCloseOnSelect = false)
companion object {
const val PREFIX: String = "MockBackend"
@@ -20,6 +20,7 @@ class SeItemsProviderMock(
private val size: Int = 100,
private val delayMillis: Long = 0,
private val delayStep: Int = 0,
private val shouldCloseOnSelect: Boolean = true,
) : SeItemsProvider {
override suspend fun collectItems(params: SeParams, collector: SeItemsProvider.Collector) {
@@ -50,7 +51,7 @@ class SeItemsProviderMock(
override suspend fun itemSelected(item: SeItem, modifiers: Int, searchText: String): Boolean {
SeLog.logSuspendable(USER_ACTION) { "Provider ${id} item selected: ${item.presentation().text}" }
return true
return shouldCloseOnSelect
}
override suspend fun canBeShownInFindResults(): Boolean {
@@ -64,6 +65,13 @@ class SeItemsProviderMock(
@ApiStatus.Internal
class SeItemMock(val text: @NlsSafe String) : SeItem {
private var presentationUpdateCounter = -1
override fun weight(): Int = 0
override suspend fun presentation(): SeItemPresentation = SeSimpleItemPresentation(text = text, isMultiSelectionSupported = false)
override suspend fun presentation(): SeItemPresentation {
presentationUpdateCounter++
return SeSimpleItemPresentation(text = if (presentationUpdateCounter > 0) "$text - $presentationUpdateCounter" else text,
isMultiSelectionSupported = false)
}
}