assertj / assertj/assertj-swing

delay setings dont speedup enterText

Đang mở
#55 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
import from fest-swing Improvement Major
Ngôn ngữ chính
Java
Star
121
Fork
52
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

_Issue by **[a](http://jira.codehaus.org/secure/ViewProfile.jspa?name=henningb)** from Mon, 30 Nov 2009 05:10:44 -0600_
_Originally opened as http://jira.codehaus.org/browse/FEST-265_

---

you cant speedup enterText with the delay settings.


robot.settings().delayBetweenEvents(10); 

robot.settings().eventPostingDelay(10);
XXXXXXX.enterText(text);

Thas only works for keys without modifiers like Numbers.

Workaround (using awt.Robot, German Keybord and AltGr dont work):


 public void setTextSim(String text, CommonComponentFixture component){

KeyStrokeMappingProvider_de provider= new KeyStrokeMappingProvider_de();
KeyStrokeMap.addKeyStrokesFrom(provider);

java.awt.Robot awtRobot = null;
try {
awtRobot = new java.awt.Robot();
} catch (AWTException e) {
e.printStackTrace();
}
awtRobot.setAutoDelay(5);

component.focus();

boolean shiftPressed=false;
for (int i=0;i<text.length();i++){
char character = text.charAt(i);

boolean needShift=((KeyStrokeMap.keyStrokeFor(character).getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0 );

if (needShift){
if (!shiftPressed){
awtRobot.keyPress(KeyEvent.VK_SHIFT);
awtRobot.waitForIdle();
shiftPressed=true;
}
} else {//dont need shift
if (shiftPressed){
awtRobot.keyRelease(KeyEvent.VK_SHIFT);
awtRobot.waitForIdle();
shiftPressed=false;
}
}

int keyCode=KeyStrokeMap.keyStrokeFor(character).getKeyCode();

awtRobot.keyRelease(keyCode);
awtRobot.waitForIdle();
awtRobot.keyPress(keyCode);
awtRobot.waitForIdle();
}


if (shiftPressed){
robot.releaseKey(KeyEvent.VK_SHIFT);
}

}


---

votes (original issue): 0
watches (original issue): 1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Search for the enterText entry point and the robot.settings() handling of delayBetweenEvents and eventPostingDelay, then trace how modified keystrokes are posted. Reproduce the example with modifier keys and confirm that the configured delays affect those characters as well as unmodified keys.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
desktop, testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.