Update canvas tests to fix =~ usage and to mark passing tests as ok
☠☠ backed out by 8a2cc715362c ☠ ☠
authorVladimir Vukicevic <vladimir@pobox.com>
Wed, 03 Mar 2010 16:40:27 -0800
changeset 38911 c9ff351b0738ad621eadc7be318d0ac52e168ee5
parent 38910 1672d4c79e828d6402a71d9db6a4f87b882fb3f0
child 38912 ae611af68f6fb1dc3c79cadbfd9c3317920a100e
child 38918 8a2cc715362cb1ac5a88895c3d699d996a03e566
push id11932
push uservladimir@mozilla.com
push dateThu, 04 Mar 2010 00:41:21 +0000
treeherderautoland@c9ff351b0738 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a3pre
Update canvas tests to fix =~ usage and to mark passing tests as ok
content/canvas/test/test_canvas.html
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -3965,17 +3965,17 @@ ok(ctx.fillStyle == '#000000', "ctx.fill
 <script>
 
 function test_2d_fillStyle_get_semitransparent() {
 
 var canvas = document.getElementById('c138');
 var ctx = canvas.getContext('2d');
 
 ctx.fillStyle = 'rgba(255,255,255,0.45)';
-ok(ctx.fillStyle =~ /^rgba\(255, 255, 255, 0\.4\d+\)$/, "ctx.fillStyle =~ /^rgba\\(255, 255, 255, 0\\.4\\d+\\)$/");
+ok(/^rgba\(255, 255, 255, 0\.4\d+\)$/.test(ctx.fillStyle), "ctx.fillStyle =~ /^rgba\\(255, 255, 255, 0\\.4\\d+\\)$/");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.fillStyle.get.solid.html ]]] -->
 
 <p>Canvas test: 2d.fillStyle.get.solid</p>
@@ -5406,17 +5406,17 @@ isPixel(ctx, 50,25, 128,128,128,255, 0);
 function test_2d_fillStyle_parse_system() {
 
 var canvas = document.getElementById('c203');
 var ctx = canvas.getContext('2d');
 
 
 ctx.fillStyle = '#f00';
 ctx.fillStyle = 'ThreeDDarkShadow';
-ok(ctx.fillStyle =~ /^#(?!(FF0000|ff0000|f00)$)/, "ctx.fillStyle =~ /^#(?!(FF0000|ff0000|f00)$)/"); // test that it's not red
+ok(/^#(?!(FF0000|ff0000|f00)$)/.test(ctx.fillStyle), "ctx.fillStyle =~ /^#(?!(FF0000|ff0000|f00)$)/"); // test that it's not red
 
 
 }
 </script>
 
 <!-- [[[ test_2d.fillStyle.parse.transparent-1.html ]]] -->
 
 <p>Canvas test: 2d.fillStyle.parse.transparent-1</p>
@@ -7953,23 +7953,23 @@ isPixel(ctx, 75,25, 0,255,0,255, 2);
 
 function test_2d_imageData_get_zero() {
 
 var canvas = document.getElementById('c278');
 var ctx = canvas.getContext('2d');
 
 var _thrown = undefined; try {
   ctx.getImageData(1, 1, 10, 0);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
 var _thrown = undefined; try {
   ctx.getImageData(1, 1, 0, 10);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
 var _thrown = undefined; try {
   ctx.getImageData(1, 1, 0, 0);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw INDEX_SIZE_ERR");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.clamp.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.clamp</p>
@@ -7981,41 +7981,41 @@ function test_2d_imageData_object_clamp(
 
 var canvas = document.getElementById('c279');
 var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 
 imgdata.data[0] = 100;
 imgdata.data[0] = 300;
-todo(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
+ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
 imgdata.data[0] = 100;
 imgdata.data[0] = -100;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 
 imgdata.data[0] = 100;
 imgdata.data[0] = 200+Math.pow(2, 32);
-todo(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
+ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
 imgdata.data[0] = 100;
 imgdata.data[0] = -200-Math.pow(2, 32);
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 
 imgdata.data[0] = 100;
 imgdata.data[0] = Math.pow(10, 39);
-todo(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
+ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
 imgdata.data[0] = 100;
 imgdata.data[0] = -Math.pow(10, 39);
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 
 imgdata.data[0] = 100;
 imgdata.data[0] = -Infinity;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 imgdata.data[0] = 100;
 imgdata.data[0] = Infinity;
-todo(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
+ok(imgdata.data[0] === 255, "imgdata.data[\""+(0)+"\"] === 255");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.ctor.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.ctor</p>
@@ -8047,20 +8047,20 @@ try { var _thrown = false;
 function test_2d_imageData_object_nan() {
 
 var canvas = document.getElementById('c281');
 var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 imgdata.data[0] = 100;
 imgdata.data[0] = NaN;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 imgdata.data[0] = 100;
 imgdata.data[0] = "cheese";
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.properties.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.properties</p>
@@ -8096,23 +8096,23 @@ var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 var w = imgdata.width;
 var h = imgdata.height;
 var d = imgdata.data;
 imgdata.width = 123;
 imgdata.height = 123;
 imgdata.data = [100,100,100,100];
-todo(imgdata.width === w, "imgdata.width === w");
-todo(imgdata.height === h, "imgdata.height === h");
-todo(imgdata.data === d, "imgdata.data === d");
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
-todo(imgdata.data[1] === 0, "imgdata.data[\""+(1)+"\"] === 0");
-todo(imgdata.data[2] === 0, "imgdata.data[\""+(2)+"\"] === 0");
-todo(imgdata.data[3] === 0, "imgdata.data[\""+(3)+"\"] === 0");
+ok(imgdata.width === w, "imgdata.width === w");
+ok(imgdata.height === h, "imgdata.height === h");
+ok(imgdata.data === d, "imgdata.data === d");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[1] === 0, "imgdata.data[\""+(1)+"\"] === 0");
+ok(imgdata.data[2] === 0, "imgdata.data[\""+(2)+"\"] === 0");
+ok(imgdata.data[3] === 0, "imgdata.data[\""+(3)+"\"] === 0");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.round.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.round</p>
@@ -8122,37 +8122,37 @@ todo(imgdata.data[3] === 0, "imgdata.dat
 
 function test_2d_imageData_object_round() {
 
 var canvas = document.getElementById('c284');
 var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 imgdata.data[0] = 0.499;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 imgdata.data[0] = 0.5;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 imgdata.data[0] = 0.501;
-todo(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
+ok(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
 imgdata.data[0] = 1.499;
-todo(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
+ok(imgdata.data[0] === 1, "imgdata.data[\""+(0)+"\"] === 1");
 imgdata.data[0] = 1.5;
-todo(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
+ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
 imgdata.data[0] = 1.501;
-todo(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
+ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
 imgdata.data[0] = 2.5;
-todo(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
+ok(imgdata.data[0] === 2, "imgdata.data[\""+(0)+"\"] === 2");
 imgdata.data[0] = 3.5;
-todo(imgdata.data[0] === 4, "imgdata.data[\""+(0)+"\"] === 4");
+ok(imgdata.data[0] === 4, "imgdata.data[\""+(0)+"\"] === 4");
 imgdata.data[0] = 252.5;
-todo(imgdata.data[0] === 252, "imgdata.data[\""+(0)+"\"] === 252");
+ok(imgdata.data[0] === 252, "imgdata.data[\""+(0)+"\"] === 252");
 imgdata.data[0] = 253.5;
-todo(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
+ok(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
 imgdata.data[0] = 254.5;
-todo(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
+ok(imgdata.data[0] === 254, "imgdata.data[\""+(0)+"\"] === 254");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.set.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.set</p>
@@ -8185,23 +8185,23 @@ ok(imgdata.data[0] === 200, "imgdata.dat
 function test_2d_imageData_object_string() {
 
 var canvas = document.getElementById('c286');
 var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 imgdata.data[0] = 100;
 imgdata.data[0] = "110";
-todo(imgdata.data[0] === 110, "imgdata.data[\""+(0)+"\"] === 110");
+ok(imgdata.data[0] === 110, "imgdata.data[\""+(0)+"\"] === 110");
 imgdata.data[0] = 100;
 imgdata.data[0] = "0x78";
-todo(imgdata.data[0] === 120, "imgdata.data[\""+(0)+"\"] === 120");
+ok(imgdata.data[0] === 120, "imgdata.data[\""+(0)+"\"] === 120");
 imgdata.data[0] = 100;
 imgdata.data[0] = " +130e0 ";
-todo(imgdata.data[0] === 130, "imgdata.data[\""+(0)+"\"] === 130");
+ok(imgdata.data[0] === 130, "imgdata.data[\""+(0)+"\"] === 130");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.object.undefined.html ]]] -->
 
 <p>Canvas test: 2d.imageData.object.undefined</p>
@@ -8212,17 +8212,17 @@ todo(imgdata.data[0] === 130, "imgdata.d
 function test_2d_imageData_object_undefined() {
 
 var canvas = document.getElementById('c287');
 var ctx = canvas.getContext('2d');
 
 var imgdata = ctx.getImageData(0, 0, 10, 10);
 imgdata.data[0] = 100;
 imgdata.data[0] = undefined;
-todo(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
+ok(imgdata.data[0] === 0, "imgdata.data[\""+(0)+"\"] === 0");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.put.alpha.html ]]] -->
 
 <p>Canvas test: 2d.imageData.put.alpha</p>
@@ -8866,17 +8866,17 @@ var _thrown = undefined; try {
 
 function test_2d_imageData_put_null() {
 
 var canvas = document.getElementById('c300');
 var ctx = canvas.getContext('2d');
 
 var _thrown = undefined; try {
   ctx.putImageData(null, 0, 0);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.imageData.put.path.html ]]] -->
 
 <p>Canvas test: 2d.imageData.put.path</p>
@@ -8981,20 +8981,20 @@ var canvas = document.getElementById('c3
 var ctx = canvas.getContext('2d');
 
 var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] };
 var _thrown = undefined; try {
   ctx.putImageData(imgdata, 0, 0);
 } catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
 var _thrown = undefined; try {
   ctx.putImageData("cheese", 0, 0);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
 var _thrown = undefined; try {
   ctx.putImageData(42, 0, 0);
-} catch (e) { _thrown = e }; todo(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
+} catch (e) { _thrown = e }; ok(_thrown && _thrown.code == DOMException.TYPE_MISMATCH_ERR, "should throw TYPE_MISMATCH_ERR");
 
 
 }
 </script>
 
 <!-- [[[ test_2d.line.cap.butt.html ]]] -->
 
 <p>Canvas test: 2d.line.cap.butt</p>
@@ -20456,17 +20456,17 @@ function test_toDataURL_arguments_1() {
 
 var canvas = document.getElementById('c664');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
 
 var data = canvas.toDataURL('image/png', 'another argument that should not raise an exception');
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 } catch (e) {
     _thrown_outer = true;
 }
 todo(!_thrown_outer, 'should not throw exception');
 
 
 }
@@ -20483,17 +20483,17 @@ function test_toDataURL_arguments_2() {
 
 var canvas = document.getElementById('c665');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
 
 var data = canvas.toDataURL('image/png', 'another argument that should not raise an exception', 'and another');
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 } catch (e) {
     _thrown_outer = true;
 }
 todo(!_thrown_outer, 'should not throw exception');
 
 
 }
@@ -20511,17 +20511,17 @@ function test_toDataURL_arguments_3() {
 var canvas = document.getElementById('c666');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
 
 // More arguments that should not raise exceptions
 var data = canvas.toDataURL('image/png', null, null, null);
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 } catch (e) {
     _thrown_outer = true;
 }
 todo(!_thrown_outer, 'should not throw exception');
 
 
 }
@@ -20575,17 +20575,17 @@ img.src = canvas667.toDataURL();
 <script>
 
 function test_toDataURL_default() {
 
 var canvas = document.getElementById('c668');
 var ctx = canvas.getContext('2d');
 
 var data = canvas.toDataURL();
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 
 }
 </script>
 
 <!-- [[[ test_toDataURL.lowercase.html ]]] -->
 
 <p>Canvas test: toDataURL.lowercase - bug 401795</p>
@@ -20597,17 +20597,17 @@ function test_toDataURL_lowercase() {
 
 var canvas = document.getElementById('c669');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
 
 var data = canvas.toDataURL('ImAgE/PnG');
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 } catch (e) {
     _thrown_outer = true;
 }
 todo(!_thrown_outer, 'should not throw exception');
 
 
 }
@@ -20621,18 +20621,19 @@ todo(!_thrown_outer, 'should not throw e
 <script>
 
 function test_toDataURL_nocontext() {
 
 var canvas = document.getElementById('c670');
 var ctx = canvas.getContext('2d');
 
 var canvas2 = document.createElement('canvas');
+
 var data = canvas2.toDataURL();
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 
 }
 </script>
 
 <!-- [[[ test_toDataURL.png.html ]]] -->
 
 <p>Canvas test: toDataURL.png</p>
@@ -20641,17 +20642,17 @@ ok(data =~ /^data:image\/png[;,]/, "data
 <script>
 
 function test_toDataURL_png() {
 
 var canvas = document.getElementById('c671');
 var ctx = canvas.getContext('2d');
 
 var data = canvas.toDataURL('image/png');
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 
 }
 </script>
 
 <!-- [[[ test_toDataURL.primarycolours.html ]]] -->
 
 <p>Canvas test: toDataURL.primarycolours</p>
@@ -20704,17 +20705,17 @@ function test_toDataURL_unrecognised() {
 
 var canvas = document.getElementById('c673');
 var ctx = canvas.getContext('2d');
 
 var _thrown_outer = false;
 try {
 
 var data = canvas.toDataURL('image/example');
-ok(data =~ /^data:image\/png[;,]/, "data =~ /^data:image\\/png[;,]/");
+ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
 
 } catch (e) {
     _thrown_outer = true;
 }
 todo(!_thrown_outer, 'should not throw exception');
 
 
 }