1 19 20 package org.netbeans.test.editor.suites.keybindings; 21 22 import java.io.File ; 23 import java.io.FileWriter ; 24 import java.io.PrintWriter ; 25 import java.util.*; 26 import java.util.List ; 27 import org.netbeans.jellytools.*; 28 import org.netbeans.jellytools.EditorOperator; 29 import org.netbeans.jellytools.modules.editor.Abbreviations; 30 import org.netbeans.jellytools.modules.editor.KeyBindings; 31 import org.netbeans.test.editor.LineDiff; 32 33 39 public class CheckActionsListPerformer extends JellyTestCase { 40 41 public static String [] TESTED_EDITORS={"Java Editor","Plain Editor","HTML Editor"}; 42 String editorName; 43 44 public CheckActionsListPerformer(String name) { 45 super(name); 46 } 47 48 51 public void doTest() throws Exception { 52 log("doTest start"); 53 log("Editor name: "+editorName); 54 try { 55 Hashtable table; 56 log("Grabbing actions..."); 57 table = KeyBindings.listAllKeyBindings(editorName); 58 Object [] keys=table.keySet().toArray(); 59 Arrays.sort(keys); 60 List list; 61 log("Writting to ref file..."); 62 File f=new File (getWorkDir(),editorName+" actions.ref"); 63 PrintWriter pw=new PrintWriter (new FileWriter (f)); 64 for (int i=0;i < keys.length;i++) { 65 pw.print(keys[i]+": "); 66 list=(List )table.get(keys[i]); 67 for (int j=0;j < list.size();j++) { 68 pw.print(list.get(j)+" "); 69 } 70 pw.println(); 71 } 72 pw.close(); 73 } finally { 74 log("doTest finished"); 75 } 76 } 77 78 public void setUp() { 79 log("Starting check Key Bindings actions test."); 80 } 81 82 public void tearDown() throws Exception { 83 log("Ending check Key Bindings actions test."); 84 File ref=new File (getWorkDir(),editorName+" actions.ref"); 85 assertFile("Some actions aren't same as before the split.", getGoldenFile(editorName+" actions.pass"), ref, new File (getWorkDir(),editorName+" actions.diff"), new LineDiff(false)); 86 ref.delete(); 87 } 88 89 public void testCheckPlainActions() throws Exception { 90 editorName="Plain Editor"; 91 doTest(); 92 } 93 94 public void testCheckJavaActions() throws Exception { 95 editorName="Java Editor"; 96 doTest(); 97 } 98 99 public void testCheckHTMLActions() throws Exception { 100 editorName="HTML Editor"; 101 doTest(); 102 } 103 104 public static void main(String [] args) throws Exception { 105 } 107 108 } 109 | Popular Tags |