Bug 1087650 - Rename mochitests to test_*. - r=kamidphish
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 22 Oct 2014 12:27:21 -0700
changeset 213825 10ec61ff9b6c1c7f1a58bcdbb73caa5576d57a46
parent 213824 5156cefdad51ca3d0d56cf8cfb4895864e85ce84
child 213826 1bc2c5b8873a137288888b6afd452d79bb29c203
push idunknown
push userunknown
push dateunknown
reviewerskamidphish
bugs1087650
milestone36.0a1
Bug 1087650 - Rename mochitests to test_*. - r=kamidphish
CLOBBER
dom/canvas/test/webgl-mochitest.ini
dom/canvas/test/webgl-mochitest/test-backbuffer-channels.html
dom/canvas/test/webgl-mochitest/test-hidden-alpha.html
dom/canvas/test/webgl-mochitest/test_backbuffer_channels.html
dom/canvas/test/webgl-mochitest/test_hidden_alpha.html
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1092813 needs a CLOBBER
+Bug 1087560 changed a mochitest manifest without touching its moz.build.
--- a/dom/canvas/test/webgl-mochitest.ini
+++ b/dom/canvas/test/webgl-mochitest.ini
@@ -1,15 +1,15 @@
 [DEFAULT]
 support-files =
   webgl-mochitest/driver-info.js
   webgl-mochitest/webgl-util.js
 
-[webgl-mochitest/test-backbuffer-channels.html]
-[webgl-mochitest/test-hidden-alpha.html]
+[webgl-mochitest/test_backbuffer_channels.html]
+[webgl-mochitest/test_hidden_alpha.html]
 [webgl-mochitest/test_depth_readpixels.html]
 [webgl-mochitest/test_draw.html]
 [webgl-mochitest/test_fb_param.html]
 [webgl-mochitest/test_fb_param_crash.html]
 [webgl-mochitest/test_highp_fs.html]
 [webgl-mochitest/test_no_arr_points.html]
 skip-if = android_version == '10' #Android 2.3 aws only; bug 1030942
 [webgl-mochitest/test_noprog_draw.html]
deleted file mode 100644
--- a/dom/canvas/test/webgl-mochitest/test-backbuffer-channels.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE HTML>
-<title>WebGL test: bug 958723</title>
-<script src="/tests/SimpleTest/SimpleTest.js"></script>
-<link rel="stylesheet" href="/tests/SimpleTest/test.css">
-<script src="driver-info.js"></script>
-<script src="webgl-util.js"></script>
-<body>
-<script>
-
-function TestAttribs(attribs) {
-  debug('Testing attribs: ' + JSON.stringify(attribs));
-  var canvas = document.createElement('canvas');
-  var gl = canvas.getContext('experimental-webgl', attribs);
-  ok(gl, 'No tested attribs should result in failure to create a context');
-  if (!gl)
-    return;
-
-  var actual = gl.getContextAttributes();
-
-  ok(actual.alpha == attribs.alpha,
-     'Resulting `alpha` should match request.');
-  ok(actual.premultipliedAlpha == attribs.premultipliedAlpha,
-     'Resulting `premultipliedAlpha` should match request.');
-  ok(actual.preserveDrawingBuffer == attribs.preserveDrawingBuffer,
-     'Resulting `preserveDrawingBuffer` should match request.');
-
-  // "The depth, stencil and antialias attributes, when set to true, are
-  // requests, not requirements."
-  if (!attribs.antialias) {
-    ok(!actual.antialias, 'No `antialias` if not requested.');
-  }
-  if (!attribs.depth) {
-    ok(!actual.depth, 'No `depth` if not requested.');
-  }
-  if (!attribs.stencil) {
-    ok(!actual.stencil, 'No `stencil` if not requested.');
-  }
-
-  var hasAlpha = !!gl.getParameter(gl.ALPHA_BITS);
-  var hasDepth = !!gl.getParameter(gl.DEPTH_BITS);
-  var hasStencil = !!gl.getParameter(gl.STENCIL_BITS);
-  var hasAntialias = !!gl.getParameter(gl.SAMPLES);
-
-  ok(hasAlpha == actual.alpha, 'Bits should match `alpha` attrib.');
-  ok(hasAntialias == actual.antialias, 'Bits should match `antialias` attrib.');
-  ok(hasDepth == actual.depth, 'Bits should match `depth` attrib.');
-  ok(hasStencil == actual.stencil, 'Bits should match `stencil` attrib.');
-}
-
-function CloneAttribs(attribs) {
-  return {
-    alpha: attribs.alpha,
-    antialias: attribs.antialias,
-    depth: attribs.depth,
-    premultipliedAlpha: attribs.premultipliedAlpha,
-    preserveDrawingBuffer: attribs.preserveDrawingBuffer,
-    stencil: attribs.stencil,
-  };
-}
-
-function SplitForAttrib(list, attrib) {
-  var ret = [];
-
-  for (var i in list) {
-    var cur = list[i];
-    if (cur[attrib])
-      throw 'Attrib is already true.';
-
-    var clone = CloneAttribs(cur);
-    clone[attrib] = true;
-
-    ret.push(cur);
-    ret.push(clone);
-  }
-
-  return ret;
-}
-
-function GenAttribList() {
-  var base = {
-    alpha: false,
-    antialias: false,
-    depth: false,
-    premultipliedAlpha: false,
-    preserveDrawingBuffer: false,
-    stencil: false,
-  };
-  var list = [base];
-  list = SplitForAttrib(list, 'alpha');
-  list = SplitForAttrib(list, 'antialias');
-  list = SplitForAttrib(list, 'depth');
-  list = SplitForAttrib(list, 'premultipliedAlpha');
-  list = SplitForAttrib(list, 'preserveDrawingBuffer');
-  list = SplitForAttrib(list, 'stencil');
-
-  if (list.length != 1<<6)
-    throw 'Attribs list length wrong: ' + list.length;
-
-  return list;
-}
-
-var list = GenAttribList();
-for (var i in list) {
-  var attribs = list[i];
-  TestAttribs(attribs);
-}
-
-ok(true, 'Test complete.');
-
-</script>
-
deleted file mode 100644
--- a/dom/canvas/test/webgl-mochitest/test-hidden-alpha.html
+++ /dev/null
@@ -1,153 +0,0 @@
-<!DOCTYPE HTML>
-<title>WebGL test: Hidden alpha on no-alpha contexts</title>
-<script src='/tests/SimpleTest/SimpleTest.js'></script>
-<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
-<script src='driver-info.js'></script>
-<script src='webgl-util.js'></script>
-<body>
-<script id='vs' type='x-shader/x-vertex'>
-  attribute vec2 aPosCoord;
-
-  void main(void) {
-    gl_Position = vec4(aPosCoord, 0.0, 1.0);
-  }
-</script>
-
-<script id='fs' type='x-shader/x-fragment'>
-  precision mediump float;
-
-  void main(void) {
-    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-  }
-</script>
-<canvas id='canvas' style='border: none;' width='100' height='100'></canvas>
-<script>
-
-var posCoords_arr = new Float32Array(2 * 4);
-var posCoords_buff = null;
-function DrawQuad(gl, prog, x0, y0, x1, y1) {
-  gl.useProgram(prog);
-
-  if (!posCoords_buff) {
-    posCoords_buff = gl.createBuffer();
-  }
-  gl.bindBuffer(gl.ARRAY_BUFFER, posCoords_buff);
-  posCoords_arr[0] = x0;
-  posCoords_arr[1] = y0;
-
-  posCoords_arr[2] = x1;
-  posCoords_arr[3] = y0;
-
-  posCoords_arr[4] = x0;
-  posCoords_arr[5] = y1;
-
-  posCoords_arr[6] = x1;
-  posCoords_arr[7] = y1;
-  gl.bufferData(gl.ARRAY_BUFFER, posCoords_arr, gl.STREAM_DRAW);
-
-  gl.enableVertexAttribArray(prog.aPosCoord);
-  gl.vertexAttribPointer(prog.aPosCoord, 2, gl.FLOAT, false, 0, 0);
-
-  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
-}
-
-function DrawSquare(gl, prog, size) {
-  DrawQuad(gl, prog, -size, -size, size, size);
-}
-
-function Reset(gl) {
-  gl.canvas.width += 1;
-  gl.canvas.width -= 1;
-}
-
-function ReadCenterPixel(gl) {
-  var w = gl.drawingbufferWidth;
-  var h = gl.drawingbufferHeight;
-  var ret = new Uint8Array(4);
-  gl.readPixels(w/2, h/2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, ret);
-  return ret;
-}
-
-function Test(gl, prog) {
-  gl.enable(gl.BLEND);
-  gl.blendFunc(gl.ZERO, gl.DST_ALPHA);
-
-  var iColor = 64;
-  var fColor = iColor / 255.0;
-
-  //////////////////
-
-  debug('clear(R,G,B,0)');
-
-  Reset(gl);
-
-  gl.clearColor(fColor, fColor, fColor, 0.0);
-  gl.clear(gl.COLOR_BUFFER_BIT);
-
-  var dataURL_pre = gl.canvas.toDataURL();
-  //console.log('Before blending: ' + dataURL_pre);
-
-  DrawSquare(gl, prog, 0.7);
-
-  var pixel = ReadCenterPixel(gl);
-  ok(pixel[0] == iColor &&
-     pixel[1] == iColor &&
-     pixel[2] == iColor, 'Color should be the same.');
-  ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
-
-  var dataURL_post = gl.canvas.toDataURL();
-  //console.log('After blending: ' + dataURL_post);
-  ok(dataURL_post == dataURL_pre,
-     'toDataURL should be unchanged after blending.');
-
-  //////////////////
-
-  debug('mask(R,G,B,0), clear(R,G,B,1)');
-
-  Reset(gl);
-
-  gl.colorMask(true, true, true, false);
-  gl.clearColor(fColor, fColor, fColor, 1.0);
-  gl.clear(gl.COLOR_BUFFER_BIT);
-  gl.colorMask(true, true, true, true);
-
-  dataURL_pre = gl.canvas.toDataURL();
-  //console.log('Before blending: ' + dataURL_pre);
-
-  DrawSquare(gl, prog, 0.7);
-
-  var pixel = ReadCenterPixel(gl);
-  ok(pixel[0] == iColor &&
-     pixel[1] == iColor &&
-     pixel[2] == iColor, 'Color should be the same.');
-  ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
-  ok(gl.getError() == 0, 'Should have no errors.');
-
-  dataURL_post = gl.canvas.toDataURL();
-  //console.log('After blending: ' + dataURL_post);
-  ok(dataURL_post == dataURL_pre,
-     'toDataURL should be unchanged after blending.');
-
-  ok(true, 'Test complete.');
-}
-
-(function(){
-  var canvas = document.getElementById('canvas');
-  var attribs = {
-    alpha: false,
-    antialias: false,
-    premultipliedAlpha: false,
-  };
-  var gl = canvas.getContext('experimental-webgl', attribs);
-  ok(gl, 'WebGL should work.');
-  ok(gl.getParameter(gl.ALPHA_BITS) == 0, 'Shouldn\'t have alpha bits.');
-
-  var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs');
-  ok(prog, 'Program should link.');
-  prog.aPosCoord = gl.getAttribLocation(prog, 'aPosCoord');
-
-  setTimeout(function(){ Test(gl, prog); }, 500);
-})();
-
-</script>
-</body>
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_backbuffer_channels.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<title>WebGL test: bug 958723</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css">
+<script src="driver-info.js"></script>
+<script src="webgl-util.js"></script>
+<body>
+<script>
+
+function TestAttribs(attribs) {
+  debug('Testing attribs: ' + JSON.stringify(attribs));
+  var canvas = document.createElement('canvas');
+  var gl = canvas.getContext('experimental-webgl', attribs);
+  ok(gl, 'No tested attribs should result in failure to create a context');
+  if (!gl)
+    return;
+
+  var actual = gl.getContextAttributes();
+
+  ok(actual.alpha == attribs.alpha,
+     'Resulting `alpha` should match request.');
+  ok(actual.premultipliedAlpha == attribs.premultipliedAlpha,
+     'Resulting `premultipliedAlpha` should match request.');
+  ok(actual.preserveDrawingBuffer == attribs.preserveDrawingBuffer,
+     'Resulting `preserveDrawingBuffer` should match request.');
+
+  // "The depth, stencil and antialias attributes, when set to true, are
+  // requests, not requirements."
+  if (!attribs.antialias) {
+    ok(!actual.antialias, 'No `antialias` if not requested.');
+  }
+  if (!attribs.depth) {
+    ok(!actual.depth, 'No `depth` if not requested.');
+  }
+  if (!attribs.stencil) {
+    ok(!actual.stencil, 'No `stencil` if not requested.');
+  }
+
+  var hasAlpha = !!gl.getParameter(gl.ALPHA_BITS);
+  var hasDepth = !!gl.getParameter(gl.DEPTH_BITS);
+  var hasStencil = !!gl.getParameter(gl.STENCIL_BITS);
+  var hasAntialias = !!gl.getParameter(gl.SAMPLES);
+
+  ok(hasAlpha == actual.alpha, 'Bits should match `alpha` attrib.');
+  ok(hasAntialias == actual.antialias, 'Bits should match `antialias` attrib.');
+  ok(hasDepth == actual.depth, 'Bits should match `depth` attrib.');
+  ok(hasStencil == actual.stencil, 'Bits should match `stencil` attrib.');
+}
+
+function CloneAttribs(attribs) {
+  return {
+    alpha: attribs.alpha,
+    antialias: attribs.antialias,
+    depth: attribs.depth,
+    premultipliedAlpha: attribs.premultipliedAlpha,
+    preserveDrawingBuffer: attribs.preserveDrawingBuffer,
+    stencil: attribs.stencil,
+  };
+}
+
+function SplitForAttrib(list, attrib) {
+  var ret = [];
+
+  for (var i in list) {
+    var cur = list[i];
+    if (cur[attrib])
+      throw 'Attrib is already true.';
+
+    var clone = CloneAttribs(cur);
+    clone[attrib] = true;
+
+    ret.push(cur);
+    ret.push(clone);
+  }
+
+  return ret;
+}
+
+function GenAttribList() {
+  var base = {
+    alpha: false,
+    antialias: false,
+    depth: false,
+    premultipliedAlpha: false,
+    preserveDrawingBuffer: false,
+    stencil: false,
+  };
+  var list = [base];
+  list = SplitForAttrib(list, 'alpha');
+  list = SplitForAttrib(list, 'antialias');
+  list = SplitForAttrib(list, 'depth');
+  list = SplitForAttrib(list, 'premultipliedAlpha');
+  list = SplitForAttrib(list, 'preserveDrawingBuffer');
+  list = SplitForAttrib(list, 'stencil');
+
+  if (list.length != 1<<6)
+    throw 'Attribs list length wrong: ' + list.length;
+
+  return list;
+}
+
+var list = GenAttribList();
+for (var i in list) {
+  var attribs = list[i];
+  TestAttribs(attribs);
+}
+
+ok(true, 'Test complete.');
+
+</script>
+
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-mochitest/test_hidden_alpha.html
@@ -0,0 +1,153 @@
+<!DOCTYPE HTML>
+<title>WebGL test: Hidden alpha on no-alpha contexts</title>
+<script src='/tests/SimpleTest/SimpleTest.js'></script>
+<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
+<script src='driver-info.js'></script>
+<script src='webgl-util.js'></script>
+<body>
+<script id='vs' type='x-shader/x-vertex'>
+  attribute vec2 aPosCoord;
+
+  void main(void) {
+    gl_Position = vec4(aPosCoord, 0.0, 1.0);
+  }
+</script>
+
+<script id='fs' type='x-shader/x-fragment'>
+  precision mediump float;
+
+  void main(void) {
+    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+  }
+</script>
+<canvas id='canvas' style='border: none;' width='100' height='100'></canvas>
+<script>
+
+var posCoords_arr = new Float32Array(2 * 4);
+var posCoords_buff = null;
+function DrawQuad(gl, prog, x0, y0, x1, y1) {
+  gl.useProgram(prog);
+
+  if (!posCoords_buff) {
+    posCoords_buff = gl.createBuffer();
+  }
+  gl.bindBuffer(gl.ARRAY_BUFFER, posCoords_buff);
+  posCoords_arr[0] = x0;
+  posCoords_arr[1] = y0;
+
+  posCoords_arr[2] = x1;
+  posCoords_arr[3] = y0;
+
+  posCoords_arr[4] = x0;
+  posCoords_arr[5] = y1;
+
+  posCoords_arr[6] = x1;
+  posCoords_arr[7] = y1;
+  gl.bufferData(gl.ARRAY_BUFFER, posCoords_arr, gl.STREAM_DRAW);
+
+  gl.enableVertexAttribArray(prog.aPosCoord);
+  gl.vertexAttribPointer(prog.aPosCoord, 2, gl.FLOAT, false, 0, 0);
+
+  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
+}
+
+function DrawSquare(gl, prog, size) {
+  DrawQuad(gl, prog, -size, -size, size, size);
+}
+
+function Reset(gl) {
+  gl.canvas.width += 1;
+  gl.canvas.width -= 1;
+}
+
+function ReadCenterPixel(gl) {
+  var w = gl.drawingbufferWidth;
+  var h = gl.drawingbufferHeight;
+  var ret = new Uint8Array(4);
+  gl.readPixels(w/2, h/2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, ret);
+  return ret;
+}
+
+function Test(gl, prog) {
+  gl.enable(gl.BLEND);
+  gl.blendFunc(gl.ZERO, gl.DST_ALPHA);
+
+  var iColor = 64;
+  var fColor = iColor / 255.0;
+
+  //////////////////
+
+  debug('clear(R,G,B,0)');
+
+  Reset(gl);
+
+  gl.clearColor(fColor, fColor, fColor, 0.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  var dataURL_pre = gl.canvas.toDataURL();
+  //console.log('Before blending: ' + dataURL_pre);
+
+  DrawSquare(gl, prog, 0.7);
+
+  var pixel = ReadCenterPixel(gl);
+  ok(pixel[0] == iColor &&
+     pixel[1] == iColor &&
+     pixel[2] == iColor, 'Color should be the same.');
+  ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
+
+  var dataURL_post = gl.canvas.toDataURL();
+  //console.log('After blending: ' + dataURL_post);
+  ok(dataURL_post == dataURL_pre,
+     'toDataURL should be unchanged after blending.');
+
+  //////////////////
+
+  debug('mask(R,G,B,0), clear(R,G,B,1)');
+
+  Reset(gl);
+
+  gl.colorMask(true, true, true, false);
+  gl.clearColor(fColor, fColor, fColor, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+  gl.colorMask(true, true, true, true);
+
+  dataURL_pre = gl.canvas.toDataURL();
+  //console.log('Before blending: ' + dataURL_pre);
+
+  DrawSquare(gl, prog, 0.7);
+
+  var pixel = ReadCenterPixel(gl);
+  ok(pixel[0] == iColor &&
+     pixel[1] == iColor &&
+     pixel[2] == iColor, 'Color should be the same.');
+  ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
+  ok(gl.getError() == 0, 'Should have no errors.');
+
+  dataURL_post = gl.canvas.toDataURL();
+  //console.log('After blending: ' + dataURL_post);
+  ok(dataURL_post == dataURL_pre,
+     'toDataURL should be unchanged after blending.');
+
+  ok(true, 'Test complete.');
+}
+
+(function(){
+  var canvas = document.getElementById('canvas');
+  var attribs = {
+    alpha: false,
+    antialias: false,
+    premultipliedAlpha: false,
+  };
+  var gl = canvas.getContext('experimental-webgl', attribs);
+  ok(gl, 'WebGL should work.');
+  ok(gl.getParameter(gl.ALPHA_BITS) == 0, 'Shouldn\'t have alpha bits.');
+
+  var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs');
+  ok(prog, 'Program should link.');
+  prog.aPosCoord = gl.getAttribLocation(prog, 'aPosCoord');
+
+  setTimeout(function(){ Test(gl, prog); }, 500);
+})();
+
+</script>
+</body>