Package org.fest.swing.fixture

Examples of org.fest.swing.fixture.FrameFixture


    public void testSetAllProbabilitiesToZero()
    {
        ProbabilitiesPanel panel = new ProbabilitiesPanel();
        JFrame frame = new JFrame();
        frame.add(panel, BorderLayout.CENTER);
        FrameFixture frameFixture = new FrameFixture(robot, frame);
        frame.setSize(700, 300);
        frame.validate();

        frameFixture.show();
        frameFixture.panel("AddPolygon").slider().slideToMinimum();
        frameFixture.panel("RemovePolygon").slider().slideToMinimum();
        frameFixture.panel("MovePolygon").slider().slideToMinimum();
        frameFixture.panel("Cross-over").slider().slideToMinimum();
        frameFixture.panel("AddVertex").slider().slideToMinimum();
        frameFixture.panel("RemoveVertex").slider().slideToMinimum();
        frameFixture.panel("MoveVertex").slider().slideToMinimum();
        frameFixture.panel("ChangeColour").slider().slideToMinimum();

        Dimension canvasSize = new Dimension(100, 100);
        PolygonImageFactory factory = new PolygonImageFactory(canvasSize);
        EvolutionaryOperator<List<ColouredPolygon>> operator = panel.createEvolutionPipeline(factory,
                                                                                             canvasSize,
View Full Code Here


    for (AncestorListener listener : manifestation.getAncestorListeners()) {
      listener.ancestorRemoved(null);
      manifestation.removeAncestorListener(listener);
    }
   
    FrameFixture fixture = showInFrame(manifestation, "test");
    JTableFixture tableFixture = fixture.table();
    FeedProvider.RenderingInfo ri = new FeedProvider.RenderingInfo(
        "1",
        Color.gray,
        "a",
        Color.gray,
View Full Code Here

  }
 
  @Test
  public void testPersistenceIsCalledDuringActions() {
    int persistentCount = 0;
    FrameFixture window = WindowFinder.findFrame(TITLE).using(robot);
    window.button(bundle.getString("AddExpressionTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
    window.textBox(bundle.getString("ValueControlName")).setText("1.0");
    window.textBox(bundle.getString("DisplayControlName")).setText("test display");
    Mockito.when(mockExpManifestation.getSelectedExpression()).thenReturn(expression);
    Mockito.when(expression.getPUIs()).thenReturn("isp:PARAMETER1");
    window.button(bundle.getString("ApplyTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
    window.textBox(bundle.getString("ValueControlName")).setText("test value2");
    window.textBox(bundle.getString("DisplayControlName")).setText("test display2");
    window.button(bundle.getString("ApplyTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
    window.button(bundle.getString("AddExpressionTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
    window.textBox(bundle.getString("ValueControlName")).setText("1.0");
    window.textBox(bundle.getString("DisplayControlName")).setText("test display");
    Mockito.when(mockExpManifestation.getSelectedExpression()).thenReturn(expression);
    Mockito.when(expression.getPUIs()).thenReturn("isp:PARAMETER1");
    window.button(bundle.getString("ApplyTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
    window.button(bundle.getString("MoveUpOneTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("MoveDownOneTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("DeleteExpressionTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
    window.checkBox(bundle.getString("PassThroughControl")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
  }
View Full Code Here

  }
 
  @Test
  public void testPersistenceIsCalledDuringActions() {
    int persistentCount = 0;
    FrameFixture window = WindowFinder.findFrame(TITLE).using(robot);
    window.button(bundle.getString("AddExpressionTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
    window.button(bundle.getString("DeleteExpressionTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("AddAboveTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
    window.button(bundle.getString("AddBelowTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("MoveUpOneTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("MoveDownOneTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("MoveToTopTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("MoveToBottomTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();

    window.button(bundle.getString("RemoveTelemetryTitle")).click();
    Mockito.verify(mockExpManifestation, Mockito.times(++persistentCount)).fireFocusPersist();
   
  }
View Full Code Here

        robot.cleanUp();
    }
   
    @Test
    public void testSearchClickResults() {
        FrameFixture window = WindowFinder.findFrame(TITLE).using(robot);
        final JListFixture list = window.list(new JListMatcher("Search Result List"));
        ComponentSpec cs1 = Mockito.mock(ComponentSpec.class);
        ComponentSpec cs2 = Mockito.mock(ComponentSpec.class);
        QueryResult q = new QueryResult(2, Arrays.asList(cs1, cs2));
        platformSearchUI.setQueryResult(q);
        window.button(new JButtonMatcher("Search")).click();
        Condition condition = new Condition("Results Arrived.") {
           
            @Test
      @Override
            public boolean test() {
View Full Code Here

    }   

    @Test
    public void testPersistenceIsCalledDuringActions() {
        int persistentCount = 0;
        FrameFixture window = WindowFinder.findFrame(TITLE).using(robot);
        JCheckBoxFixture titleCheckBox = window.checkBox(new CheckBoxMatcher("Panel Title Bar"));
        titleCheckBox.click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        // check that both focus lost and enter will trigger focus for text fields
        JTextComponentFixture textFixture = window.textBox(new TextFieldMatcher("Panel Title:"));
        textFixture.enterText("abc").pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
        titleCheckBox.focus();
        // should not fire persistence event if the text hasn't changed
        Mockito.verify(mockCanvasManifestation,Mockito.times(persistentCount)).fireFocusPersist();
       
        textFixture.focus();
        textFixture.enterText("123");
        titleCheckBox.focus();
        Mockito.verify(mockCanvasManifestation,Mockito.times(persistentCount)).fireFocusPersist();

        // check that selecting the border color call persistence
        JComboBoxFixture colorFixture = window.comboBox(new ComboBoxMatcher("Color:"));
        colorFixture.selectItem(2);
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();

        window.toggleButton(new JToggleButtonMatcher("All borders")).click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        // check the no border button state
        window.toggleButton(new JToggleButtonMatcher("No borders")).click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        window.comboBox(new ComboBoxMatcher("panelTitleFontComboBox")).selectItem("Serif");
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        PANEL_TITLE_FONT_SIZE_SPINNER.spinnerIn(window).select(18);
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
        persistentCount++;
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleBold")).click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
        persistentCount++;
       
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleItalic")).click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
      
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleUnderline")).click();
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        window.comboBox(new ComboBoxMatcher("panelTitleFontColorComboBox")).selectItem(2);
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        window.comboBox(new ComboBoxMatcher("panelTitleBackgroundColorComboBox")).selectItem(2);
        Mockito.verify(mockCanvasManifestation,Mockito.times(++persistentCount)).fireFocusPersist();
       
        controlPanel.informZeroPanelsSelected();
        titleCheckBox.requireDisabled();
        textFixture.requireDisabled();
        window.toggleButton(new JToggleButtonMatcher("All borders")).requireDisabled();
        window.button(new JButtonMatcher("Align to bottom edge")).requireDisabled();
        window.comboBox(new ComboBoxMatcher("panelTitleFontComboBox")).requireDisabled();
        PANEL_TITLE_FONT_SIZE_SPINNER.spinnerIn(window).requireDisabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleBold")).requireDisabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleItalic")).requireDisabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleUnderline")).requireDisabled();
        window.comboBox(new ComboBoxMatcher("panelTitleFontColorComboBox")).requireDisabled();
        window.comboBox(new ComboBoxMatcher("panelTitleBackgroundColorComboBox")).requireDisabled();
       
        controlPanel.informMultipleViewPanelsSelected(Collections.<Panel>emptyList());
        titleCheckBox.requireEnabled();
        textFixture.requireDisabled();
        window.toggleButton(new JToggleButtonMatcher("All borders")).requireEnabled();
        window.button(new JButtonMatcher("Align to bottom edge")).requireEnabled();
        window.comboBox(new ComboBoxMatcher("panelTitleFontComboBox")).requireEnabled();
        PANEL_TITLE_FONT_SIZE_SPINNER.spinnerIn(window).requireEnabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleBold")).requireEnabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleItalic")).requireEnabled();
        window.toggleButton(new JToggleButtonMatcher("panelTitleFontStyleUnderline")).requireEnabled();
        window.comboBox(new ComboBoxMatcher("panelTitleFontColorComboBox")).requireEnabled();
        window.comboBox(new ComboBoxMatcher("panelTitleBackgroundColorComboBox")).requireEnabled();

       
    }
View Full Code Here

                       GraphicalSettings.GRAPHICAL_OUTLINE_COLOR,
                       GraphicalSettings.GRAPHICAL_BACKGROUND_COLOR,
                       GraphicalSettings.GRAPHICAL_FOREGROUND_FILL,
                       GraphicalSettings.GRAPHICAL_FOREGROUND_COLOR };
   
    FrameFixture window = WindowFinder.findFrame(WINDOW_TITLE).using(robot);
     
    for (String propertyName : dropDowns) {
      Assert.assertNull   (viewProperties.getProperty(propertyName, String.class));
      // Note, this is sensitive to defaults (only calls on change)
      // So, we do it at least twice every time
      window.comboBox(propertyName).selectItem(1);
      window.comboBox(propertyName).selectItem(2);
      Assert.assertNotNull(viewProperties.getProperty(propertyName, String.class));         
    }

  }
View Full Code Here

  }
 
  @Test
  public void testMinMax() {
    FrameFixture window = WindowFinder.findFrame(WINDOW_TITLE).using(robot);

    verifyMinMax(null, null);   
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).enterText("10");
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).enterText("20");
    // Just changing text shouldn't change property
    verifyMinMax(null, null);
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));   
    verifyMinMax("10", "20");   

    // Bad data should not make changes
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).enterText("cat");
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).enterText("dog");   
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
    verifyMinMax("10", "20");
   
    // Min > Max should not change settings
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).enterText("30");
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).enterText("20");   
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
    verifyMinMax("10", "20");
   
    // But now settings change should work
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).enterText("30");
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).deleteText();
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MAX).enterText("40");   
    window.textBox(GraphicalSettings.GRAPHICAL_FOREGROUND_MIN).pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
    verifyMinMax("30", "40");    
  }
View Full Code Here

     * @throws Exception
     */
    @BeforeClass
    public static void setUpClass() throws Exception {
        AbstractHeadedTest.setUpClass();
        frame = new FrameFixture(IGV.getMainFrame());
    }
View Full Code Here

        Assert.assertEquals(chr, frame.getChrName());
        assertTrue(Math.abs(frame.getCurrentRange().getStart() - start) < limit);
        assertTrue(Math.abs(frame.getCurrentRange().getEnd() - end) < limit);


        FrameFixture frameFixture = new FrameFixture(IGV.getMainFrame());
        //Make sure frame has focus, or else homeButton won't work
        JButtonFixture homeButton = frameFixture.button("homeButton");

        homeButton.focus();
        homeButton.click();

        homeButton.focus();
View Full Code Here

TOP

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

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.