use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ThemeEditorTableTest method testResourceCompletion.
/**
* Test the text completion for attribute values
*/
@Ignore("http://wpie20.hot.corp.google.com:8200/builders/ubuntu-studio-master-dev-uitests/builds/28/")
@Test
public void testResourceCompletion() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
final ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
final TableCell cell = row(3).column(0);
FontFixture cellFont = themeEditorTable.fontAt(cell);
cellFont.requireNotBold();
assertEquals("android:colorBackground", themeEditorTable.attributeNameAt(cell));
assertEquals("@android:color/background_holo_light", themeEditorTable.valueAt(cell));
JTableCellFixture tableCell = themeEditorTable.cell(cell);
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) tableCell.editor());
tableCell.startEditing();
EditorTextFieldFixture textComponent = resourceComponent.getTextField();
textComponent.requireText("@android:color/background_holo_light");
textComponent.enterText("invalid");
tableCell.stopEditing();
Wait.seconds(1).expecting("warning icon to be loaded").until(() -> themeEditorTable.hasWarningIconAt(cell));
tableCell.startEditing();
textComponent = resourceComponent.getTextField();
String prefix = "@android:color/back";
textComponent.replaceText(prefix);
JListFixture completionPopup = ThemeEditorGuiTestUtils.getCompletionPopup(guiTest.robot());
String[] suggestions = completionPopup.contents();
assertThat(suggestions).isNotEmpty();
for (String suggestion : suggestions) {
assertThat(suggestion).startsWith(prefix);
}
prefix = "@color/back";
textComponent.replaceText(prefix);
completionPopup = ThemeEditorGuiTestUtils.getCompletionPopup(guiTest.robot());
suggestions = completionPopup.contents();
assertThat(suggestions).isNotEmpty();
for (String suggestion : suggestions) {
assertThat(suggestion).startsWith(prefix);
}
completionPopup.item(0).doubleClick();
tableCell.stopEditing();
assertEquals(suggestions[0], themeEditorTable.valueAt(cell));
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ThemeEditorTableTest method testTabSwitchingWhileEditing.
@Test
public void testTabSwitchingWhileEditing() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
final ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
final TableCell cell = row(3).column(0);
JTableCellFixture tableCell = themeEditorTable.cell(cell);
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) tableCell.editor());
tableCell.startEditing();
EditorTextFieldFixture textComponent = resourceComponent.getTextField();
textComponent.enterText("text");
EditorFixture editor = guiTest.ideFrame().getEditor();
editor.switchToTab("styles.xml");
editor.switchToTab("Theme Editor");
}
use of org.fest.swing.data.TableCell in project android by JetBrains.
the class ThemeEditorTableTest method testParentValueCell.
@Test
public void testParentValueCell() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
// Cell (0,0) should be the parent editor
TableCell parentCell = row(0).column(0);
List<String> parentsList = themeEditorTable.getComboBoxContentsAt(parentCell);
// The expected elements are:
// 0. Holo Light
// 1. -- Separator
// 2. AppCompat Light
// 3. AppCompat
// 4. -- Separator
// 5. Show all themes
assertThat(parentsList).hasSize(6);
assertThat(parentsList.get(0)).isEqualTo("android:Theme.Holo.Light.DarkActionBar");
assertThat(parentsList.get(2)).isEqualTo("Theme.AppCompat.Light.NoActionBar");
assertThat(parentsList.get(3)).isEqualTo("Theme.AppCompat.NoActionBar");
assertThat(parentsList.get(5)).isEqualTo("Show all themes");
assertThat(parentsList.get(1)).startsWith("javax.swing.JSeparator");
assertThat(parentsList.get(4)).startsWith("javax.swing.JSeparator");
JTableCellFixture parentCellFixture = themeEditorTable.cell(parentCell);
parentCellFixture.requireEditable();
// Checks that selecting a separator does nothing
Component parentEditor = parentCellFixture.editor();
parentCellFixture.startEditing();
JComboBoxFixture parentComboBox = new JComboBoxFixture(guiTest.robot(), guiTest.robot().finder().findByType((JComponent) parentEditor, JComboBox.class));
parentComboBox.selectItem(4);
parentCellFixture.stopEditing();
assertEquals("android:Theme.Holo.Light.DarkActionBar", themeEditorTable.getComboBoxSelectionAt(parentCell));
// Selects a new parent
final String newParent = "Theme.AppCompat.NoActionBar";
parentCellFixture.startEditing();
parentComboBox.selectItem(newParent);
parentCellFixture.stopEditing();
assertEquals(newParent, themeEditorTable.getComboBoxSelectionAt(parentCell));
guiTest.ideFrame().invokeMenuPath("Edit", "Undo Updating Parent to Theme.AppCo...");
assertEquals("android:Theme.Holo.Light.DarkActionBar", themeEditorTable.getComboBoxSelectionAt(parentCell));
guiTest.ideFrame().invokeMenuPath("Edit", "Redo Updating Parent to Theme.AppCo...");
assertEquals(newParent, themeEditorTable.getComboBoxSelectionAt(parentCell));
Wait.seconds(1).expecting("potential tooltips to disappear").until(() -> guiTest.robot().findActivePopupMenu() == null);
testParentPopup(themeEditorTable.cell(parentCell), newParent, themeEditor);
guiTest.ideFrame().invokeMenuPath("Window", "Editor Tabs", "Select Previous Tab");
EditorFixture editor = guiTest.ideFrame().getEditor();
editor.moveBetween("", "AppTheme");
assertThat(editor.getCurrentLine().trim()).isEqualTo("<style name=\"AppTheme\" parent=\"Theme.AppCompat.NoActionBar\">");
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method rightClickCell.
/**
* Right click on table cell
*
* @param row the row number
* @param column the column number
* @throws VerificationException if the table element doesn't exist
*/
@PublicAtsApi
public void rightClickCell(int row, int column) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
try {
tableFixture.cell(new TableCell(row, column) {
}).rightClick();
} catch (Exception e) {
throw new UiElementException(e.getMessage(), this);
}
}
use of org.fest.swing.data.TableCell in project ats-framework by Axway.
the class SwingTable method getCellForegroundColor.
/**
* Returns the table cell foreground {@link Color}
*
* @param row the row number
* @param column the column number
*/
@PublicAtsApi
public Color getCellForegroundColor(int row, int column) {
new SwingElementState(this).waitToBecomeExisting();
JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
return tableFixture.foregroundAt(new TableCell(row, column) {
}).target();
}
Aggregations