use of com.android.tools.idea.tests.gui.framework.fixture.ChooseResourceDialogFixture in project android by JetBrains.
the class ChooseResourceDialogTest method testResourcePickerNameError.
@Test
public void testResourcePickerNameError() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
ThemeEditorTableFixture themeEditorTable = themeEditor.getPropertiesTable();
// Cell (1,0) should be some color
JTableCellFixture colorCell = themeEditorTable.cell(row(1).column(0));
// click on a color
ResourceComponentFixture resourceComponent = new ResourceComponentFixture(guiTest.robot(), (ResourceComponent) colorCell.editor());
colorCell.startEditing();
resourceComponent.getSwatchButton().click();
final ChooseResourceDialogFixture dialog = ChooseResourceDialogFixture.find(guiTest.robot());
JTextComponentFixture name = dialog.getNameTextField();
// add mistake into name field
String badText = "(";
name.deleteText();
name.enterText("color" + badText);
String text = name.text();
assertThat(text).endsWith(badText);
final String expectedError = "<html><font color='#ff0000'><left>'" + badText + "' is not a valid resource name character</left></b></font></html>";
Wait.seconds(1).expecting("error to update").until(() -> dialog.getError().equals(expectedError));
dialog.clickCancel();
colorCell.cancelEditing();
}
Aggregations