use of org.w3c.dom.css.CSSPrimitiveValue 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);
}
}
use of org.w3c.dom.css.CSSPrimitiveValue in project webtools.sourceediting by eclipse.
the class AbstractModelTest method checkPrimitiveRect.
/* for rect */
protected void checkPrimitiveRect(CSSValue actual, Object[] expectedArray) {
assertTrue(actual instanceof CSSPrimitiveValue);
assertEquals(CSSPrimitiveValue.CSS_RECT, ((CSSPrimitiveValue) actual).getPrimitiveType());
Rect rect = ((CSSPrimitiveValue) actual).getRectValue();
CSSPrimitiveValue value;
Object expected;
value = rect.getTop();
expected = expectedArray[0];
if (expected instanceof PrimitiveNumber) {
checkPrimitiveNumber(value, (PrimitiveNumber) expected);
} else {
checkPrimitiveString(value, (PrimitiveString) expected);
}
value = rect.getRight();
expected = expectedArray[1];
if (expected instanceof PrimitiveNumber) {
checkPrimitiveNumber(value, (PrimitiveNumber) expected);
} else {
checkPrimitiveString(value, (PrimitiveString) expected);
}
value = rect.getBottom();
expected = expectedArray[2];
if (expected instanceof PrimitiveNumber) {
checkPrimitiveNumber(value, (PrimitiveNumber) expected);
} else {
checkPrimitiveString(value, (PrimitiveString) expected);
}
value = rect.getLeft();
expected = expectedArray[3];
if (expected instanceof PrimitiveNumber) {
checkPrimitiveNumber(value, (PrimitiveNumber) expected);
} else {
checkPrimitiveString(value, (PrimitiveString) expected);
}
}
Aggregations