use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method selectCells.
/**
* Select table cells
*
* @param cells the cells coordinates (eg. new int[][]{ { 1, 1 }, { 1, 2 }, { 2, 2 } )
* @throws VerificationException if the element doesn't exist
*/
@PublicAtsApi
public void selectCells(int[][] cells) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
try {
TableCell[] cellsToSelect = new TableCell[cells.length];
for (int i = 0; i < cells.length; i++) {
int row = cells[i][0];
int column = cells[i][1];
cellsToSelect[i] = new TableCell(row, column) {
};
}
tableFixture.selectCells(cellsToSelect);
} catch (Exception e) {
throw new UiElementException(e.getMessage(), this);
}
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class TranslationsEditorTest method enteringTextInTranslationTextFieldUpdatesTableCell.
@Test
public void enteringTextInTranslationTextFieldUpdatesTableCell() {
JTableFixture table = myTranslationsEditor.getTable();
TableCell cell = TableCell.row(2).column(3);
table.selectCell(cell);
myTranslationsEditor.getTranslationTextField().enterText("cancel_en");
// Make the Translation text field lose focus
myTranslationsEditor.getKeyTextField().focus();
assertEquals("cancel_en", table.valueAt(cell));
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ChooseResourceDialogTest method testColorPickerAlpha.
/**
* Test that the alpha slider and the textfield are hidden when we are not in ARGB.
*/
@Test
public void testColorPickerAlpha() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
TableCell cell = row(1).column(0);
JTableCellFixture colorCell = themeEditorTable.cell(cell);
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) colorCell.editor());
colorCell.startEditing();
resourceComponent.getSwatchButton().click();
ChooseResourceDialogFixture dialog = ChooseResourceDialogFixture.find(guiTest.robot());
ColorPickerFixture colorPicker = dialog.getColorPicker();
Color color = new Color(200, 0, 0, 200);
colorPicker.setFormat("ARGB");
colorPicker.setColorWithIntegers(color);
JTextComponentFixture alphaLabel = colorPicker.getLabel("A:");
SlideFixture alphaSlide = colorPicker.getAlphaSlide();
alphaLabel.requireVisible();
alphaSlide.requireVisible();
colorPicker.setFormat("RGB");
alphaLabel.requireNotVisible();
alphaSlide.requireNotVisible();
colorPicker.setFormat("HSB");
alphaLabel.requireNotVisible();
alphaSlide.requireNotVisible();
dialog.clickOK();
colorCell.stopEditing();
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ChooseResourceDialogTest method testColorStateList.
@Test
public void testColorStateList() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("StateListApplication");
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
TableCell cell = row(7).column(0);
FontFixture cellFont = themeEditorTable.fontAt(cell);
cellFont.requireBold();
assertEquals("android:textColorPrimary", themeEditorTable.attributeNameAt(cell));
assertEquals("@color/text_color", themeEditorTable.valueAt(cell));
JTableCellFixture stateListCell = themeEditorTable.cell(cell);
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) stateListCell.editor());
stateListCell.startEditing();
resourceComponent.getSwatchButton().click();
final ChooseResourceDialogFixture dialog = ChooseResourceDialogFixture.find(guiTest.robot());
StateListPickerFixture stateListPicker = dialog.getStateListPicker();
java.util.List<StateListComponentFixture> states = stateListPicker.getStateComponents();
assertThat(states).hasSize(4);
final StateListComponentFixture state0 = states.get(0);
assertEquals("Not enabled", state0.getStateName());
assertEquals("?android:attr/colorForeground", state0.getValue());
assertFalse(state0.getValueComponent().hasWarningIcon());
assertTrue(state0.isAlphaVisible());
assertEquals("@dimen/text_alpha", state0.getAlphaValue());
assertFalse(state0.getAlphaComponent().hasWarningIcon());
final StateListComponentFixture state1 = states.get(1);
assertEquals("Checked", state1.getStateName());
assertEquals("#5034FAB2", state1.getValue());
assertFalse(state1.getValueComponent().hasWarningIcon());
assertFalse(state1.isAlphaVisible());
final StateListComponentFixture state2 = states.get(2);
assertEquals("Pressed", state2.getStateName());
assertEquals("@color/invalidColor", state2.getValue());
assertTrue(state2.getValueComponent().hasWarningIcon());
assertFalse(state2.isAlphaVisible());
final StateListComponentFixture state3 = states.get(3);
assertEquals("Default", state3.getStateName());
assertEquals("?attr/myColorAttribute", state3.getValue());
assertFalse(state3.getValueComponent().hasWarningIcon());
assertFalse(state3.isAlphaVisible());
dialog.waitForErrorLabel();
dialog.clickCancel();
stateListCell.stopEditing();
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ThemeEditorTableTest method testResettingColorAttribute.
/**
* @see com.android.tools.idea.editors.theme.ThemeEditorTable#getPopupMenuAtCell(int, int)
*/
@Test
public void testResettingColorAttribute() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
final ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
final TableCell cell = row(1).column(0);
assertEquals("android:colorPrimary", themeEditorTable.attributeNameAt(cell));
assertEquals("@android:color/holo_light_primary", themeEditorTable.valueAt(cell));
JTableCellFixture colorCell = themeEditorTable.cell(cell);
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) colorCell.editor());
colorCell.startEditing();
resourceComponent.getSwatchButton().click();
ChooseResourceDialogFixture dialog = ChooseResourceDialogFixture.find(guiTest.robot());
Color color = new Color(200, 0, 0, 200);
dialog.getColorPicker().setColorWithIntegers(color);
dialog.clickOK();
themeEditorTable.requireValueAt(cell, "@color/holo_light_primary");
colorCell.startEditing();
JPopupMenuFixture popupMenu = resourceComponent.showPopupMenu();
popupMenu.menuItemWithPath("Reset value").click();
themeEditorTable.requireValueAt(cell, "@android:color/holo_light_primary");
}
Aggregations