本文整理汇总了Java中org.netbeans.jemmy.operators.JTextComponentOperator.clearText方法的典型用法代码示例。如果您正苦于以下问题:Java JTextComponentOperator.clearText方法的具体用法?Java JTextComponentOperator.clearText怎么用?Java JTextComponentOperator.clearText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.jemmy.operators.JTextComponentOperator
的用法示例。
在下文中一共展示了JTextComponentOperator.clearText方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSearchBackwards
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testSearchBackwards() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "testSearchForward");
EditorOperator editor = new EditorOperator("testSearchForward");
editor.setCaretPosition(54, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("pub");
t.pushKey(KeyEvent.VK_ENTER,KeyEvent.SHIFT_DOWN_MASK);
assertSelection(editor, 2402, 2405);
t.pushKey(KeyEvent.VK_ENTER,KeyEvent.SHIFT_DOWN_MASK);
assertSelection(editor, 2323, 2326);
t.pushKey(KeyEvent.VK_ENTER,KeyEvent.SHIFT_DOWN_MASK);
assertSelection(editor, 368, 371);
t.pushKey(KeyEvent.VK_ENTER,KeyEvent.SHIFT_DOWN_MASK);
MainWindowOperator mwo = MainWindowOperator.getDefault();
assertEquals("'pub' found at 55:5; Beginning of the document reached. Continuing search from end.",mwo.getStatusText());
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例2: testNextButton
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testNextButton() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(1, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(200);
t.typeText("abc");
JButtonOperator b = barOperator.nextButton();
b.push();
new EventTool().waitNoEvent(200);
assertSelection(editor, 0, 3);
b.push();
new EventTool().waitNoEvent(200);
assertSelection(editor, 4, 7);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例3: testPrevButton
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testPrevButton() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(3, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("abc");
JButtonOperator b = barOperator.prevButton();
b.push();
assertSelection(editor, 4, 7);
b.push();
assertSelection(editor, 0, 3);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例4: testNotFound
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testNotFound() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(3, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
try {
t.clearText();
new EventTool().waitNoEvent(100);
t.requestFocus();
t.typeText("XYZ");
t.pushKey(KeyEvent.VK_ENTER);
new EventTool().waitNoEvent(100);
MainWindowOperator mwo = MainWindowOperator.getDefault();
assertEquals("'XYZ' not found",mwo.getStatusText());
JTextComponentOperator filed = barOperator.findCombo();
assertEquals(new Color(178, 0, 0), filed.getForeground());
} finally {
barOperator.closeButton().doClick();
}
new EventTool().waitNoEvent(200);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例5: testInvalidRegexp
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testInvalidRegexp() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(3, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
JCheckBoxOperator ch2 = barOperator.reqularExpressionCheckBox();
ch2.setSelected(true);
t.clearText();
new EventTool().waitNoEvent(100);
t.requestFocus();
t.typeText("(");
new EventTool().waitNoEvent(1000);
JTextComponentOperator filed = barOperator.findCombo();
assertEquals(new Color(255, 0, 0), filed.getForeground());
MainWindowOperator mwo = MainWindowOperator.getDefault();
assertEquals("Invalid regular expression: 'Unclosed group'",mwo.getStatusText());
ch2.setSelected(false);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例6: testSearchForwardBackward
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testSearchForwardBackward() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(2, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("abc");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 4, 7);
t.pushKey(KeyEvent.VK_ENTER, KeyEvent.SHIFT_DOWN_MASK);
assertSelection(editor, 0, 3);
editor.txtEditorPane().requestFocus();
new EventTool().waitNoEvent(100);
assertTrue("ToolBar closed by focus transfer ",barOperator.isVisible());
editor.closeDiscard();
}
示例7: testWholeWords
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testWholeWords() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match2.txt");
EditorOperator editor = new EditorOperator("match2.txt");
editor.setCaretPosition(1, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
JCheckBoxOperator ch1 = barOperator.wholeWordsCheckBox();
ch1.setSelected(true);
t.clearText();
t.typeText("whole");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 12, 17);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
closeFileWithDiscard();
}
示例8: testRegularExpression
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testRegularExpression() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match2.txt");
EditorOperator editor = new EditorOperator("match2.txt");
editor.setCaretPosition(1, 1);
SearchBarOperator barOperator =SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
JCheckBoxOperator ch1 = barOperator.matchCaseCheckBox();
JCheckBoxOperator ch2 = barOperator.reqularExpressionCheckBox();
ch1.setSelected(false);
ch2.setSelected(true);
t.clearText();
t.typeText("[aA]b*cd?");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 19, 23);
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 36, 39);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
closeFileWithDiscard();
}
示例9: testFindNext
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testFindNext() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match2.txt");
EditorOperator editor = new EditorOperator("match2.txt");
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
barOperator.matchCaseCheckBox().setSelected(false);
barOperator.reqularExpressionCheckBox().setSelected(false);
barOperator.wholeWordsCheckBox().setSelected(false);
t.pushKey(KeyEvent.VK_ESCAPE);
editor.setCaretPosition(1, 1);
barOperator = SearchBarOperator.invoke(editor);
new EventTool().waitNoEvent(100);
t.typeText("ab");
t.pushKey(KeyEvent.VK_ENTER);
new EventTool().waitNoEvent(100);
assertSelection(editor, 19,21);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
t.pushKey(KeyEvent.VK_F3);
new EventTool().waitNoEvent(100);
assertSelection(editor, 24, 26);
closeFileWithDiscard();
}
示例10: clearText
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
/** Clears the document */
protected final void clearText() {
col = 0;
JTextComponentOperator text = new JTextComponentOperator(editor);
text.setText("X"); //!!! because clearText is to slow.
text.clearText();
}
示例11: testSearchForward
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testSearchForward() {
openDefaultProject();
openDefaultSampleFile();
EditorOperator editor = new EditorOperator("testSearchForward.java");
editor.setCaretPosition(47, 1);
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("p");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 2373, 2374);
editor.setCaretPosition(47, 1);
t.pushKey(KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK);
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("pu");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 2389, 2391);
editor.setCaretPosition(47, 1);
t.pushKey(KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK);
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("pub");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 2402, 2405);
barOperator.nextButton().push();
assertSelection(editor, 2446, 2449);
barOperator.nextButton().push();
assertSelection(editor, 368, 371);
MainWindowOperator mwo = MainWindowOperator.getDefault();
assertEquals("'pub' found at 10:12; End of the document reached. Continuing search from beginning.",mwo.getStatusText());
t.pushKey(KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
closeFileWithDiscard();
}
示例12: testMatchCase
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testMatchCase() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
EditorOperator editor = new EditorOperator("match.txt");
editor.setCaretPosition(1, 1);
new EventTool().waitNoEvent(100); // needed to compute layout
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JCheckBoxOperator jcbo = barOperator.matchCaseCheckBox();
jcbo.setSelected(true);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
new EventTool().waitNoEvent(100);
t.typeText("Abc");
t.pushKey(KeyEvent.VK_ENTER);
assertSelection(editor, 8, 11);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
SearchBarOperator.invoke(editor);
assertTrue("Checkbox state is not persisten",jcbo.isSelected());
assertEquals("Last searched text not persisten",t.getText(),"Abc");
jcbo.setSelected(false);
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
editor.closeDiscard();
}
示例13: testFindPrev
import org.netbeans.jemmy.operators.JTextComponentOperator; //导入方法依赖的package包/类
public void testFindPrev() {
openDefaultProject();
openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match2.txt");
EditorOperator editor = new EditorOperator("match2.txt");
SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
JTextComponentOperator t = barOperator.findCombo();
t.clearText();
barOperator.matchCaseCheckBox().setSelected(false);
barOperator.reqularExpressionCheckBox().setSelected(false);
barOperator.wholeWordsCheckBox().setSelected(false);
t.pushKey(KeyEvent.VK_ESCAPE);
editor.setCaretPosition(1, 1);
barOperator = SearchBarOperator.invoke(editor);
t.typeText("ab");
t.pushKey(KeyEvent.VK_ENTER);
new EventTool().waitNoEvent(100);
assertSelection(editor, 19,21); // 19,21
t.pushKey(KeyEvent.VK_ESCAPE);
new EventTool().waitNoEvent(100);
assertFalse("ToolBar not closed",barOperator.isVisible());
t.pushKey(KeyEvent.VK_F3, KeyEvent.SHIFT_DOWN_MASK);
new EventTool().waitNoEvent(100);
assertSelection(editor, 36, 38); // 36, 38
t.pushKey(KeyEvent.VK_F3, KeyEvent.SHIFT_DOWN_MASK);
new EventTool().waitNoEvent(100);
assertSelection(editor, 24, 26); // 24, 26
closeFileWithDiscard();
}