本文整理汇总了Java中org.netbeans.jemmy.operators.JEditorPaneOperator.pressKey方法的典型用法代码示例。如果您正苦于以下问题:Java JEditorPaneOperator.pressKey方法的具体用法?Java JEditorPaneOperator.pressKey怎么用?Java JEditorPaneOperator.pressKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.jemmy.operators.JEditorPaneOperator
的用法示例。
在下文中一共展示了JEditorPaneOperator.pressKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFor
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入方法依赖的package包/类
public void testFor() throws IOException {
EditorOperator oper = null;
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
oper = new EditorOperator("Main");
JEditorPaneOperator txtOper = oper.txtEditorPane();
oper.setCaretPosition(6, 9);
txtOper.typeText("fori");
txtOper.pressKey(KeyEvent.VK_TAB);
oper.setCaretPosition(9, 10);
txtOper.typeText("whilen");
txtOper.pressKey(KeyEvent.VK_TAB);
compareGoldenFile(oper);
} finally {
if (oper != null) {
oper.closeDiscardAll();
}
}
}
示例2: testExperessionOnLeftSide
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入方法依赖的package包/类
public void testExperessionOnLeftSide() {
final String abbrev = "fore";
EditorOperator editor = null;
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
editor = new EditorOperator("Main");
JEditorPaneOperator jepo = editor.txtEditorPane();
editor.setCaretPosition(4, 1);
jepo.typeText("static java.util.List<String> a;static java.util.List<Integer> b;");
useTemplateAt(editor, 6, 9, abbrev);
jepo.pressKey(KeyEvent.VK_TAB);
jepo.typeText("b");
checkContentOfEditorRegexp(editor, ".*for \\(Integer integer \\: b\\) \\{.*");
} finally {
editor.closeDiscard();
}
}
示例3: testSynchronizedBlock
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入方法依赖的package包/类
public void testSynchronizedBlock() {
final String abbrev = "form";
String regExp = ".*for \\(Map\\.Entry<Object, Object> en \\: m\\.entrySet\\(\\)\\) \\{.*";
EditorOperator editor = null;
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
editor = new EditorOperator("Main");
useTemplateAt(editor, 6, 9, abbrev);
checkContentOfEditorRegexp(editor, regExp);
JEditorPaneOperator jepo = editor.txtEditorPane();
assertEquals("Text is not selected", "en", jepo.getSelectedText());
assertEquals("Wrong start selection position ", 159, jepo.getSelectionStart());
assertEquals("Wrong end selection position", 161, jepo.getSelectionEnd());
jepo.typeText("var");
checkContentOfEditorRegexp(editor, ".*var \\:.*var\\.getKey.*var\\.getValue.*");
jepo.pressKey(KeyEvent.VK_TAB);
assertEquals("Wrong start selection position ", 165, jepo.getSelectionStart());
assertEquals("Wrong end selection position", 166, jepo.getSelectionEnd());
jepo.pressKey(KeyEvent.VK_TAB);
assertEquals("Wrong start selection position ", 193, jepo.getSelectionStart());
assertEquals("Wrong end selection position", 199, jepo.getSelectionEnd());
jepo.pressKey(KeyEvent.VK_TAB);
assertEquals("Wrong start selection position ", 200, jepo.getSelectionStart());
assertEquals("Wrong end selection position", 203, jepo.getSelectionEnd());
} finally {
if (editor != null) {
editor.closeDiscard();
}
}
}
示例4: testTemplatesInCompletionByCode
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入方法依赖的package包/类
public void testTemplatesInCompletionByCode() {
final String abbrev = "xxxyyy";
final String expanded = "abcdef";
final Set<String> context = new HashSet<>();
context.add("BLOCK");
CodeTemplatesOperator oper = null;
EditorOperator editor = null;
try {
oper = CodeTemplatesOperator.invoke(true);
oper.switchLanguage("Java").addNewTemplate(abbrev,expanded).selectTemplate(abbrev);
oper.setContext(context);
} finally {
oper.ok();
}
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
editor = new EditorOperator("Main");
JEditorPaneOperator jepo = editor.txtEditorPane();
editor.setCaretPosition(6, 9);
jepo.typeText("abcde");
jepo.pressKey(KeyEvent.VK_SPACE,KeyEvent.CTRL_DOWN_MASK);
new EventTool().waitNoEvent(1000);
jepo.pressKey(KeyEvent.VK_ENTER);
checkContentOfEditorRegexp(editor, ".*abcdef.*");
} finally {
editor.closeDiscard();
}
}
示例5: testTemplatesInCompletionByAbbrev
import org.netbeans.jemmy.operators.JEditorPaneOperator; //导入方法依赖的package包/类
public void testTemplatesInCompletionByAbbrev() {
final String abbrev = "xxxyyy";
final String expanded = "abcdef";
final Set<String> context = new HashSet<>();
context.add("BLOCK");
CodeTemplatesOperator oper = null;
EditorOperator editor = null;
try {
oper = CodeTemplatesOperator.invoke(true);
oper.switchLanguage("Java").addNewTemplate(abbrev,expanded).selectTemplate(abbrev);
oper.setContext(context);
} finally {
oper.ok();
}
try {
openSourceFile("org.netbeans.test.java.editor.codetemplates", "Main");
editor = new EditorOperator("Main");
JEditorPaneOperator jepo = editor.txtEditorPane();
editor.setCaretPosition(6, 9);
jepo.typeText("xxxyy");
jepo.pressKey(KeyEvent.VK_SPACE,KeyEvent.CTRL_DOWN_MASK);
new EventTool().waitNoEvent(1000);
jepo.pressKey(KeyEvent.VK_ENTER);
checkContentOfEditorRegexp(editor, ".*abcdef.*");
} finally {
editor.closeDiscard();
}
}