コード例 #1
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 public void compareGoldenFile() throws IOException, InterruptedException {
   File fGolden = null;
   if (!generateGoldenFiles) {
     fGolden = getGoldenFile(testClass + ".pass");
   } else {
     fGolden = getNewGoldenFile();
   }
   String refFileName = getName() + ".ref";
   String diffFileName = getName() + ".diff";
   File fRef = new File(getWorkDir(), refFileName);
   Thread.sleep(1000);
   FileWriter fw = new FileWriter(fRef);
   fw.write(oper.getText());
   fw.close();
   Thread.sleep(1000);
   // LineDiff diff = new LineDiff(false);
   if (!generateGoldenFiles) {
     File fDiff = new File(getWorkDir(), diffFileName);
     System.out.println("fRef file is: " + fRef);
     System.out.println("fGolden file is: " + fGolden);
     System.out.println("fDiff file is: " + fDiff);
     assertFile(fRef, fGolden, fDiff);
     Thread.sleep(1000);
     // if(diff.diff(fGolden, fRef, fDiff)) fail("Golden files differ");
   } else {
     FileWriter fwgolden = new FileWriter(fGolden);
     fwgolden.write(oper.getText());
     fwgolden.close();
     fail("Golden file generated");
   }
 }
コード例 #2
0
 public void testPhp54TraitsSameFile() {
   EditorOperator file = CreatePHPFile(TEST_PHP_NAME, "PHP File", null);
   startTest();
   file.setCaretPosition("*/", false);
   TypeCode(
       file,
       "trait Test{ \n public function test(){} \n } \n class Foo{ \n use Test; \n function bar(){\n $this->");
   file.typeKey(' ', InputEvent.CTRL_MASK);
   new EventTool().waitNoEvent(1000);
   CompletionInfo jCompl = GetCompletion();
   String[] ideal = {"test", "bar"};
   CheckCompletionItems(jCompl.listItself, ideal);
   endTest();
 }
コード例 #3
0
  protected void expandFoldAtCaretPosition(EditorOperator editor, int line, int column) {
    // 1. move to adequate place
    editor.setCaretPosition(line, column);

    // 2. hit CTRL +
    JEditorPaneOperator txtOper = editor.txtEditorPane();
    txtOper.pushKey(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK);

    JTextComponentOperator text = new JTextComponentOperator(editor);
    JTextComponent target = (JTextComponent) text.getSource();

    // give max 500 milis to fold to expand
    waitMaxMilisForValue(500, getResolver(target), Boolean.FALSE);
  }
コード例 #4
0
 public void testPhp54TraitsDifferentFile() {
   EditorOperator file = CreatePHPFile(TEST_PHP_NAME, "PHP File", "TraitTest");
   startTest();
   file.setCaretPosition("*/", false);
   TypeCode(file, "\n namespace testA; \n trait Test{ \n public function test(){}");
   file.save();
   file = CreatePHPFile(TEST_PHP_NAME, "PHP File", "TraitTest2");
   file.setCaretPosition("*/", false);
   TypeCode(file, "\n class Bar{ \n use testA\\Test; \n public function testfoo(){\n $this->");
   file.typeKey(' ', InputEvent.CTRL_MASK);
   new EventTool().waitNoEvent(1000);
   CompletionInfo jCompl = GetCompletion();
   String[] ideal = {"test", "testfoo"};
   CheckCompletionItems(jCompl.listItself, ideal);
   endTest();
 }
コード例 #5
0
 @Override
 public void initialize() {
   EditorOperator.closeDiscardAll();
   new OpenAction()
       .performPopup(
           new Node(
               new SourcePackagesNode("PerformanceTestData"),
               "org.netbeans.test.performance|Main.java"));
   editorOperator = new EditorOperator("Main.java");
 }
コード例 #6
0
  public void testDeployment() throws IOException {
    final String CONTROL_TEXT = "ControlTextABC";
    Node openFile =
        new Node(
            new ProjectsTabOperator().getProjectRootNode(EJBValidation.EJB_PROJECT_NAME),
            Bundle.getStringTrimmed(
                    "org.netbeans.modules.j2ee.ejbjar.project.ui.Bundle", "LBL_node")
                + "|TestingSession");
    new OpenAction().performAPI(openFile);
    EditorOperator editorOper = new EditorOperator("TestingSessionBean.java");
    editorOper.replace("return null;", "return \"" + CONTROL_TEXT + "\";");

    openFile =
        new Node(new SourcePackagesNode(EJBValidation.WEB_PROJECT_NAME), "test|TestingServlet");
    new OpenAction().performAPI(openFile);
    editorOper = new EditorOperator("TestingServlet.java");
    editorOper.replace(
        "out.println(\"</body>\");",
        "out.println(lookupTestingSessionBeanLocal().testBusinessMethod1());");

    // select in Files view to prevent unstable scrolling in low display resolution
    openFile =
        new Node(
            FilesTabOperator.invoke().getProjectNode(EJBValidation.EJB_PROJECT_NAME),
            "src|java|test|TestingEntityRemote.java");
    new OpenAction().performAPI(openFile);
    editorOper = new EditorOperator("TestingEntityRemote.java");
    editorOper.replace("int getCmpTestField2x();", "int getCmpTestField2x() throws Exception;");
    editorOper.replace(
        "void setCmpTestField2x(int cmpTestField2x);",
        "void setCmpTestField2x(int cmpTestField2x) throws Exception;");

    String page =
        Utils.deploy(
            EAR_PROJECT_NAME, "http://localhost:8080/TestingEntApp-WebModule/TestingServlet", true);
    log(page);
    assertTrue(
        "TestingServlet doesn't contain expected text '"
            + CONTROL_TEXT
            + "'. See log for page content.",
        page.contains(CONTROL_TEXT));
  }
コード例 #7
0
  protected void expandAllFolds(EditorOperator editor) {
    // hit CTRL Shift +
    JEditorPaneOperator txtOper = editor.txtEditorPane();
    txtOper.pushKey(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK);

    // wait a while
    try {
      Thread.currentThread().sleep(COLLAPSE_EXPAND_DELAY);
    } catch (InterruptedException ex) {
    }
  }
コード例 #8
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
  @Override
  public void setUp() throws IOException {
    super.setUp();
    testClass = getName();
    System.out.println(testClass);
    System.out.println(curPackage);
    setTestPackageName(curPackage);
    openFile(testClass);
    FormDesignerOperator fdo = new FormDesignerOperator(testClass);

    oper = fdo.editor();
    oper.txtEditorPane().setVerification(false);
  }
コード例 #9
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 public void testAdvancedIndentation() {
   oper.setCaretPosition(120, 1);
   end();
   enter();
   enter();
   type("public void method(");
   end();
   type(" {");
   enter();
   type("while(true");
   end();
   type(" {");
   enter();
   type("if(true");
   end();
   enter();
   type("if(false");
   end();
   type(" {");
   enter();
   type("int i = ");
   enter();
   type("1;");
 }
コード例 #10
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 private void enter() {
   oper.pushKey(KeyEvent.VK_ENTER);
 }
コード例 #11
0
 public void closeProjects() {
   EditorOperator.closeDiscardAll();
   J2eeProjectSupport.closeProject(EAR_PROJECT_NAME);
   J2eeProjectSupport.closeProject(EJB_PROJECT_NAME);
   J2eeProjectSupport.closeProject(WEB_PROJECT_NAME);
 }
コード例 #12
0
 public void prepare() {
   editorOperator.txtEditorPane().typeText("XXX");
 }
コード例 #13
0
 @Override
 public void shutdown() {
   EditorOperator.closeDiscardAll();
 }
コード例 #14
0
 @Override
 public void initialize() {
   log(":: initialize");
   EditorOperator.closeDiscardAll();
   pto = ProjectsTabOperator.invoke();
 }
コード例 #15
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 private void type(String text) {
   oper.txtEditorPane().typeText(text);
 }
コード例 #16
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 private void end() {
   oper.pushEndKey();
 }
コード例 #17
0
ファイル: BasicTest.java プロジェクト: JSansalone/NetBeansIDE
 public void testBasicIndentation() {
   oper.setCaretPosition(279, 1);
   oper.pushEndKey();
   oper.pushKey(KeyEvent.VK_ENTER);
   oper.pushKey(KeyEvent.VK_ENTER);
   oper.txtEditorPane().typeText("public void method(boolean cond1");
   oper.pushEndKey();
   oper.txtEditorPane().typeText("{");
   oper.pushKey(KeyEvent.VK_ENTER);
   oper.txtEditorPane().typeText("if(cond1");
   oper.pushEndKey();
   oper.txtEditorPane().typeText("sout");
   oper.pushTabKey();
   oper.txtEditorPane().typeText("Hello");
   oper.pushEndKey();
 }