Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,11 @@ jobs:

# Both stable families load the exact same packaged ZIP. These are actual
# IDE startup/session checks, in addition to the static Plugin Verifier.
# Whenever the plugin was built here: a change of the plugin alone skips the backend's jobs, and a
# skipped job upstream would otherwise skip this one too.
clion-stable:
needs: clion
if: ${{ !cancelled() && needs.clion.result == 'success' }}
uses: ./.github/workflows/clion-stable.yml
with:
plugin_artifact: mcpp-clion-zip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface SettingsTextRemote {
fun getText(): String
fun setText(value: String)
fun requestFocusInWindow(): Boolean
fun isFocusOwner(): Boolean
}

@Remote("com.intellij.openapi.application.PathManager")
Expand Down Expand Up @@ -129,6 +130,10 @@ class SettingsInteractionTest {
val apply = dialog.x("//div[@visible_text='Apply' or @text='Apply']")
fun typeValue(target: SettingsTextRemote, value: String) {
assertTrue(withContext(OnDispatcher.EDT) { target.requestFocusInWindow() })
// Keys go to the focus owner, which the request makes it only once the EDT has run it.
val focused = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(10)
while (!withContext(OnDispatcher.EDT) { target.isFocusOwner() } && System.nanoTime() < focused) Thread.sleep(50)
assertTrue(withContext(OnDispatcher.EDT) { target.isFocusOwner() }, "the input owns the keyboard before it is typed into")
label.keyboard {
// This check exercises actual text-input events, which
// notify the native Settings editor of modifications.
Expand All @@ -137,7 +142,11 @@ class SettingsInteractionTest {
backspace()
if (value.isNotEmpty()) typeText(value)
}
assertEquals(value, target.getText(), "the real input receives the typed value")
// The typed keys are events the EDT handles after they are posted: the text is read once it
// has settled, not as the last key is posted.
val typed = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(10)
while (withContext(OnDispatcher.EDT) { target.getText() } != value && System.nanoTime() < typed) Thread.sleep(50)
assertEquals(value, withContext(OnDispatcher.EDT) { target.getText() }, "the real input receives the typed value")
}
fun setAndApply(value: String) {
typeValue(field, value)
Expand Down
Loading