示例#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);
  }