From 0bfc8f695445ad3a62258b9b97ab4ad260bb70ec Mon Sep 17 00:00:00 2001 From: "Kamaliia.Alisheva" Date: Mon, 11 Aug 2025 10:26:48 +0300 Subject: [PATCH] [remote driver] Fix infinity cycle in function switchCheckBoxByPath GitOrigin-RevId: 56a81ff3c7b8c96bcbfd951f23ea70359f48aaaf --- .../fixtures/JCheckboxTreeFixture.kt | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JCheckboxTreeFixture.kt b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JCheckboxTreeFixture.kt index 93e5550f6148..9aeaf0e7429b 100644 --- a/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JCheckboxTreeFixture.kt +++ b/plugins/performanceTesting/remote-driver/src/com/jetbrains/performancePlugin/remotedriver/fixtures/JCheckboxTreeFixture.kt @@ -52,8 +52,8 @@ class JCheckboxTreeFixture(private val robot: Robot, private val component: JTre component.getRowForPath(path), getCheckBoxForNode(path).isSelected) }, { - result.add(it) - }) + result.add(it) + }) } return result } @@ -62,23 +62,18 @@ class JCheckboxTreeFixture(private val robot: Robot, private val component: JTre fun switchCheckBoxByPath(path: List, state: Boolean) { val root = component.model.root as DefaultMutableTreeNode - val treePaths = collectExpandedPaths() - val node = TreeUtil.findNode(root) { node -> - TreePath(node.path).toStringList().equals(path) + TreePath(node.path).toStringList() == path } val fileTreePath = TreePath(node!!.path) val checkbox = getCheckBoxForNode(fileTreePath) - if (getCheckBoxForNode(fileTreePath).isSelected != state) { - val checkboxLocation = computeOnEdt { - component.getPathBounds(fileTreePath) ?: error("Have not found bounds") - } - while (getCheckBoxForNode(fileTreePath).isSelected != state) { - clickOnCheckbox(checkbox, checkboxLocation) - } + if (getCheckBoxForNode(fileTreePath).isSelected == state) return + val checkboxLocation = computeOnEdt { + checkNotNull(component.getPathBounds(fileTreePath)) { "Have not found bounds" } } + clickOnCheckbox(checkbox, checkboxLocation) } private fun clickOnCheckbox(checkbox: JCheckBox, checkboxLocation: Rectangle) {