Bug 567283 patch 3 - Make TestColorNames use the new alpha capabilities. r?xidorn
MozReview-Commit-ID: IdAewXMVZct
--- a/gfx/tests/gtest/TestColorNames.cpp
+++ b/gfx/tests/gtest/TestColorNames.cpp
@@ -61,25 +61,25 @@ void RunColorTests() {
ASSERT_TRUE((rgb == kColors[index])) <<
"failed at index " << index << " out of " << ArrayLength(kColorNames);
// Check that parsing an RGB value in hex gets the right values
uint8_t r = NS_GET_R(rgb);
uint8_t g = NS_GET_G(rgb);
uint8_t b = NS_GET_B(rgb);
uint8_t a = NS_GET_A(rgb);
+ char cbuf[50];
if (a != UINT8_MAX) {
- // FIXME: NS_HexToRGBA() now handle a color with alpha channel!
- rgb = NS_RGB(r, g, b);
+ snprintf_literal(cbuf, "%02x%02x%02x%02x", r, g, b, a);
+ } else {
+ snprintf_literal(cbuf, "%02x%02x%02x", r, g, b);
}
- char cbuf[50];
- snprintf_literal(cbuf, "%02x%02x%02x", r, g, b);
nscolor hexrgb;
ASSERT_TRUE(NS_HexToRGBA(NS_ConvertASCIItoUTF16(cbuf),
- nsHexColorType::NoAlpha, &hexrgb)) <<
+ nsHexColorType::AllowAlpha, &hexrgb)) <<
"hex conversion to color of '" << cbuf << "'";
ASSERT_TRUE(hexrgb == rgb);
}
}
static
void RunJunkColorTests() {
nscolor rgb;