mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
IJPL-239037 UiInfrastructureTest.occurence navigation test is failing occasionally
(cherry picked from commit 7d8aeda3548a62fa1bad620947003ff93bdb7104) IJ-CR-196535 GitOrigin-RevId: d62bb265eebeee524122804211eddbb5ffe9901a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
99408f596e
commit
a69259f959
+15
@@ -5,6 +5,9 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.ui.SimpleColoredComponent
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import java.awt.Component
|
||||
import java.awt.Robot
|
||||
import java.awt.event.InputEvent
|
||||
import javax.swing.JFrame
|
||||
import javax.swing.JLabel
|
||||
import javax.swing.text.JTextComponent
|
||||
|
||||
@@ -35,3 +38,15 @@ private fun Component.getText() : String? {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun JFrame.focusByClick() {
|
||||
val frameBounds = bounds
|
||||
val targetX = frameBounds.x + frameBounds.width / 2
|
||||
val taretY = frameBounds.y + 1 // top center point, right below the frame edge
|
||||
with(Robot()) {
|
||||
autoDelay = 50
|
||||
mouseMove(targetX, taretY)
|
||||
mousePress(InputEvent.BUTTON1_DOWN_MASK)
|
||||
mouseRelease(InputEvent.BUTTON1_DOWN_MASK)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user