mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-189541 Search Everywhere: make backend mock counting presentation refreshes
GitOrigin-RevId: 73baa0744023097e7137c149702913f9369b1304
This commit is contained in:
committed by
intellij-monorepo-bot
parent
062c571823
commit
3a773d4d98
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user