Search in sources :

Example 1 with JTextComponentFixture

use of org.fest.swing.fixture.JTextComponentFixture in project ats-framework by Axway.

the class SwingTextArea method appendValue.

/**
     * Works in same way as the 'set text' method
     * 
     * @param value
     */
@Override
@PublicAtsApi
public void appendValue(String value) {
    new SwingElementState(this).waitToBecomeExisting();
    ((JTextComponentFixture) SwingElementLocator.findFixture(this)).setText(value);
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with JTextComponentFixture

use of org.fest.swing.fixture.JTextComponentFixture in project ats-framework by Axway.

the class SwingTextArea method setValue.

/**
     * Set text area value
     *
     * @param value the value to set
     * @throws VerificationException if the element doesn't exist
     */
@Override
@PublicAtsApi
public void setValue(String value) {
    new SwingElementState(this).waitToBecomeExisting();
    ((JTextComponentFixture) SwingElementLocator.findFixture(this)).setText(value);
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with JTextComponentFixture

use of org.fest.swing.fixture.JTextComponentFixture in project intellij-community by JetBrains.

the class NewProjectWizardFixture method getLocationInFileSystem.

@NotNull
public File getLocationInFileSystem() {
    String labelText = GuiTestUtil.adduction(IdeBundle.message("label.project.files.location"));
    //noinspection ConstantConditions
    final JTextComponentFixture locationTextField = findTextField(labelText);
    return execute(new GuiQuery<File>() {

        @Override
        protected File executeInEDT() throws Throwable {
            String location = locationTextField.text();
            assertThat(location).isNotNull().isNotEmpty();
            return new File(location);
        }
    });
}
Also used : JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with JTextComponentFixture

use of org.fest.swing.fixture.JTextComponentFixture in project android by JetBrains.

the class TranslationsEditorTest method translationTextFieldFontCanDisplayPastedHebrew.

@Test
public void translationTextFieldFontCanDisplayPastedHebrew() {
    myTranslationsEditor.getTable().selectCell(TableCell.row(1).column(5));
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection("יישום פשוט"), EmptyClipboardOwner.INSTANCE);
    JTextComponentFixture translationTextField = myTranslationsEditor.getTranslationTextField();
    KeyStroke keyStroke = getKeyStroke(translationTextField.target().getInputMap(), DefaultEditorKit.pasteAction);
    translationTextField.pressAndReleaseKey(KeyPressInfo.keyCode(keyStroke.getKeyCode()).modifiers(keyStroke.getModifiers()));
    assertEquals(-1, translationTextField.font().target().canDisplayUpTo("יישום פשוט"));
}
Also used : JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) StringSelection(java.awt.datatransfer.StringSelection) Test(org.junit.Test)

Example 5 with JTextComponentFixture

use of org.fest.swing.fixture.JTextComponentFixture in project android by JetBrains.

the class ThemeConfigurationTest method testThemesWithConfiguration.

/**
   * Tests that the theme editor deals well with themes defined only in certain configurations
   */
@Test
public void testThemesWithConfiguration() throws IOException {
    guiTest.importSimpleApplication();
    ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
    JComboBoxFixture themesComboBox = themeEditor.getThemesComboBox();
    themesComboBox.selectItem("Create New Theme");
    NewStyleDialogFixture newStyleDialog = NewStyleDialogFixture.find(guiTest.robot());
    JComboBoxFixture parentComboBox = newStyleDialog.getParentComboBox();
    parentComboBox.selectItem("Show all themes");
    ThemeSelectionDialogFixture themeSelectionDialog = ThemeSelectionDialogFixture.find(guiTest.robot());
    final JTreeFixture categoriesTree = themeSelectionDialog.getCategoriesTree();
    JListFixture themeList = themeSelectionDialog.getThemeList();
    categoriesTree.clickPath("Material Dark");
    guiTest.robot().waitForIdle();
    themeList.clickItem("android:Theme.Material");
    themeSelectionDialog.clickOk();
    parentComboBox.requireSelection("android:Theme.Material");
    JTextComponentFixture newNameTextField = newStyleDialog.getNewNameTextField();
    newNameTextField.click();
    newNameTextField.deleteText();
    newNameTextField.enterText("MyMaterialTheme");
    newStyleDialog.clickOk();
    themeEditor.waitForThemeSelection("MyMaterialTheme");
    AndroidThemePreviewPanelFixture themePreviewPanel = themeEditor.getPreviewComponent().getThemePreviewPanel();
    themePreviewPanel.requirePreviewPanel();
    JButton apiButton = themeEditor.findToolbarButton("API Version in Editor");
    guiTest.robot().click(apiButton);
    clickPopupMenuItem("API 19", "19", apiButton, guiTest.robot());
    themePreviewPanel.requireErrorPanel();
    themesComboBox.selectItem("AppTheme");
    themePreviewPanel.requirePreviewPanel();
    themesComboBox.selectItem("MyMaterialTheme");
    themePreviewPanel.requireErrorPanel();
}
Also used : JTreeFixture(org.fest.swing.fixture.JTreeFixture) JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) ThemeSelectionDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.ThemeSelectionDialogFixture) NewStyleDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.theme.NewStyleDialogFixture) JListFixture(org.fest.swing.fixture.JListFixture) ThemeEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.theme.ThemeEditorFixture) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture) AndroidThemePreviewPanelFixture(com.android.tools.idea.tests.gui.framework.fixture.theme.AndroidThemePreviewPanelFixture) Test(org.junit.Test)

Aggregations

JTextComponentFixture (org.fest.swing.fixture.JTextComponentFixture)22 NotNull (org.jetbrains.annotations.NotNull)15 JTextComponent (javax.swing.text.JTextComponent)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)2 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)2 ComponentLookupException (org.fest.swing.exception.ComponentLookupException)2 JComboBoxFixture (org.fest.swing.fixture.JComboBoxFixture)2 JListFixture (org.fest.swing.fixture.JListFixture)2 JTreeFixture (org.fest.swing.fixture.JTreeFixture)2 Test (org.junit.Test)2 ThemeSelectionDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ThemeSelectionDialogFixture)1 AndroidThemePreviewPanelFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.AndroidThemePreviewPanelFixture)1 NewStyleDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.NewStyleDialogFixture)1 ThemeEditorFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.ThemeEditorFixture)1 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 SwingDriverInternal (com.axway.ats.uiengine.internal.driver.SwingDriverInternal)1 Component (java.awt.Component)1 StringSelection (java.awt.datatransfer.StringSelection)1 File (java.io.File)1