Java 类org.openqa.selenium.support.Color 实例源码

项目:webtester2-core    文件:MarkerTest.java   
@Test
public void styleIsChangedIfMarkingsAreActivated() {

    doReturn(Color.fromString("#aaaaaa")).when(configuration).getMarkingsColorReadBackground();
    doReturn(Color.fromString("#bbbbbb")).when(configuration).getMarkingsColorReadOutline();
    doReturn(true).when(configuration).isMarkingsEnabled();

    cut.markAsRead(fragment);

    verify(styleChanger).changeStyleInformation(same(fragment), cssCaptor.capture());
    Map<String, String> properties = cssCaptor.getValue();

    assertThat(properties).containsEntry(CssProperties.OUTLINE_STYLE, "solid");
    assertThat(properties).containsEntry(CssProperties.OUTLINE_WIDTH, "2px");
    assertThat(properties).containsEntry(CssProperties.OUTLINE_COLOR, "#bbbbbb");
    assertThat(properties).containsEntry(CssProperties.BACKGROUND_COLOR, "#aaaaaa");

}
项目:webtester2-core    文件:MarkerTest.java   
@Test
public void styleIsChangedIfMarkingsAreActivated() {

    doReturn(Color.fromString("#cccccc")).when(configuration).getMarkingsColorUsedBackground();
    doReturn(Color.fromString("#dddddd")).when(configuration).getMarkingsColorUsedOutline();
    doReturn(true).when(configuration).isMarkingsEnabled();

    cut.markAsUsed(fragment);

    verify(styleChanger).changeStyleInformation(same(fragment), cssCaptor.capture());
    Map<String, String> properties = cssCaptor.getValue();

    assertThat(properties).containsEntry(CssProperties.OUTLINE_STYLE, "solid");
    assertThat(properties).containsEntry(CssProperties.OUTLINE_WIDTH, "2px");
    assertThat(properties).containsEntry(CssProperties.OUTLINE_COLOR, "#dddddd");
    assertThat(properties).containsEntry(CssProperties.BACKGROUND_COLOR, "#cccccc");

}
项目:webtester2-core    文件:Marker.java   
private void markElement(PageFragment fragment, Color backgroundColor, Color outlineColor) {

        Map<String, String> cssStyleAttributes = new HashMap<>();
        cssStyleAttributes.put(CssProperties.OUTLINE_STYLE, "solid");
        cssStyleAttributes.put(CssProperties.OUTLINE_WIDTH, "2px");
        cssStyleAttributes.put(CssProperties.OUTLINE_COLOR, outlineColor.asHex());
        cssStyleAttributes.put(CssProperties.BACKGROUND_COLOR, backgroundColor.asHex());

        styleChanger.changeStyleInformation(fragment, cssStyleAttributes);

    }
项目:webtester2-core    文件:BaseConfigurationTest.java   
@Test
void markingsColorUsedBackgroundCanBeChanged() {
    Color color = Colors.BLUEVIOLET.getColorValue();
    Configuration configuration = cut.setMarkingsColorUsedBackground(color);
    assertThat(cut.getMarkingsColorUsedBackground()).isEqualTo(color);
    assertThat(configuration).isSameAs(cut);
}
项目:webtester2-core    文件:BaseConfigurationTest.java   
@Test
void markingsColorUsedOutlineCanBeChanged() {
    Color color = Colors.ALICEBLUE.getColorValue();
    Configuration configuration = cut.setMarkingsColorUsedOutline(color);
    assertThat(cut.getMarkingsColorUsedOutline()).isEqualTo(color);
    assertThat(configuration).isSameAs(cut);
}
项目:webtester2-core    文件:BaseConfigurationTest.java   
@Test
void markingsColorReadBackgroundCanBeChanged() {
    Color color = Colors.ANTIQUEWHITE.getColorValue();
    Configuration configuration = cut.setMarkingsColorReadBackground(color);
    assertThat(cut.getMarkingsColorReadBackground()).isEqualTo(color);
    assertThat(configuration).isSameAs(cut);
}
项目:webtester2-core    文件:BaseConfigurationTest.java   
@Test
void markingsColorReadOutlineCanBeChanged() {
    Color color = Colors.AZURE.getColorValue();
    Configuration configuration = cut.setMarkingsColorReadOutline(color);
    assertThat(cut.getMarkingsColorReadOutline()).isEqualTo(color);
    assertThat(configuration).isSameAs(cut);
}
项目:UIFramework    文件:HighCharts.java   
protected Color getSeriesColorAtXAxisPosition(int series,
        String xAxisLabelValue) {
    // The series can vary depending on the structure of the chart, by
    // default it is fine but if this doesn't work you may need to tweak the
    // series
    int barNumber = getXAxisLabelsText().indexOf(xAxisLabelValue);
    // The below varies depending on the structure of the chart, by default
    // we need to multiply by 4
    barNumber = barNumber * 4;
    return Color.fromString(chart.findElement(
            By.cssSelector(".highcharts-series-group > g:nth-of-type("
                    + series + ") > rect:nth-of-type(" + barNumber + ")"))
            .getAttribute("fill"));
}
项目:webtester-core    文件:Marker.java   
/**
 * Marks the given {@link PageObject page object} as 'used' using the
 * configured colors from the page object's browser's {@link Configuration
 * configuration}.
 *
 * @param pageObject the page object to mark.
 * @since 0.9.6
 */
public static void markAsUsed(PageObject pageObject) {
    Configuration configuration = pageObject.getBrowser().getConfiguration();
    if (configuration.markingsAreActivated()) {
        Color backgroundColor = configuration.getMarkingsColorUsedBackground();
        Color outlineColor = configuration.getMarkingsColorUsedOutline();
        markElement(pageObject, backgroundColor, outlineColor);
    }
}
项目:webtester-core    文件:Marker.java   
/**
 * Marks the given {@link PageObject page object} as 'read' using the
 * configured colors from the page object's browser's {@link Configuration
 * configuration}.
 *
 * @param pageObject the page object to mark.
 * @since 1.2
 */
public static void markAsRead(PageObject pageObject) {
    Configuration configuration = pageObject.getBrowser().getConfiguration();
    if (configuration.markingsAreActivated()) {
        Color backgroundColor = configuration.getMarkingsColorReadBackground();
        Color outlineColor = configuration.getMarkingsColorReadOutline();
        markElement(pageObject, backgroundColor, outlineColor);
    }
}
项目:webtester-core    文件:Marker.java   
private static void markElement(PageObject pageObject, Color backgroundColor, Color outlineColor) {

        Map<CSSProperty, String> cssStyleAttributes = new HashMap<CSSProperty, String>();
        cssStyleAttributes.put(CSSProperties.OUTLINE_STYLE, "solid");
        cssStyleAttributes.put(CSSProperties.OUTLINE_WIDTH, "2px");
        cssStyleAttributes.put(CSSProperties.OUTLINE_COLOR, outlineColor.asHex());
        cssStyleAttributes.put(CSSProperties.BACKGROUND_COLOR, backgroundColor.asHex());

        styleChanger.changeStyleInformation(pageObject, cssStyleAttributes);

    }
项目:redsniff    文件:ColorMatcher.java   
private String toString(Color color) {
    for (Colors namedColor : Colors.values()) {
        if (namedColor.getColorValue().equals(color))
            return namedColor.toString().toLowerCase();
    }
    return color.asHex().toLowerCase();
}
项目:redsniff    文件:ColorMatcher.java   
@Override
protected boolean matchesSafely(WebElement item,
        Description mismatchDescription) {
    Color actualColor = Color.fromString(item.getCssValue(attributeName));
    if (actualColor.equals(expectedColor))
        return true;
    else {
        mismatchDescription.appendText(attributeName + " was " + toString(actualColor));
        return false;
    }
}
项目:gwt-d3    文件:ElementPageObject.java   
/**
 * Return the given attribute as a color or null if the attribute is not
 * specified.
 * 
 * @param attributeName
 * @return
 */
public Color getAttributeAsColor(String attributeName) {
    try {
        return Color.fromString(element.getAttribute(attributeName));
    } catch (Exception e) {
        return null;
    }
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorUsedBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_USED_BACKGROUND), "#ffd2a5"));
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorUsedBackground(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_USED_BACKGROUND), color.asHex());
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorUsedOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_USED_OUTLINE), "#916f22"));
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorUsedOutline(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_USED_OUTLINE), color.asHex());
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorReadBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_READ_BACKGROUND), "#90ee90"));
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Configuration setMarkingsColorReadBackground(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_READ_BACKGROUND), color.asHex());
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorReadOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_READ_OUTLINE), "#008000"));
}
项目:webtester2-core    文件:BaseConfiguration.java   
@Override
public Configuration setMarkingsColorReadOutline(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_READ_OUTLINE), color.asHex());
}
项目:UIFramework    文件:BarChart.java   
public Color getPrimarySeriesColourForXAxisLabel(String xAxisLabelValue) {
    return getSeriesColorAtXAxisPosition(2, xAxisLabelValue);
}
项目:UIFramework    文件:BarChart.java   
public Color getSecondarySeriesColourForXAxisLabel(String xAxisLabelValue) {
    return getSeriesColorAtXAxisPosition(1, xAxisLabelValue);
}
项目:UIFramework    文件:ColumnChart.java   
public Color getPrimarySeriesColourForXAxisLabel(String xAxisLabelValue) {
    return getSeriesColorAtXAxisPosition(1, xAxisLabelValue);
}
项目:UIFramework    文件:ColumnChart.java   
public Color getSecondarySeriesColourForXAxisLabel(String xAxisLabelValue) {
    return getSeriesColorAtXAxisPosition(2, xAxisLabelValue);
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorUsedBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_BACKGROUND), "#ffd2a5"));
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorUsedBackground(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_COLOR_USED_BACKGROUND), color.toString());
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorUsedOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_USED_OUTLINE), "#916f22"));
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorUsedOutline(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_COLOR_USED_OUTLINE), color.toString());
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorReadBackground() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_READ_BACKGROUND), "#90ee90"));
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorReadBackground(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_COLOR_READ_BACKGROUND), color.toString());
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public Color getMarkingsColorReadOutline() {
    return Color.fromString(getStringProperty(key(NamedProperties.MARKINGS_COLOR_READ_OUTLINE), "#008000"));
}
项目:webtester-core    文件:BaseConfiguration.java   
@Override
public BaseConfiguration setMarkingsColorReadOutline(Color color) {
    return setProperty(key(NamedProperties.MARKINGS_COLOR_READ_OUTLINE), color.toString());
}
项目:redsniff    文件:ColorMatcher.java   
protected ColorMatcher(String attributeName, Color expectedColor) {
    this.expectedColor = expectedColor;
    this.attributeName = attributeName;
}
项目:redsniff    文件:ColorMatcher.java   
public static Matcher<WebElement> hasColor(String colorAsString) {
    return new ColorMatcher("color", Color.fromString(colorAsString));
}
项目:redsniff    文件:ColorMatcher.java   
public static Matcher<WebElement> hasBackgroundColor(String colorAsString) {
    return new ColorMatcher("background-color", Color.fromString(colorAsString));
}
项目:gwt-d3    文件:CssColorPropertyEquals.java   
@Override
public boolean match(final String actualValue) {
    Color actualColor = Color.fromString(actualValue);
    Color expectedColor = Color.fromString(this.expectedColor);
    return actualColor.equals(expectedColor);
}
项目:gwt-d3    文件:AbstractSeleniumTest.java   
protected ColorAssert assertThat(final Color color) {
    return new ColorAssert(color, ColorAssert.class);
}
项目:gwt-d3    文件:DemoDragMultiple.java   
public Color fillColor() {
    return getAttributeAsColor("fill");
}