Search in sources :

Example 1 with SlideFixture

use of com.android.tools.idea.tests.gui.framework.fixture.SlideFixture 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();
}
Also used : SlideFixture(com.android.tools.idea.tests.gui.framework.fixture.SlideFixture) TableCell(org.fest.swing.data.TableCell) ChooseResourceDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.ChooseResourceDialogFixture) ColorPickerFixture(com.android.tools.idea.tests.gui.framework.fixture.ColorPickerFixture) Test(org.junit.Test)

Aggregations

ChooseResourceDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ChooseResourceDialogFixture)1 ColorPickerFixture (com.android.tools.idea.tests.gui.framework.fixture.ColorPickerFixture)1 SlideFixture (com.android.tools.idea.tests.gui.framework.fixture.SlideFixture)1 TableCell (org.fest.swing.data.TableCell)1 Test (org.junit.Test)1