コード例 #1
0
 @Test
 public void testBug70() throws FileNotFoundException, CDKException {
   JPanelFixture jcppanel = applet.panel("appletframe");
   JChemPaintPanel panel = (JChemPaintPanel) jcppanel.target;
   applet.button("hexagon").click();
   applet.click();
   Point2d point = getAtomPoint(panel, 0);
   applet
       .panel("renderpanel")
       .robot
       .click(
           applet.panel("renderpanel").component(),
           new Point((int) point.x, (int) point.y),
           MouseButton.RIGHT_BUTTON,
           1);
   applet
       .panel("renderpanel")
       .robot
       .click(
           applet.panel("renderpanel").component(),
           new Point((int) point.x, (int) point.y),
           MouseButton.RIGHT_BUTTON,
           1);
   applet.menuItem("showACProperties").click();
   DialogFixture dialog = applet.dialog();
   JTextComponent textfield = dialog.robot.finder().find(JTextComponentMatcher.withName("Title"));
   textfield.setText("aaa");
   JButtonFixture okbutton =
       new JButtonFixture(
           dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("OK")));
   okbutton.click();
   applet.menuItem("save").click();
   dialog = applet.dialog();
   File file = new File(System.getProperty("java.io.tmpdir") + File.separator + "test.mol");
   if (file.exists()) file.delete();
   JComboBox combobox =
       dialog
           .robot
           .finder()
           .find(new ComboBoxTextComponentMatcher("org.openscience.jchempaint.io.JCPFileFilter"));
   combobox.setSelectedItem(combobox.getItemAt(SAVE_AS_MOL_COMBOBOX_POS));
   JTextComponentFixture text = dialog.textBox();
   text.setText(file.toString());
   JButtonFixture savebutton =
       new JButtonFixture(
           dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Save")));
   savebutton.click();
   MDLReader reader = new MDLReader(new FileInputStream(file));
   IAtomContainer mol =
       (IAtomContainer)
           reader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
   Assert.assertEquals("aaa", (String) mol.getProperty(CDKConstants.TITLE));
 }
  public void findEntryBoxAndEnterValue(String name, double value) {
    JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel");
    JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox");
    JTextComponentFixture textBox = enumEntryBox.textBox();

    // For some reason deleting, and then entering doesn't seem to work. It only deletes part of the
    // text!?
    // Instead here we have to call setText.
    // textBox.deleteText();
    // textBox.enterText(Double.toString(value) + "\n");

    textBox.setText(Double.toString(value));
    textBox.enterText("\n");
    ThreadTools.sleep(500);
  }
コード例 #3
0
ファイル: UIBug493Test.java プロジェクト: smidget/openshapa
  /** Bug 493 test. */
  @Test
  public void testBug493() {
    System.err.println(new Exception().getStackTrace()[0].getMethodName());

    String varName = "t";
    String varType = "TEXT";
    String varRadio = varType.toLowerCase() + "TypeButton";

    String[] testInput = {
      "Subject stands up ", "$10,432", "Hand me the manual!",
      "Tote_that_bale", "Jeune fille celebre", "If x?7 then x? 2"
    };

    String[] expectedTestOutput = testInput;

    // 1. Create new TEXT variable
    mainFrameFixture.createNewVariable(varName, varRadio);

    // 2. Check that a column has been created
    JPanelFixture ssPanel = mainFrameFixture.getSpreadsheet();

    // Find our new column header
    JLabelFixture column = ssPanel.panel("headerView").label();

    // 3. Create cell, paste text and press enter, for each testInput
    for (int i = 0; i < testInput.length; i++) {

      // a. Create cell
      column.click();
      mainFrameFixture.clickMenuItemWithPath("Spreadsheet", "New Cell");

      // b. Paste text
      UIUtils.setClipboard(testInput[i]);

      JTextComponentFixture cell =
          mainFrameFixture.textBox(JTextComponentMatcher.withText("<val>"));
      cell.click();
      cell.pressAndReleaseKey(
          KeyPressInfo.keyCode(KeyEvent.VK_V).modifiers(Platform.controlOrCommandMask()));

      // c. Press Enter
      mainFrameFixture.robot.pressKey(KeyEvent.VK_ENTER);

      // d. Check text
      Assert.assertEquals(cell.text(), expectedTestOutput[i] + "\n");
    }
  }
コード例 #4
0
  @Test
  public void testTextArea() throws InterruptedException, InvocationTargetException {
    printlnMethodName();
    final JTextComponentFixture taFixture = new JTextComponentFixture(robot(), getTA("ta"));
    taFixture.requireNotEditable();
    taFixture.requireEmpty();
    assertThat(taFixture.component().getName()).isEqualTo("ta");

    Printer.println("not printed line ...");
    taFixture.requireEmpty();
    assertThat(out.toString()).isEqualTo("not printed line ..." + getLineSeparator());
    out.reset();

    activate(taFixture);

    Printer.println("printed line ...");
    taFixture.requireText("printed line ..." + getLineSeparator());
    assertThat(out.toString()).isEmpty();

    reset(taFixture);
    taFixture.requireEmpty();

    SwingUtilities.invokeAndWait(
        new Runnable() {
          public void run() {
            Printer.println("printed another line ...");
          }
        });
    taFixture.requireText("printed another line ..." + getLineSeparator());
    assertThat(out.toString()).isEmpty();

    Printer.println("printed line ...");
    taFixture.requireText(
        "printed another line ..." + getLineSeparator() + "printed line ..." + getLineSeparator());
    assertThat(out.toString()).isEmpty();
  }
コード例 #5
0
ファイル: DesignStudy.java プロジェクト: rajarshinath/egonet
  private static void createQuestionTitleQuestionCitation(JPanelFixture fix, boolean alterPair) {
    fix.button(withText("New")).click();

    NameMatcher titleFieldMatcher = new NameMatcher("question_title_field");
    NameMatcher questionFieldMatcher = new NameMatcher("question_question_field");
    NameMatcher citationFieldMatcher = new NameMatcher("question_citation_field");

    JTextComponentFixture titleText =
        new JTextComponentFixture(
            fix.robot, (JTextField) fix.robot.finder().find(fix.component(), titleFieldMatcher));
    titleText.enterText("Question about " + randomString());

    JTextComponentFixture questionText =
        new JTextComponentFixture(
            fix.robot, (JTextArea) fix.robot.finder().find(fix.component(), questionFieldMatcher));
    if (alterPair) questionText.enterText("question - does $$1 " + randomString() + " with $$2?");
    else questionText.enterText("question - does " + randomString() + "?");

    JTextComponentFixture citationText =
        new JTextComponentFixture(
            fix.robot, (JTextArea) fix.robot.finder().find(fix.component(), citationFieldMatcher));
    citationText.enterText(randomString(10));
  }
コード例 #6
0
  @Test
  public void testTextArea() {
    JTextComponentFixture taFixture = new JTextComponentFixture(robot(), getTA("ta", "text"));
    taFixture.requireText("text");
    assertThat(taFixture.component().getName()).isEqualTo("ta");

    taFixture = new JTextComponentFixture(robot(), getTA("", "12"));
    taFixture.requireText("12");
    assertThat(taFixture.component().getName()).isEmpty();

    taFixture = new JTextComponentFixture(robot(), getTA(null, ""));
    taFixture.requireText("");
    assertThat(taFixture.component().getName()).isNull();

    taFixture = new JTextComponentFixture(robot(), getTA("", null));
    taFixture.requireText("");
    assertThat(taFixture.component().getName()).isEmpty();

    taFixture = new JTextComponentFixture(robot(), getTA(""));
    taFixture.requireText("");
    assertThat(taFixture.component().getName()).isEmpty();
  }
 public void enterSearchText(String text) {
   JPanelFixture searchPanel = focusedWindow.panel("SearchPanel");
   JTextComponentFixture searchTextField = searchPanel.textBox("SearchTextField");
   searchTextField.enterText(text);
 }
 public void deleteSearchText() {
   JPanelFixture searchPanel = focusedWindow.panel("SearchPanel");
   JTextComponentFixture searchTextField = searchPanel.textBox("SearchTextField");
   searchTextField.deleteText();
 }