1 19 20 package gui.action; 21 22 import java.awt.event.KeyEvent ; 23 24 import org.netbeans.jellytools.EditorOperator; 25 import org.netbeans.jellytools.EditorWindowOperator; 26 import org.netbeans.jellytools.ProjectsTabOperator; 27 import org.netbeans.jellytools.nodes.Node; 28 import org.netbeans.jellytools.actions.ActionNoBlock; 29 import org.netbeans.jellytools.actions.Action.Shortcut; 30 import org.netbeans.jellytools.actions.OpenAction; 31 32 import org.netbeans.jemmy.operators.ComponentOperator; 33 import org.netbeans.modules.editor.options.BaseOptions; 34 import org.netbeans.modules.web.core.syntax.JSPKit; 35 import org.netbeans.modules.web.core.syntax.settings.JSPOptions; 36 import org.netbeans.test.web.performance.WebPerformanceTestCase; 37 38 39 44 public class PageUpPageDownInJspEditor extends WebPerformanceTestCase { 45 private boolean pgup; 46 private String file; 47 48 49 public PageUpPageDownInJspEditor(String file, String testName) { 50 super(testName); 51 pgup = true; 52 this.file = file; 53 init(); 54 } 55 56 57 public PageUpPageDownInJspEditor(String file, String testName, String performanceDataName, boolean up) { 58 super(testName, performanceDataName); 59 pgup = up; 60 this.file = file; 61 init(); 62 } 63 64 protected void init() { 65 super.init(); 66 expectedTime = UI_RESPONSE; 67 } 68 69 private EditorOperator editorOperator; 70 private int statusBarCaretDelay; 71 private boolean codeFoldindEnabled; 72 73 protected void initialize() { 74 EditorOperator.closeDiscardAll(); 75 jspOptions().setCaretBlinkRate(0); 76 jspOptions().setStatusBarCaretDelay(0); 78 jspOptions().setCodeFoldingEnable(false); 79 new OpenAction().performAPI(new Node(new ProjectsTabOperator().getProjectRootNode("TestWebProject"),"Web Pages|"+file)); 81 editorOperator = new EditorWindowOperator().getEditor(file); 82 JSPOptions options = (JSPOptions) BaseOptions.getOptions(JSPKit.class); 84 statusBarCaretDelay = options.getStatusBarCaretDelay(); 85 options.setStatusBarCaretDelay(0); 86 codeFoldindEnabled = options.getCodeFoldingEnable(); 87 options.setCodeFoldingEnable(false); 88 waitNoEvent(2000); 89 } 90 91 public void prepare() { 92 System.out.println("=== " + this.getClass().getName() + " ==="); 93 if (pgup) 95 new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_END, KeyEvent.CTRL_MASK)).perform(editorOperator); 97 else 98 editorOperator.setCaretPositionToLine(1); 100 eventTool().waitNoEvent(500); 101 } 102 103 public ComponentOperator open(){ 104 repaintManager().setOnlyEditor(true); 105 if (pgup) 106 new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_PAGE_UP)).perform(editorOperator); 107 else 108 new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_PAGE_DOWN)).perform(editorOperator); 109 return null; 110 } 111 112 protected void shutdown() { 113 editorOperator.closeDiscard(); 114 super.shutdown(); 115 } 116 } 117
| Popular Tags
|