Search in sources :

Example 1 with RGBColor

use of org.w3c.dom.css.RGBColor in project webtools.sourceediting by eclipse.

the class AbstractModelTest method checkPrimitiveRgb.

/* for rgb */
protected void checkPrimitiveRgb(CSSValue actual, Object[] expectedArray) {
    assertTrue(actual instanceof CSSPrimitiveValue);
    assertEquals(CSSPrimitiveValue.CSS_RGBCOLOR, ((CSSPrimitiveValue) actual).getPrimitiveType());
    RGBColor color = ((CSSPrimitiveValue) actual).getRGBColorValue();
    CSSPrimitiveValue value;
    Object expected;
    value = color.getRed();
    expected = expectedArray[0];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = color.getGreen();
    expected = expectedArray[1];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
    value = color.getBlue();
    expected = expectedArray[2];
    if (expected instanceof PrimitiveNumber) {
        checkPrimitiveNumber(value, (PrimitiveNumber) expected);
    } else {
        checkPrimitiveString(value, (PrimitiveString) expected);
    }
}
Also used : RGBColor(org.w3c.dom.css.RGBColor) CSSPrimitiveValue(org.w3c.dom.css.CSSPrimitiveValue)

Aggregations

CSSPrimitiveValue (org.w3c.dom.css.CSSPrimitiveValue)1 RGBColor (org.w3c.dom.css.RGBColor)1