Search in sources :

Example 26 with TableCell

use of org.fest.swing.data.TableCell in project android by JetBrains.

the class BuildVariantsToolWindowFixture method selectVariantForModule.

@NotNull
public BuildVariantsToolWindowFixture selectVariantForModule(@NotNull final String module, @NotNull String variant) {
    activate();
    Content[] contents = myToolWindow.getContentManager().getContents();
    assertThat(contents.length).isAtLeast(1);
    Content content = contents[0];
    JTable variantsTable = myRobot.finder().findByType(content.getComponent(), JTable.class, true);
    final String moduleColumnText = "Module: '" + module + "'";
    JTableFixture table = new JTableFixture(myRobot, variantsTable);
    JTableCellFixture moduleCell = table.cell((jTable, cellReader) -> {
        int rowCount = jTable.getRowCount();
        for (int i = 0; i < rowCount; i++) {
            int moduleColumnIndex = 0;
            String currentModule = cellReader.valueAt(jTable, i, moduleColumnIndex);
            if (moduleColumnText.equals(currentModule)) {
                return row(i).column(moduleColumnIndex);
            }
        }
        throw new AssertionError("Failed to find module '" + module + "' in 'Build Variants' view");
    });
    TableCell variantCellCoordinates = row(moduleCell.row()).column(1);
    String selectedVariant = table.valueAt(variantCellCoordinates);
    if (!variant.equals(selectedVariant)) {
        // Attempt to select variant if it is not already selected.
        JTableCellFixture variantCell = table.cell(variantCellCoordinates);
        variantCell.enterValue(variant);
        myProjectFrame.waitForBuildToFinish(BuildMode.SOURCE_GEN);
    }
    return this;
}
Also used : JTableCellFixture(org.fest.swing.fixture.JTableCellFixture) JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) Content(com.intellij.ui.content.Content) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TableCell (org.fest.swing.data.TableCell)26 JTableFixture (org.fest.swing.fixture.JTableFixture)15 PublicAtsApi (com.axway.ats.common.PublicAtsApi)12 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)12 Test (org.junit.Test)12 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)7 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)7 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)6 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)6 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)6 ChooseResourceDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ChooseResourceDialogFixture)3 ResourceComponent (com.android.tools.idea.editors.theme.ui.ResourceComponent)2 JTableCellFixture (org.fest.swing.fixture.JTableCellFixture)2 NotNull (org.jetbrains.annotations.NotNull)2 ColorPickerFixture (com.android.tools.idea.tests.gui.framework.fixture.ColorPickerFixture)1 EditorFixture (com.android.tools.idea.tests.gui.framework.fixture.EditorFixture)1 SlideFixture (com.android.tools.idea.tests.gui.framework.fixture.SlideFixture)1 ThemeSelectionDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ThemeSelectionDialogFixture)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