|
What this is
Other links
The source codepackage org.netbeans.test.editor.suites.smart_enter; /* * Main.java * * Created on 23. srpen 2004, 17:25 */ import java.awt.event.KeyEvent; import org.netbeans.jellytools.Bundle; import org.netbeans.jellytools.EditorOperator; import org.netbeans.jellytools.EditorWindowOperator; import org.netbeans.jellytools.modules.editor.EditorTestCase; import org.netbeans.jemmy.operators.JEditorPaneOperator; /** * * @author Petr Felenda */ public class SmartEnter extends EditorTestCase { private final int keyCode = KeyEvent.VK_ENTER; private final String sampleFileName = "SampleSmartEnter"; /** Creates a new instance of Main */ public SmartEnter() { super("testSmartEnter"); } public void testSmartEnter(){ openProject(); openFile("Source packages|test",sampleFileName); EditorWindowOperator editorWindow = new EditorWindowOperator(sampleFileName); EditorOperator editor = editorWindow.selectPage(sampleFileName); // 1. move to adequate place editor.setCaretPosition(5,28); // 2. hit Enter JEditorPaneOperator txtOper = editor.txtEditorPane(); txtOper.pushKey(keyCode); if ( editor.getText(5).trim().equals("public String str=\"abcde\" +") && editor.getText(6).trim().equals("\"123456\";") ) { log("Ok diff."); } else { assertTrue("Files differs",true); } closeFileWithDiscard(); } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here SmartEnter test = new SmartEnter(); test.run(); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.