From f441ff7ad0f7405571e66878d5bc179afb03e915 Mon Sep 17 00:00:00 2001 From: Alexey Kryuchkov Date: Mon, 25 Nov 2024 10:27:07 +0400 Subject: [PATCH] AT-1085 Validate traffic light renderer on highlighting stop/cancel GitOrigin-RevId: c0ee250814649f2d78ac4b77f9e2e04caaf75546 --- .../commands/WaitForFinishedCodeAnalysis.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/WaitForFinishedCodeAnalysis.kt b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/WaitForFinishedCodeAnalysis.kt index 605ecb3454f1..46152bd09b2c 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/WaitForFinishedCodeAnalysis.kt +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/WaitForFinishedCodeAnalysis.kt @@ -16,6 +16,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.EditorKind import com.intellij.openapi.editor.event.BulkAwareDocumentListener import com.intellij.openapi.editor.event.DocumentEvent +import com.intellij.openapi.editor.ex.EditorMarkupModel import com.intellij.openapi.extensions.ExtensionNotApplicableException import com.intellij.openapi.fileEditor.* import com.intellij.openapi.fileEditor.ex.FileEditorWithProvider @@ -49,6 +50,10 @@ private fun Collection.getWorthy(): List { } } +private fun isTrafficLightExists(editor: Editor): Boolean = (editor.markupModel as EditorMarkupModel).errorStripeRenderer != null + +private fun checkTrafficLightRenderer() = java.lang.Boolean.getBoolean("is.test.traffic.light") + internal class WaitForFinishedCodeAnalysis(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) { companion object { const val PREFIX = CMD_PREFIX + "waitForFinishedCodeAnalysis" @@ -282,6 +287,11 @@ class CodeAnalysisStateListener(val project: Project, val cs: CoroutineScope) { while (iterator.hasNext()) { val (editor, exceptionWithTime) = iterator.next() val highlightedEditor = highlightedEditors[editor] + + if (checkTrafficLightRenderer()) { + assert(isTrafficLightExists(editor.editor)) { "Highlighting traffic light should be shown in the top right corner of the editor, in case of $status" } + } + if (highlightedEditor == null) { if (!UIUtil.isShowing(editor.getComponent())) { iterator.remove()