Package org.fest.swing.fixture

Examples of org.fest.swing.fixture.JTableFixture


        assertThat(paramTableInResourceEditor.cell(row(rowNum).column(1)).value(), is(paramValue));

    }

    private void verifyParamStyles(JPanelFixture parentPanel, int rowNum, String paramName, String paramStyle) {
        JTableFixture paramTableInResourceEditor = parentPanel.table(REST_PARAMS_TABLE);
        assertThat(paramTableInResourceEditor.cell(row(rowNum).column(0)).value(), is(paramName));
        assertThat(paramTableInResourceEditor.cell(row(rowNum).column(2)).value(), is(paramStyle));
    }
View Full Code Here


    public void testCutCopyPasteBetweenLibraries() throws InterruptedException {
        guiHandler.installDevice("Roland", "Roland D-50");
        guiHandler.installDevice("Yamaha", "Yamaha DX7");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        guiHandler.newPatch(library, "Yamaha DX7",
                YamahaDX7VoiceSingleDriver.class, listener);

        FrameWrapper library2 = guiHandler.openLibrary();
        JTableFixture table2 = library2.table();

        assertEquals(2, table.contents().length);
        assertEquals(0, table2.contents().length);

        guiHandler.cutCopyPastePatch(library, 0, 0, library2, false);

        assertEquals(1, table.contents().length);
        assertEquals(1, table2.contents().length);

        guiHandler.cutCopyPastePatch(library, 0, 0, library2, true);

        assertEquals(1, table.contents().length);
        assertEquals(2, table2.contents().length);

        guiHandler.closeLibrary(library);
        guiHandler.closeLibrary(library2);

        guiHandler.uninstallDevice(null);
View Full Code Here

    @Test
    public void testCutCopyPasteBetweenBanks() throws InterruptedException {
        guiHandler.installDevice("Yamaha", "Yamaha DX7");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Yamaha DX7",
                YamahaDX7VoiceBankDriver.class, listener);
        FrameWrapper bank1 =
View Full Code Here

    @Test
    public void testDragNDropBetweenBanks() throws InterruptedException {
        guiHandler.installDevice("Yamaha", "Yamaha DX7");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Yamaha DX7",
                YamahaDX7VoiceBankDriver.class, listener);
        FrameWrapper bank1 =
View Full Code Here

        guiHandler.installDevice("Roland", "Roland D-50");
        guiHandler.installDevice("Yamaha", "Yamaha DX7");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        guiHandler.newPatch(library, "Yamaha DX7",
                YamahaDX7VoiceSingleDriver.class, listener);

        guiHandler.addPatchMetaData(library, 0, GuiHandler.FIELD1, rolandData1);
        guiHandler.addPatchMetaData(library, 1, GuiHandler.FIELD1, yamahaData1);

        table.cell(TableCell.row(0).column(0)).requireValue("D-50");
        table.cell(TableCell.row(1).column(0)).requireValue("DX7");

        guiHandler.sortLibrary(library, SortFields.PATCH_NAME);

        String[][] contents = table.contents();
        assertEquals("Check table size", 2, contents.length);
        table.cell(TableCell.row(0).column(0)).requireValue("DX7");
        table.cell(TableCell.row(1).column(0)).requireValue("D-50");

        guiHandler.sortLibrary(library, SortFields.FIELD1);

        contents = table.contents();
        assertEquals("Check table size", 2, contents.length);
        table.cell(TableCell.row(0).column(0)).requireValue("D-50");
        table.cell(TableCell.row(1).column(0)).requireValue("DX7");

        guiHandler.closeLibrary(library);
        guiHandler.uninstallDevice(null);
    }
View Full Code Here

        guiHandler.installDevice("Roland", "Roland D-50");
        guiHandler.installDevice("Yamaha", "Yamaha DX7");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        guiHandler.newPatch(library, "Yamaha DX7",
                YamahaDX7VoiceSingleDriver.class, listener);

        guiHandler.addPatchMetaData(library, 0, GuiHandler.FIELD1, rolandData1);
        guiHandler.addPatchMetaData(library, 1, GuiHandler.FIELD1, yamahaData1);

        ISearchHandler searchHandler = guiHandler.openSearchDialog(library);
        searchHandler.setField(SearchFields.PATCH_NAME);
        searchHandler.findFirst("INIT");
        table.requireSelectedRows(1);
        searchHandler.findNext();

        GenericTypeMatcher<JDialog> matcher =
                new GenericTypeMatcher<JDialog>(JDialog.class) {

                    @Override
                    protected boolean isMatching(JDialog component) {
                        return "Search Complete".equals(component.getTitle())
                                && component.isShowing();
                    }
                };

        DialogFixture dialog = testFrame.dialog(matcher);
        guiHandler.closeDialog(dialog);

        searchHandler.setField(SearchFields.FIELD1);
        searchHandler.findFirst("Roland");
        table.requireSelectedRows(0);

        searchHandler.setField(SearchFields.ALL_FIELDS);
        searchHandler.findFirst("Yamaha");
        table.requireSelectedRows(1);

        searchHandler.findFirst("Testingtesting");
        dialog = testFrame.dialog(matcher);
        guiHandler.closeDialog(dialog);
View Full Code Here

            guiHandler.closeLibrary(library);
        }
    }

    void verifyBankEditorNames(FrameWrapper bankEditor) {
        JTableFixture table = bankEditor.table();
        String[][] contents = table.contents();
        int[] testedRows = {
                0, contents.length / 2 };
        int[] testedCols = {
                0, contents[0].length / 2 };
        HashSet<TableCell> testedCells = new HashSet<TableCell>();
        for (int row : testedRows) {
            for (int col : testedCols) {
                String patchName = "PN " + row + " " + col;
                TableCellBuilder cellBuilder = TableCell.row(row);
                TableCell tableCell = cellBuilder.column(col);
                if (testedCells.contains(tableCell)) {
                    LOG.info("Skipping already tested patch on " + row
                            + " row " + col + " col.");
                    continue;
                }

                testedCells.add(tableCell);
                LOG.info("Selecting patch on " + row + " row " + col + " col.");
                table.cell(tableCell).enterValue(patchName);
                table.cell(tableCell).requireValue(
                        "[\\w\\-]+\\s+" + patchName + "\\s*");
                FrameWrapper patchEditor = null;
                try {
                    patchEditor =
                            guiHandler.openPatchEditor(table, row, col,
View Full Code Here

        Pattern pattern =
                Pattern.compile("(\\d+) Patches and Scenes were deleted");
        guiHandler.installDevice("Roland", "Roland D-50");

        FrameWrapper library = guiHandler.openLibrary();
        JTableFixture table = library.table();
        Thread.sleep(100);

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        String[][] contents = table.contents();
        int rows = contents.length;
        assertEquals(1, rows);

        JMenuItemFixture menuItem =
                testFrame.menuItem(new GenericTypeMatcher<JMenuItem>(
                        JMenuItem.class) {

                    @Override
                    protected boolean isMatching(JMenuItem component) {
                        return component.getActionCommand().equals(
                                "Delete Dups...");
                    }
                });
        assertFalse(menuItem.target.isEnabled());

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        contents = table.contents();
        rows = contents.length;
        assertEquals(2, rows);

        String deleteDups = guiHandler.deleteDups();
        Matcher matcher = pattern.matcher(deleteDups);
        assertTrue(matcher.find());
        int numDeleted = Integer.parseInt(matcher.group(1));
        assertEquals(1, numDeleted);
        contents = table.contents();
        rows = contents.length;
        assertEquals(1, rows);

        guiHandler.newPatch(library, "Roland D-50", D50SingleDriver.class,
                listener);
        contents = table.contents();
        rows = contents.length;
        assertEquals(2, rows);

        FrameWrapper patchEditor =
                guiHandler.openPatchEditor(table, -1, 0, listener, false);

        List<SysexWidget> sysexWidgets =
                SysexWidgetFinder.findSysexWidgets(patchEditor);
        int numEditedParams = 0;
        for (final SysexWidget sysexWidget : sysexWidgets) {
            if (sysexWidget instanceof CheckBoxWidget) {
                CheckBoxWidget widget = (CheckBoxWidget) sysexWidget;
                final JCheckBoxFixture fixture =
                        new JCheckBoxFixture(testFrame.robot, widget.cb);
                if (fixture.target.isEnabled()) {
                    new SwingCheckBoxValueSetter(fixture, widget.getValueMin())
                            .setValue(widget.getValueMax());
                    numEditedParams++;
                }
            } else if (sysexWidget instanceof ComboBoxWidget) {
                ComboBoxWidget widget = (ComboBoxWidget) sysexWidget;

                final JComboBoxFixture fixture =
                        new JComboBoxFixture(testFrame.robot, widget.cb);
                if (fixture.target.isEnabled()) {
                    new SwingComboBoxValueSetter(fixture, widget.getValueMin())
                            .setValue(widget.getValueMax());
                    numEditedParams++;
                }
            } else if (sysexWidget instanceof KnobWidget) {
                KnobWidget widget = (KnobWidget) sysexWidget;
                if (widget.isEnabled()) {
                    new SwingKnobValueSetter(widget).setValue(widget.getValueMax());
                    numEditedParams++;
                }
            } else if (sysexWidget instanceof ScrollBarWidget) {
                ScrollBarWidget widget = (ScrollBarWidget) sysexWidget;
                final JSliderFixture fixture =
                        new JSliderFixture(testFrame.robot, widget.slider);
                if (fixture.target.isEnabled()) {
                    new SwingSliderValueSetter(fixture).setValue(widget
                            .getValueMax());
                    numEditedParams++;
                }
            }

            if (numEditedParams == 2) {
                break;
            }
        }

        if (patchEditor != null) {
            log.info("Close patch editor frame");
            guiHandler.closeFrame(patchEditor, true);
        }
        if (library != null) {
            log.info("Selecting library frame");
            guiHandler.selectLibraryFrame(library);
        }

        deleteDups = guiHandler.deleteDups();
        matcher = pattern.matcher(deleteDups);
        assertTrue(matcher.find());
        numDeleted = Integer.parseInt(matcher.group(1));
        assertEquals(0, numDeleted);
        contents = table.contents();
        rows = contents.length;
        assertEquals(2, rows);

        guiHandler.closeLibrary(library);
        guiHandler.uninstallDevice("Roland D-50");
View Full Code Here

        assertTrue("XML is file", xml.isFile());

        guiHandler.closeLibrary(library);

        FrameWrapper library2 = guiHandler.openLibrary(patchlib);
        JTableFixture table = library2.table();

        String[][] contents = table.contents();
        assertEquals("Check table size", 3, contents.length);
        TableCell tableCell = TableCell.row(0).column(0);
        table.cell(tableCell).requireValue("D-50");
        tableCell = TableCell.row(1).column(0);
        table.cell(tableCell).requireValue("D-10");
        tableCell = TableCell.row(2).column(0);
        table.cell(tableCell).requireValue("DX7");

        guiHandler.closeLibrary(library2);

        guiHandler.uninstallDevice(null);
    }
View Full Code Here

        assertTrue("XML is file", xml.isFile());

        guiHandler.closeLibrary(library);

        FrameWrapper library2 = guiHandler.openLibrary(patchlib);
        JTableFixture table = library2.table();

        String[][] contents = table.contents();
        assertEquals("Check table size", 2, contents.length);
        table.cell(TableCell.row(0).column(0)).requireValue("D-50");
        table.cell(TableCell.row(0).column(3)).requireValue(rolandData1);
        table.cell(TableCell.row(0).column(4)).requireValue(rolandData2);
        table.cell(TableCell.row(0).column(5)).requireValue(rolandComment);
        table.cell(TableCell.row(1).column(0)).requireValue("DX7");
        table.cell(TableCell.row(1).column(3)).requireValue(yamahaData1);
        table.cell(TableCell.row(1).column(4)).requireValue(yamahaData2);
        table.cell(TableCell.row(1).column(5)).requireValue(yamahaComment);

        guiHandler.closeLibrary(library2);

        guiHandler.uninstallDevice(null);
    }
View Full Code Here

TOP

Related Classes of org.fest.swing.fixture.JTableFixture

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.