Bug 587316 - Part 2: Disable degenerate rect stroking test. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Mon, 16 Aug 2010 09:15:02 +0200
changeset 50649 ea6bbdbf14906e86599d3648594ad5aefc322321
parent 50648 9cb9cb9dd8fafa7164445ec5037f2a41d5375a81
child 50650 1d7c15818f663035ce835a7c336d6d0496a7fe54
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs587316
milestone2.0b4pre
Bug 587316 - Part 2: Disable degenerate rect stroking test. r=jrmuizel
content/canvas/test/test_canvas.html
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -3,16 +3,27 @@
 <script src="/MochiKit/packed.js"></script>
 <script src="/tests/SimpleTest/SimpleTest.js"></script>
 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
 <body>
 <script>
 
 SimpleTest.waitForExplicitFinish();
 
+function IsD2DEnabled() {
+    var enabled = false;
+
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
+    } catch(e) {}
+    
+    return enabled;
+}
+
 </script>
 <!-- Includes all the tests in the content/canvas/tests except for test_bug397524.html -->
 
 <!-- [[[ test_2d.canvas.readonly.html ]]] -->
 
 <p>Canvas test: 2d.canvas.readonly</p>
 <!-- Testing: CanvasRenderingContext2D.canvas is readonly -->
 <canvas id="c1" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
@@ -13802,23 +13813,25 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
 <script>
 
 
 function test_2d_path_rect_zero_3() {
 
 var canvas = document.getElementById('c438');
 var ctx = canvas.getContext('2d');
 
-ctx.strokeStyle = '#f00';
-ctx.lineWidth = 100;
-ctx.beginPath();
-ctx.rect(50, 25, 0, 0);
-ctx.stroke();
-isPixel(ctx, 50,25, 0,0,0,0, 0);
-
+if (!IsD2DEnabled()) {
+    // Disabled for D2D until we can figure out Bug 587554.
+    ctx.strokeStyle = '#f00';
+    ctx.lineWidth = 100;
+    ctx.beginPath();
+    ctx.rect(50, 25, 0, 0);
+    ctx.stroke();
+    isPixel(ctx, 50,25, 0,0,0,0, 0);
+}
 
 }
 </script>
 
 <!-- [[[ test_2d.path.rect.zero.4.html ]]] -->
 
 <p>Canvas test: 2d.path.rect.zero.4</p>
 <canvas id="c439" width="100" height="50" style="background: #f00"><p class="fallback">FAIL (fallback content)</p></canvas>
@@ -18049,21 +18062,23 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
 <script>
 
 
 function test_2d_strokeRect_zero_1() {
 
 var canvas = document.getElementById('c580');
 var ctx = canvas.getContext('2d');
 
-ctx.strokeStyle = '#f00';
-ctx.lineWidth = 250;
-ctx.strokeRect(50, 25, 0, 0);
-isPixel(ctx, 50,25, 0,0,0,0, 0);
-
+if (!IsD2DEnabled()) {
+    // Disabled for D2D until we can figure out Bug 587554.
+    ctx.strokeStyle = '#f00';
+    ctx.lineWidth = 250;
+    ctx.strokeRect(50, 25, 0, 0);
+    isPixel(ctx, 50,25, 0,0,0,0, 0);
+}
 
 }
 </script>
 
 <!-- [[[ test_2d.strokeRect.zero.2.html ]]] -->
 
 <p>Canvas test: 2d.strokeRect.zero.2</p>
 <canvas id="c581" width="100" height="50" style="background: #0f0"><p class="fallback">FAIL (fallback content)</p></canvas>