Package org.openscience.jchempaint.matchers

Examples of org.openscience.jchempaint.matchers.ButtonTextComponentMatcher


    @Test public void testUndoTemplates() throws CloneNotSupportedException{
      applet.menuItem("new").click();
        models.add((IChemModel)panel.getChemModel());
        applet.menuItem("pasteTemplate").click();
        DialogFixture dialog = applet.dialog("templates");
        JButtonFixture templateButton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Cysteine")));
        templateButton.click();
        Assert.assertEquals(7,totalAtomCount());
        Assert.assertEquals(1,panel.getChemModel().getMoleculeSet().getAtomContainerCount());
       
        applet.menuItem("pasteTemplate").click();
        dialog = applet.dialog("templates");
        templateButton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Leucine")));
        templateButton.click();
        Assert.assertEquals(16,totalAtomCount());
        Assert.assertEquals(2,panel.getChemModel().getMoleculeSet().getAtomContainerCount());

        applet.button("undo").click();
View Full Code Here


        DialogFixture dialog = applet.dialog();
        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 okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Save")));
        okbutton.click();
        //not the bug, but still worth testing
        MDLReader reader = new MDLReader(new FileInputStream(file));
        IAtomContainer mol = (IAtomContainer)reader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
        Assert.assertEquals(panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtomCount(), mol.getAtomCount());
        Assert.assertEquals(panel.getChemModel().getMoleculeSet().getAtomContainer(0).getBondCount(), mol.getBondCount());
        applet.menuItem("new").click();
        applet.button("hexagon").click();
        applet.click();
        applet.button("bondTool").click();
        Point2d moveto=getAtomPoint(panel,0);   
        applet.panel("renderpanel").robot.click(applet.panel("renderpanel").component(), new Point((int)moveto.x,(int)moveto.y), MouseButton.LEFT_BUTTON,1);
        applet.menuItem("saveAs").click();
        dialog = applet.dialog();
        combobox = dialog.robot.finder().find(new ComboBoxTextComponentMatcher("org.openscience.jchempaint.io.JCPFileFilter"));
        combobox.setSelectedItem(combobox.getItemAt(SAVE_AS_MOL_COMBOBOX_POS));
        text = dialog.textBox();
        file=new File(System.getProperty("java.io.tmpdir")+File.separator+"test2.mol");
        if(file.exists())
            file.delete();
        text.setText(file.toString());
        okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Save")));
        okbutton.click();
        //not the bug, but still worth testing
        reader = new MDLReader(new FileInputStream(file));
        mol = (IAtomContainer)reader.read(DefaultChemObjectBuilder.getInstance().newInstance(IAtomContainer.class));
        Assert.assertEquals(panel.getChemModel().getMoleculeSet().getAtomContainer(0).getAtomCount(), mol.getAtomCount());
        Assert.assertEquals(panel.getChemModel().getMoleculeSet().getAtomContainer(0).getBondCount(), mol.getBondCount());
        //ok, now the critical bits - open mol1
        file=new File(System.getProperty("java.io.tmpdir")+File.separator+"test1.mol");
        applet.menuItem("open").click();
        dialog = applet.dialog();
        text = dialog.textBox();
        text.setText(file.toString());
        okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Open")));
        okbutton.click();
        //"save as" mol1
        file.delete();
        applet.menuItem("saveAs").click();
        dialog = applet.dialog();
        combobox = dialog.robot.finder().find(new ComboBoxTextComponentMatcher("org.openscience.jchempaint.io.JCPFileFilter"));
        combobox.setSelectedItem(combobox.getItemAt(SAVE_AS_MOL_COMBOBOX_POS));
        text = dialog.textBox();
        text.setText(file.toString());
        okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Save")));
        okbutton.click();
        //open mol2
        file=new File(System.getProperty("java.io.tmpdir")+File.separator+"test2.mol");
        applet.menuItem("open").click();
        dialog = applet.dialog();
        text = dialog.textBox();
        text.setText(file.toString());
        okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Open")));
        okbutton.click();
        //save should write to mol2, ie mol1=6 atoms, mol2=7atoms
        applet.menuItem("save").click();
        file=new File(System.getProperty("java.io.tmpdir")+File.separator+"test1.mol");
        reader = new MDLReader(new FileInputStream(file));
View Full Code Here

        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));
  }
View Full Code Here

                    index = i;
              Assert.assertFalse(index < 0);
              combobox.setSelectedIndex(index);
        JTextComponentFixture text = dialog.textBox();
        text.setText(file.toString());
        JButtonFixture okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Save")));
        okbutton.click();
        MDLReader reader = null;
        try {
          reader = new MDLReader(new FileInputStream(file));
        } catch (Exception e) {
View Full Code Here

                fos.write(ins.read());
          applet.menuItem("open").click();
          DialogFixture dialog = applet.dialog();
          JTextComponentFixture text = dialog.textBox();
          text.setText(file.toString());
          JButtonFixture okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Open")));
          okbutton.click();
              ins = this.getClass().getClassLoader().getResourceAsStream(filename);
              MDLV2000Reader reader = new MDLV2000Reader(ins, Mode.STRICT);
              ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
              Assert.assertNotNull(chemFile);
View Full Code Here

              //it seems the Combo selection depends on if you run test as single test or all in class, no idea why
              //JComboBox combobox = dialog.robot.finder().find(new ComboBoxTextComponentMatcher("org.openscience.jchempaint.io.JCPFileFilter","org.openscience.jchempaint.io.JCPSaveFileFilter"));
                  //combobox.setSelectedItem(combobox.getItemAt(2));
              JTextComponentFixture text = dialog.textBox();
              text.setText(file.toString());
              JButtonFixture okbutton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Open")));
              okbutton.click();
              DialogFixture coordsdialog = new DialogFixture(applet.robot, applet.robot.finder().find(new DialogTitleComponentMatcher("No 2D coordinates")));
              JButtonFixture okbuttoncoordsdialog = new JButtonFixture(coordsdialog.robot, coordsdialog.robot.finder().find(new ButtonTextComponentMatcher("Yes")));
              okbuttoncoordsdialog.click();
                  ins = this.getClass().getClassLoader().getResourceAsStream(filename);
                  SMILESReader reader = new SMILESReader(ins);
                  ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
                  Assert.assertNotNull(chemFile);
View Full Code Here

   
      @Test public void testMenuTemplatesAll() throws CDKException, ClassNotFoundException, IOException, CloneNotSupportedException {
            restoreModelWithBasicmol();
            applet.menuItem("pasteTemplate").click();
            DialogFixture dialog = applet.dialog("templates");
            JButtonFixture morphineButton = new JButtonFixture(dialog.robot, dialog.robot.finder().find(new ButtonTextComponentMatcher("Morphine")));
            morphineButton.click();
            Assert.assertEquals(2,panel.getChemModel().getMoleculeSet().getAtomContainerCount());
            Assert.assertEquals(22,panel.getChemModel().getMoleculeSet().getAtomContainer(1).getAtomCount());
      }
View Full Code Here

TOP

Related Classes of org.openscience.jchempaint.matchers.ButtonTextComponentMatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.