Bug 692879. Handle failing tests on OS X 10.5. r=mwoodrow
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 04 Jan 2012 15:35:55 -0500
changeset 85865 eb66e5b64afe00027e863082a1d5252ad181a40f
parent 85864 fe11808a4109f60910d6b4b58d5ac1067243f87b
child 85866 91ee34dffc9f3f51f0e16c16fc2923877e2cacd4
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwoodrow
bugs692879
milestone12.0a1
Bug 692879. Handle failing tests on OS X 10.5. r=mwoodrow
content/canvas/test/test_canvas.html
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -13,16 +13,33 @@ function IsD2DEnabled() {
     try {
         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
     } catch(e) {}
     
     return enabled;
 }
 
+function IsMacOSX10_5orOlder() {
+    var is105orOlder = false;
+
+    if (navigator.platform.indexOf("Mac") == 0) {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        var version = Components.classes["@mozilla.org/system-info;1"]
+                            .getService(Components.interfaces.nsIPropertyBag2)
+                            .getProperty("version");
+        // the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
+        // Mac OS 10.5 would be Darwin version 9. the |version| string we've got here
+        // is the Darwin version.
+        is105orOlder = (parseFloat(version) < 10.0);
+    }
+    return is105orOlder;
+}
+
+
 function IsAzureEnabled() {
   var enabled = false;
 
   try {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
     enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).AzureEnabled;
   } catch (e) { }
 
@@ -5773,20 +5790,22 @@ isPixel(ctx, 80,25, 0,255,0,255, 2);
 <script>
 
 
 function test_2d_gradient_interpolate_overlap() {
 
 var canvas = document.getElementById('c215');
 var ctx = canvas.getContext('2d');
 
-if (!IsD2DEnabled()) {
-    // Only run this on non-D2D. On D2D the different nature of how gradients
+if (!IsD2DEnabled() && !IsMacOSX10_5orOlder()) {
+    // On D2D the different nature of how gradients
     // are drawn makes it so we cannot guarantee these stops are completely
     // hard.
+
+    // On OS X 10.5 quartz is confused by the overlapping stops: Bug #715235
     canvas.width = 200;
     var g = ctx.createLinearGradient(0, 0, 200, 0);
     g.addColorStop(0, '#f00');
     g.addColorStop(0, '#ff0');
     g.addColorStop(0.25, '#00f');
     g.addColorStop(0.25, '#0f0');
     g.addColorStop(0.25, '#0f0');
     g.addColorStop(0.25, '#0f0');
@@ -5830,22 +5849,25 @@ for (var p = 0; p < ps.length; ++p)
 {
         g.addColorStop(ps[p], '#0f0');
         for (var i = 0; i < 15; ++i)
                 g.addColorStop(ps[p], '#f00');
         g.addColorStop(ps[p], '#0f0');
 }
 ctx.fillStyle = g;
 ctx.fillRect(0, 0, 100, 50);
-isPixel(ctx, 1,25, 0,255,0,255, 0);
-isPixel(ctx, 30,25, 0,255,0,255, 0);
-isPixel(ctx, 40,25, 0,255,0,255, 0);
-isPixel(ctx, 60,25, 0,255,0,255, 0);
-isPixel(ctx, 80,25, 0,255,0,255, 0);
-
+
+if (!IsMacOSX10_5orOlder()) {
+    // On OS X 10.5 quartz is confused by the overlapping stops: Bug #715235
+    isPixel(ctx, 1,25, 0,255,0,255, 0);
+    isPixel(ctx, 30,25, 0,255,0,255, 0);
+    isPixel(ctx, 40,25, 0,255,0,255, 0);
+    isPixel(ctx, 60,25, 0,255,0,255, 0);
+    isPixel(ctx, 80,25, 0,255,0,255, 0);
+}
 
 }
 </script>
 
 <!-- [[[ test_2d.gradient.interpolate.solid.html ]]] -->
 
 <p>Canvas test: 2d.gradient.interpolate.solid</p>
 <canvas id="c217" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>