Bug 1261195 - Make the Windows fuzzing in test_selection_underline.html conditional on D2D being enabled. r=mattwoodrow
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 01 Apr 2016 08:25:27 -0400
changeset 291239 2ad120057ac1087ee2ac08c348e250c271f5c010
parent 291238 9c042b16ca2c16d1bfc48bc43030164d50e9e5a5
child 291240 cc70dae5693b38d6f5756141f2a45429ea8ffd1f
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1261195
milestone48.0a1
Bug 1261195 - Make the Windows fuzzing in test_selection_underline.html conditional on D2D being enabled. r=mattwoodrow
layout/generic/test/test_selection_underline.html
--- a/layout/generic/test/test_selection_underline.html
+++ b/layout/generic/test/test_selection_underline.html
@@ -6,16 +6,19 @@
   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
 <script type="text/javascript">
 
 // Canvas related code stolen from layout/base/tests/bidi_numeral_test.js which
 // stole from http://developer.mozilla.org/en/docs/Code_snippets:Canvas
 
+var Ci = Components.interfaces;
+var Cc = Components.classes;
+
 var RemoteCanvas = function(aIFrame, aTest) {
   this.iframe = aIFrame;
   this.test = aTest;
   this.snapshot = null;
 };
 
 RemoteCanvas.CANVAS_WIDTH = 200;
 RemoteCanvas.CANVAS_HEIGHT = 100;
@@ -190,19 +193,29 @@ const kDecorations = [
   { relativeSize: 1.0, style: kDecorationStyleDashed, styleName: "dashed"    },
   { relativeSize: 1.0, style: kDecorationStyleDouble, styleName: "double"    },
   { relativeSize: 1.0, style: kDecorationStyleWavy,   styleName: "wavy"      },
 
 // XXX relativeSize 2.0 cannot be tested by CSS3 text-decoration
 
 ];
 
+function IsD2DEnabled() {
+  var enabled = false;
+
+  try {
+    enabled = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).D2DEnabled;
+  } catch(e) {}
+
+  return enabled;
+}
+
 function getFuzz(test) {
-  // Only failing on Windows 8, and only for 16 permutations.
-  if (navigator.userAgent.indexOf("Windows NT 6.2") > -1 &&
+  // Only failing on Windows with Direct2D enabled, and only for 16 permutations.
+  if (IsD2DEnabled() &&
       test.decoration.styleName == "solid" &&
       test.decoration.relativeSize == "1" &&
       test.font.family == "mplusTest" &&
       test.selection.typeName != "SpellCheck") {
     return { numDifferentPixels: 194, maxDifference: 1 };
   }
   return null;
 }