Bug 567283 patch 3 - Make TestColorNames use the new alpha capabilities. r?xidorn draft
authorL. David Baron <dbaron@dbaron.org>
Sun, 08 May 2016 09:56:15 -0700
changeset 364685 3b741d5b02444ae0aed17f97f450d121d67c7420
parent 364684 a9743d4e625c3c0d7fb9637efff35f37ddc1e24f
child 364686 05852c6d4acfc77fb92a5988b0b46cd5bb8b7cb2
push id17539
push userdbaron@mozilla.com
push dateSun, 08 May 2016 16:56:29 +0000
reviewersxidorn
bugs567283
milestone49.0a1
Bug 567283 patch 3 - Make TestColorNames use the new alpha capabilities. r?xidorn MozReview-Commit-ID: IdAewXMVZct
gfx/tests/gtest/TestColorNames.cpp
--- 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;