a test for up/down arrows in autopopup

This commit is contained in:
peter
2011-01-31 13:17:47 +01:00
parent 08f0f7d57e
commit 1135a571f9
3 changed files with 58 additions and 2 deletions
@@ -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
}
}