mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
a test for up/down arrows in autopopup
This commit is contained in:
+46
-1
@@ -16,9 +16,10 @@
|
||||
package com.intellij.codeInsight.completion
|
||||
|
||||
import com.intellij.codeInsight.lookup.Lookup
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.command.CommandProcessor
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.ide.ui.UISettings
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -388,4 +389,48 @@ class JavaAutoPopupTest extends CompletionAutoPopupTestCase {
|
||||
assert !lookup
|
||||
}
|
||||
|
||||
void testArrow(boolean up, boolean cycleScrolling, boolean lookupAbove, int index) {
|
||||
myFixture.configureByText("a.java", """
|
||||
class A {
|
||||
{ ArrayIndexOutOfBoundsException <caret> }
|
||||
}
|
||||
""")
|
||||
|
||||
type 'o'
|
||||
assert lookup
|
||||
assert !lookup.focused
|
||||
assert lookup.items.size() == 2
|
||||
|
||||
UISettings.instance.CYCLE_SCROLLING = cycleScrolling
|
||||
|
||||
try {
|
||||
edt { myFixture.performEditorAction(up ? IdeActions.ACTION_EDITOR_MOVE_CARET_UP : IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN) }
|
||||
if (lookup) {
|
||||
assert lookup.focused
|
||||
assert index >= 0
|
||||
assert lookup.items[index] == lookup.currentItem
|
||||
edt { lookup.hide() }
|
||||
} else {
|
||||
assert index == -1
|
||||
}
|
||||
type '\b'
|
||||
}
|
||||
finally {
|
||||
UISettings.instance.CYCLE_SCROLLING = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void testArrows(boolean cycleScrolling, boolean lookupAbove, int indexDown, indexUp) {
|
||||
testArrow true, cycleScrolling, lookupAbove, indexUp
|
||||
testArrow false, cycleScrolling, lookupAbove, indexDown
|
||||
}
|
||||
|
||||
public void testVerticalArrows() {
|
||||
testArrows false, false, 0, -1
|
||||
testArrows false, true, 0, -1
|
||||
testArrows true, false, 0, 1
|
||||
testArrows true, true, 0, 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user