Examples of FrameFixture


Examples of org.fest.swing.fixture.FrameFixture

     */
    public static FrameFixture getWindowAsChildOf(FrameFixture parentWin) {
        return DisplayProjectTestUtils.findChildWithName(parentWin, cWINDOW_NAME);
    }
    public static FrameFixture getWindowAsAsyncChildOf(FrameFixture parentWin) {
        FrameFixture frame = getWindow(parentWin.robot.finder());
        DisplayProjectTestUtils.pushThreadForAsyncWindow(frame);
        return frame;
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

         LogonWindowWidgets.enterLoginName(rootWindow, "Bill");
         LogonWindowWidgets.enterPassword(rootWindow, "Robinson");
         assertEquals("Bill", LogonWindowWidgets.getActualWindow(rootWindow).getLoginName().toString());
         LogonWindowWidgets.clickAsCustomerBtn(rootWindow);
        
         FrameFixture custWin1 = CustomerWindowWidgets.getWindowAsAsyncChildOf(rootWindow);
         CustomerWindowWidgets.clickExitBtn(custWin1);
         DisplayProjectTestUtils.finishWithAsyncWindow();
        
         LogonWindowWidgets.clickAsCustomerBtn(rootWindow);
         // Find the window (started asynchronously)
         FrameFixture custWin = CustomerWindowWidgets.getWindowAsAsyncChildOf(rootWindow);
         assertEquals("Customer Stock Holdings", custWin.target.getTitle());
         CustomerWindowWidgets.checkCustomerGrid_CustomerNameIs(custWin, "Bill");
         CustomerWindowWidgets.clickBuyBtn(custWin);
        
         // Find the window, started synchronously
         FrameFixture orderWin = OrderWindowWidgets.getWindowAsChildOf(custWin);
         OrderWindowWidgets.checkNewOrderGrid_CustomerNameIs(orderWin, "Bill");
         OrderWindowWidgets.enterNewOrderGrid_Price(orderWin, "10");
         OrderWindowWidgets.enterNewOrderGrid_Quantity(orderWin, "5");
         OrderWindowWidgets.clickSubmitBtn(orderWin);
         orderWin.optionPane().okButton().click();
        
         CustomerWindowWidgets.clickExitBtn(custWin);
         DisplayProjectTestUtils.finishWithAsyncWindow();
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

     */
    public static FrameFixture getWindowAsChildOf(FrameFixture parentWin) {
        return DisplayProjectTestUtils.findChildWithName(parentWin, cWINDOW_NAME);
    }
    public static FrameFixture getWindowAsAsyncChildOf(FrameFixture parentWin) {
        FrameFixture frame = getWindow(parentWin.robot.finder());
        DisplayProjectTestUtils.pushThreadForAsyncWindow(frame);
        return frame;
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

        monitor.showInFrame("MonitorFrame", false);
        robot.waitForIdle();
        // There ought to be a visible frame containing the evolution monitor.
        Frame frame = robot.finder().find(FrameMatcher.withTitle("MonitorFrame").andShowing());
        assert monitor.getGUIComponent().isShowing() : "Evolution monitor should be showing.";
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frameFixture.close();
        robot.waitForIdle();
        assert !monitor.getGUIComponent().isShowing() : "Evolution monitor should not be showing.";
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

    {
        Renderer<Object, JComponent> renderer = new ObjectSwingRenderer();
        FittestCandidateView<BigDecimal> view = new FittestCandidateView<BigDecimal>(renderer);
        JFrame frame = new JFrame();
        frame.add(view, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(300, 300);
        frame.validate();
        frame.setVisible(true);

        view.populationUpdate(new PopulationData<BigDecimal>(BigDecimal.TEN, 10, 5, 2, true, 5, 0, 1, 100));
        robot.waitForIdle();

        // Check displayed fitness.
        String fitnessText = frameFixture.label("FitnessLabel").text();
        assert fitnessText.equals("10.0") : "Wrong fitness score displayed: " + fitnessText;

        // Check rendered candidate.
        frameFixture.textBox().requireNotEditable();
        String text = frameFixture.textBox().component().getText();
        assert text.equals("10") : "Candidate rendered incorrectly.";
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

    {
        Renderer<Object, JComponent> renderer = new ObjectSwingRenderer();
        FittestCandidateView<BigDecimal> view = new FittestCandidateView<BigDecimal>(renderer);
        JFrame frame = new JFrame();
        frame.add(view, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(300, 300);
        frame.validate();
        frame.setVisible(true);

        PopulationData<BigDecimal> data1 = new PopulationData<BigDecimal>(BigDecimal.TEN, 10, 5, 2, true, 5, 0, 1, 100);
        // Render the first time.
        view.populationUpdate(data1);
        robot.waitForIdle();
        JTextComponent component1 = frameFixture.textBox().component();

        // Render the same candidate for the second generation.
        PopulationData<BigDecimal> data2 = new PopulationData<BigDecimal>(BigDecimal.TEN, 10, 5, 2, true, 5, 0, 2, 100);
        view.populationUpdate(data2);
        robot.waitForIdle();
        JTextComponent component2 = frameFixture.textBox().component();

        assert component1 == component2 : "Rendered component should be the same.";
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

    public void testFieldUpdates()
    {
        StatusBar statusBar = new StatusBar();
        JFrame frame = new JFrame();
        frame.add(statusBar, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(400, 30);
        frame.validate();
        frameFixture.show();

        assert frameFixture.label("Population").text().equals("N/A") : "Wrong initial text for population label.";
        assert frameFixture.label("Elitism").text().equals("N/A") : "Wrong initial text for elitism label.";
        assert frameFixture.label("Generations").text().equals("N/A") : "Wrong initial text for generations label.";
        assert frameFixture.label("Time").text().equals("N/A") : "Wrong initial text for elapsed time label.";

        statusBar.populationUpdate(new PopulationData<Object>(new Object(), 10, 8, 2, true, 10, 1, 0, 36610000));
        assert frameFixture.label("Population").text().equals("10") : "Wrong value for popluation label.";
        assert frameFixture.label("Elitism").text().equals("1") : "Wrong value for elitism label.";
        // Generation count is number + 1 (because generations start at zero).
        assert frameFixture.label("Generations").text().equals("1") : "Wrong value for generations label.";
        assert frameFixture.label("Time").text().equals("10:10:10") : "Wrong value for elapsed time label.";
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

    public void testFieldUpdatesForIslandMode()
    {
        StatusBar statusBar = new StatusBar(true);
        JFrame frame = new JFrame();
        frame.add(statusBar, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(400, 30);
        frame.validate();
        frameFixture.show();

        assert frameFixture.label("Population").text().equals("N/A") : "Wrong initial text for population label.";
        assert frameFixture.label("Elitism").text().equals("N/A") : "Wrong initial text for elitism label.";
        assert frameFixture.label("Generations").text().equals("N/A") : "Wrong initial text for generations label.";
        assert frameFixture.label("Time").text().equals("N/A") : "Wrong initial text for elapsed time label.";

        statusBar.islandPopulationUpdate(0, new PopulationData<Object>(new Object(), 10, 8, 2, true, 10, 1, 0, 36610000));
        statusBar.populationUpdate(new PopulationData<Object>(new Object(), 10, 8, 2, true, 50, 1, 0, 36610000));
        assert frameFixture.label("Population").text().equals("5x10") : "Wrong value for popluation label.";
        assert frameFixture.label("Elitism").text().equals("5x1") : "Wrong value for elitism label.";
        // Generation count is number + 1 (because generations start at zero).
        assert frameFixture.label("Generations").text().equals("1") : "Wrong value for generations label.";
        assert frameFixture.label("Time").text().equals("10:10:10") : "Wrong value for elapsed time label.";
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

    public void testTimeFormat()
    {
        StatusBar statusBar = new StatusBar();
        JFrame frame = new JFrame();
        frame.add(statusBar, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(400, 30);
        frame.validate();
        frameFixture.show();

        // Previous test checks two-digit field values, this test checks that single-digit
        // values and zeros are correctly padded.
        statusBar.populationUpdate(new PopulationData<Object>(new Object(), 10, 8, 2, true, 10, 1, 0, 1000));
        assert frameFixture.label("Time").text().equals("00:00:01");
    }
View Full Code Here

Examples of org.fest.swing.fixture.FrameFixture

        Probability defaultValue = new Probability(0.75d);
        ProbabilityParameterControl control = new ProbabilityParameterControl(defaultValue);

        JFrame frame = new JFrame();
        frame.add(control.getControl(), BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(300, 50);
        frame.validate();
        frame.setVisible(true);

        JSlider slider = frameFixture.slider().component();
        assert slider.getValue() == 75 : "Wrong slider position: " + slider.getValue();
        String displayedValue = frameFixture.label().text();
        assert displayedValue.equals("0.75") : "Wrong value displayed: " + displayedValue;


        frameFixture.slider().slideTo(80); // 80 ticks is a probability of 0.8.
        robot.waitForIdle();
        double probability = control.getNumberGenerator().nextValue().doubleValue();
        assert probability == 0.8 : "Wrong probability: " + probability;
        displayedValue = frameFixture.label().text();
        assert displayedValue.equals("0.80") : "Wrong value displayed: " + displayedValue;
    }
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.