Examples of JTextComponentFixture


Examples of org.fest.swing.fixture.JTextComponentFixture

   
    private void assertTextDisplayContains(JAboutDialog.Category cat, String[] expected) {
        windowFixture.list().clickItem(cat.toString());
        windowFixture.robot.waitForIdle();
       
        JTextComponentFixture textArea = getDialogTextArea();
        final String TEXT = textArea.text();
        for (String s : expected) {
            assertTrue("Did not match " + s, TEXT.contains(s));
        }
    }
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

        if(file.exists())
            file.delete();
        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");
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

        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

Examples of org.fest.swing.fixture.JTextComponentFixture

              for (int i = 0; i < combobox.getModel().getSize(); i++)
                  if (((JCPFileFilter)combobox.getModel().getElementAt(i)).getType() == JCPFileFilter.mol)
                    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));
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

              FileOutputStream fos = new FileOutputStream(file);
              while(ins.available()>0)
                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());
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

              applet.menuItem("open").click();
              DialogFixture dialog = applet.dialog();
              //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();
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

    private final JTextComponentFixture fixture;

    public SwingPatchNameAdapter(PatchNameWidget widget, Robot robot) {
        super(widget);
        fixture =
                new JTextComponentFixture(robot, widget.name);
        setType(Type.PATCH_NAME);
    }
View Full Code Here

Examples of org.fest.swing.fixture.JTextComponentFixture

  public void testInvalidInputDialog()
  {
    final ComponentFinder finder = BasicComponentFinder
        .finderWithCurrentAwtHierarchy();
    JButtonFixture btn = window.button();
    JTextComponentFixture url = window.textBox();
    url.enterText("not a url");
    btn.click();

    window.dialog().requireVisible();

    window.dialog().button().click();

    btn.requireEnabled();
    btn.requireEnabled();

    url.enterText("www.yahoo.com");
    url.pressKey(KeyEvent.VK_ENTER);

    final JFileChooserFixture fc = JFileChooserFinder.findFileChooser()
        .withTimeout(15000).using(window.robot);
    final JButtonFixture fBtn = btn;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.