content/canvas/test/webgl-conformance/conformance/more/unit.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 /*
     2 Unit testing library for the OpenGL ES 2.0 HTML Canvas context
     4 Copyright (C) 2011  Ilmari Heikkinen <ilmari.heikkinen@gmail.com>
     6 Permission is hereby granted, free of charge, to any person
     7 obtaining a copy of this software and associated documentation
     8 files (the "Software"), to deal in the Software without
     9 restriction, including without limitation the rights to use,
    10 copy, modify, merge, publish, distribute, sublicense, and/or sell
    11 copies of the Software, and to permit persons to whom the
    12 Software is furnished to do so, subject to the following
    13 conditions:
    15 The above copyright notice and this permission notice shall be
    16 included in all copies or substantial portions of the Software.
    18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    20 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    22 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    23 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    24 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    25 OTHER DEALINGS IN THE SOFTWARE.
    26 */
    27 Tests = {
    28   autorun : true,
    29   message : null,
    30   delay : 0,
    32   startUnit : function(){ return []; },
    33   setup : function() { return arguments; },
    34   teardown : function() {},
    35   endUnit : function() {}
    36 }
    38 var __testSuccess__ = true;
    39 var __testFailCount__ = 0;
    40 var __testLog__;
    41 var __backlog__ = [];
    43 Object.toSource = function(a, seen){
    44   if (a == null) return "null";
    45   if (typeof a == 'boolean') return a ? "true" : "false";
    46   if (typeof a == 'string') return '"' + a.replace(/"/g, '\\"') + '"';
    47   if (a instanceof HTMLElement) return a.toString();
    48   if (a.width && a.height && a.data) return "[ImageData]";
    49   if (a instanceof Array) {
    50     if (!seen) seen = [];
    51     var idx = seen.indexOf(a);
    52     if (idx != -1) return '#'+(idx+1)+'#';
    53     seen.unshift(a);
    54     var srcs = a.map(function(o){ return Object.toSource(o,seen) });
    55     var prefix = '';
    56     idx = seen.indexOf(a);
    57     if (idx != -1) prefix = '#'+(idx+1)+'=';
    58     return prefix + '[' + srcs.join(", ") + ']';
    59   }
    60   if (typeof a == 'object') {
    61     if (!seen) seen = [];
    62     var idx = seen.indexOf(a);
    63     if (idx != -1) return '#'+(idx+1)+'#';
    64     seen.unshift(a);
    65     var members = [];
    66     var name;
    67     try {
    68       for (var i in a) {
    69         if (i.search(/^[a-zA-Z0-9]+$/) != -1)
    70           name = i;
    71         else
    72           name = '"' + i.replace(/"/g, '\\"') + '"';
    73         var ai;
    74         try { ai = a[i]; }
    75         catch(e) { ai = 'null /*ERROR_ACCESSING*/'; }
    76         var s = name + ':' + Object.toSource(ai, seen);
    77         members.push(s);
    78       }
    79     } catch (e) {}
    80     var prefix = '';
    81     idx = seen.indexOf(a);
    82     if (idx != -1) prefix = '#'+(idx+1)+'=';
    83     return prefix + '{' + members.join(", ") + '}'
    84   }
    85   if (typeof a == 'function')
    86     return '('+a.toString().replace(/\n/g, " ").replace(/\s+/g, " ")+')';
    87   return a.toString();
    88 }
    90 function formatError(e) {
    91   if (window.console) console.log(e);
    92   var pathSegs = location.href.toString().split("/");
    93   var currentDoc = e.lineNumber != null ? pathSegs[pathSegs.length - 1] : null;
    94   var trace = (e.filename || currentDoc) + ":" + e.lineNumber + (e.trace ? "\n"+e.trace : "");
    95   return e.message + "\n" + trace;
    96 }
    98 function runTests() {
    99   var h = document.getElementById('test-status');
   100   if (h == null) {
   101     h = document.createElement('h1');
   102     h.id = 'test-status';
   103     document.body.appendChild(h);
   104   }
   105   h.textContent = "";
   106   var log = document.getElementById('test-log');
   107   if (log == null) {
   108     log = document.createElement('div');
   109     log.id = 'test-log';
   110     document.body.appendChild(log);
   111   }
   112   while (log.childNodes.length > 0)
   113     log.removeChild(log.firstChild);
   115   var setup_args = [];
   117   if (Tests.startUnit != null) {
   118     __testLog__ = document.createElement('div');
   119     try {
   120       setup_args = Tests.startUnit();
   121       if (__testLog__.childNodes.length > 0)
   122         log.appendChild(__testLog__);
   123     } catch(e) {
   124       testFailed("startUnit", formatError(e));
   125       log.appendChild(__testLog__);
   126       printTestStatus();
   127       return;
   128     }
   129   }
   131   var testsRun = false;
   132   var allTestsSuccessful = true;
   134   for (var i in Tests) {
   135     if (i.substring(0,4) != "test") continue;
   136     __testLog__ = document.createElement('div');
   137     __testSuccess__ = true;
   138     try {
   139       doTestNotify (i);
   140       var args = setup_args;
   141       if (Tests.setup != null)
   142         args = Tests.setup.apply(Tests, setup_args);
   143       Tests[i].apply(Tests, args);
   144       if (Tests.teardown != null)
   145         Tests.teardown.apply(Tests, args);
   146     }
   147     catch (e) {
   148       testFailed(i, e.name, formatError(e));
   149     }
   150     if (__testSuccess__ == false) {
   151       ++__testFailCount__;
   152     }
   153     var h = document.createElement('h2');
   154     h.textContent = i;
   155     __testLog__.insertBefore(h, __testLog__.firstChild);
   156     log.appendChild(__testLog__);
   157     allTestsSuccessful = allTestsSuccessful && __testSuccess__ == true;
   158     reportTestResultsToHarness(__testSuccess__, i);
   159     doTestNotify (i+"--"+(__testSuccess__?"OK":"FAIL"));
   160     testsRun = true;
   161   }
   163   printTestStatus(testsRun);
   164   if (Tests.endUnit != null) {
   165     __testLog__ = document.createElement('div');
   166     try {
   167       Tests.endUnit.apply(Tests, setup_args);
   168       if (__testLog__.childNodes.length > 0)
   169         log.appendChild(__testLog__);
   170     } catch(e) {
   171       testFailed("endUnit", e.name, formatError(e));
   172       log.appendChild(__testLog__);
   173     }
   174   }
   175   notifyFinishedToHarness(allTestsSuccessful, "finished tests");
   176 }
   178 function doTestNotify(name) {
   179   //try {
   180   //  var xhr = new XMLHttpRequest();
   181   //  xhr.open("GET", "http://localhost:8888/"+name, true);
   182   //  xhr.send(null);
   183   //} catch(e) {}
   184 }
   186 function testFailed(assertName, name) {
   187   var d = document.createElement('div');
   188   var h = document.createElement('h3');
   189   var d1 = document.createElement("span");
   190   h.appendChild(d1);
   191   d1.appendChild(document.createTextNode("FAIL: "));
   192   d1.style.color = "red";
   193   h.appendChild(document.createTextNode(
   194       name==null ? assertName : name + " (in " + assertName + ")"));
   195   d.appendChild(h);
   196   var args = []
   197   for (var i=2; i<arguments.length; i++) {
   198     var a = arguments[i];
   199     var p = document.createElement('p');
   200     p.style.whiteSpace = 'pre';
   201     p.textContent = (a == null) ? "null" :
   202                     (typeof a == 'boolean' || typeof a == 'string') ? a : Object.toSource(a);
   203     args.push(p.textContent);
   204     d.appendChild(p);
   205   }
   206   __testLog__.appendChild(d);
   207   __testSuccess__ = false;
   208   doTestNotify([assertName, name].concat(args).join("--"));
   209 }
   211 function testPassed(assertName, name) {
   212   var d = document.createElement('div');
   213   var h = document.createElement('h3');
   214   var d1 = document.createElement("span");
   215   h.appendChild(d1);
   216   d1.appendChild(document.createTextNode("PASS: "));
   217   d1.style.color = "green";
   218   h.appendChild(document.createTextNode(
   219       name==null ? assertName : name + " (in " + assertName + ")"));
   220   d.appendChild(h);
   221   var args = []
   222   for (var i=2; i<arguments.length; i++) {
   223     var a = arguments[i];
   224     var p = document.createElement('p');
   225     p.style.whiteSpace = 'pre';
   226     p.textContent = (a == null) ? "null" :
   227                     (typeof a == 'boolean' || typeof a == 'string') ? a : Object.toSource(a);
   228     args.push(p.textContent);
   229     d.appendChild(p);
   230   }
   231   __testLog__.appendChild(d);
   232   doTestNotify([assertName, name].concat(args).join("--"));
   233 }
   235 function checkTestSuccess() {
   236   return __testFailCount__ == 0;
   237 }
   239 window.addEventListener('load', function(){
   240   for (var i=0; i<__backlog__.length; i++)
   241     log(__backlog__[i]);
   242 }, false);
   244 function log(msg) {
   245   var p = document.createElement('p');
   246   var a = [];
   247   for (var i=0; i<arguments.length; i++)
   248     a.push(arguments[i]);
   249   p.textContent = a.join(", ");
   250   if (!__testLog__) {
   251     if (document.body)
   252       document.body.appendChild(p);
   253     else
   254       __backlog__.push(msg);
   255   } else {
   256     __testLog__.appendChild(p);
   257   }
   258 }
   260 function printTestStatus(testsRun) {
   261   var status = document.getElementById('test-status');
   262   if (testsRun) {
   263     status.className = checkTestSuccess() ? 'ok' : 'fail';
   264     status.textContent = checkTestSuccess() ? "PASS" : "FAIL";
   265   } else {
   266     status.className = 'fail';
   267     status.textContent = "NO TESTS FOUND";
   268   }
   269 }
   271 function assertFail(name, f) {
   272   if (f == null) { f = name; name = null; }
   273   var r = false;
   274   try { f(); } catch(e) { r=true; }
   275   if (!r) {
   276     testFailed("assertFail", name, f);
   277     return false;
   278   } else {
   279     testPassed("assertFail", name, f);
   280     return true;
   281   }
   282 }
   284 function assertOk(name, f) {
   285   if (f == null) { f = name; name = null; }
   286   var r = false;
   287   var err;
   288   try { f(); r=true; } catch(e) { err = e; }
   289   if (!r) {
   290     testFailed("assertOk", name, f, err.toString());
   291     return false;
   292   } else {
   293     testPassed("assertOk", name, f);
   294     return true;
   295   }
   296 }
   298 function assert(name, v) {
   299   if (v == null) { v = name; name = null; }
   300   if (!v) {
   301     testFailed("assert", name, v);
   302     return false;
   303   } else {
   304     testPassed("assert", name, v);
   305     return true;
   306   }
   307 }
   309 function assertProperty(name, v, p) {
   310   if (p == null) { p = v; v = name; name = p; }
   311   if (v[p] == null) {
   312     testFailed("assertProperty", name);
   313     return false;
   314   } else {
   315     testPassed("assertProperty", name);
   316     return true;
   317   }
   318 }
   320 function compare(a,b) {
   321   if (typeof a == 'number' && typeof b == 'number') {
   322     return a == b;
   323   } else {
   324     return Object.toSource(a) == Object.toSource(b);
   325   }
   326 }
   328 function assertEquals(name, v, p) {
   329   if (p == null) { p = v; v = name; name = null; }
   330   if (!compare(v, p)) {
   331     testFailed("assertEquals", name, v, p);
   332     return false;
   333   } else {
   334     testPassed("assertEquals", name, v, p);
   335     return true;
   336   }
   337 }
   339 function assertArrayEquals(name, v, p) {
   340   if (p == null) { p = v; v = name; name = null; }
   341   if (!v) {
   342     testFailed("assertArrayEquals: first array undefined", name, v, p);
   343     return false;
   344   }
   345   if (!p) {
   346     testFailed("assertArrayEquals: second array undefined", name, v, p);
   347     return false;
   348   }
   349   if (v.length != p.length) {
   350     testFailed("assertArrayEquals", name, v, p);
   351     return false;
   352   }
   353   for (var ii = 0; ii < v.length; ++ii) {
   354     if (v[ii] != p[ii]) {
   355       testFailed("assertArrayEquals", name, v, p);
   356       return false;
   357     }
   358   }
   359   testPassed("assertArrayEquals", name, v, p);
   360   return true;
   361 }
   363 function assertNotEquals(name, v, p) {
   364   if (p == null) { p = v; v = name; name = null; }
   365   if (compare(v, p)) {
   366     testFailed("assertNotEquals", name, v, p)
   367     return false;
   368   } else {
   369     testPassed("assertNotEquals", name, v, p)
   370     return true;
   371   }
   372 }
   374 function time(elementId, f) {
   375     var s = document.getElementById(elementId);
   376     var t0 = new Date().getTime();
   377     f();
   378     var t1 = new Date().getTime();
   379     s.textContent = 'Elapsed: '+(t1-t0)+' ms';
   380 }
   382 function randomFloat () {
   383     // note that in fuzz-testing, this can used as the size of a buffer to allocate.
   384     // so it shouldn't return astronomic values. The maximum value 10000000 is already quite big.
   385     var fac = 1.0;
   386     var r = Math.random();
   387     if (r < 0.25)
   388         fac = 10;
   389     else if (r < 0.4)
   390         fac = 100;
   391     else if (r < 0.5)
   392         fac = 1000;
   393     else if (r < 0.6)
   394         fac = 100000;
   395     else if (r < 0.7)
   396         fac = 10000000;
   397     else if (r < 0.8)
   398         fac = NaN;
   399     return -0.5*fac + Math.random() * fac;
   400 }
   401 function randomFloatFromRange(lo, hi) {
   402   var r = Math.random();
   403   if (r < 0.05)
   404     return lo;
   405   else if (r > 0.95)
   406     return hi;
   407   else
   408     return lo + Math.random()*(hi-lo);
   409 }
   410 function randomInt (sz) {
   411   if (sz != null)
   412     return Math.floor(Math.random()*sz);
   413   else
   414     return Math.floor(randomFloat());
   415 }
   416 function randomIntFromRange(lo, hi) {
   417   return Math.floor(randomFloatFromRange(lo, hi));
   418 }
   419 function randomLength () {
   420     var l = Math.floor(Math.random() * 256);
   421     if (Math.random < 0.5) l = l / 10;
   422     if (Math.random < 0.3) l = l / 10;
   423     return l;
   424 }
   425 function randomSmallIntArray () {
   426     var l = randomLength();
   427     var s = new Array(l);
   428     for (var i=0; i<l; i++)
   429         s[i] = Math.floor(Math.random() * 256)-1;
   430     return s;
   431 }
   432 function randomFloatArray () {
   433     var l = randomLength();
   434     var s = new Array(l);
   435     for (var i=0; i<l; i++)
   436         s[i] = randomFloat();
   437     return s;
   438 }
   439 function randomIntArray () {
   440     var l = randomLength();
   441     var s = new Array(l);
   442     for (var i=0; i<l; i++)
   443         s[i] = randomFloat();
   444     return s;
   445 }
   446 function randomMixedArray () {
   447     var l = randomLength();
   448     var s = new Array(l);
   449     for (var i=0; i<l; i++)
   450         s[i] = randomNonArray();
   451     return s;
   452 }
   453 function randomArray () {
   454     var r = Math.random();
   455     if (r < 0.3)
   456         return randomFloatArray();
   457     else if (r < 0.6)
   458         return randomIntArray();
   459     else if (r < 0.8)
   460         return randomSmallIntArray();
   461     else
   462         return randomMixedArray();
   463 }
   464 function randomString () {
   465     return String.fromCharCode.apply(String, randomSmallIntArray());
   466 }
   467 function randomGLConstant () {
   468     return GLConstants[Math.floor(Math.random() * GLConstants.length)];
   469 }
   471 function randomNonArray() {
   472     var r = Math.random();
   473     if (r < 0.25) {
   474         return randomFloat();
   475     } else if (r < 0.6) {
   476         return randomInt();
   477     } else if (r < 0.7) {
   478         return (r < 0.65);
   479     } else if (r < 0.87) {
   480         return randomString();
   481     } else if (r < 0.98) {
   482         return randomGLConstant();
   483     } else {
   484         return null;
   485     }
   486 }
   488 function generateRandomArg(pos, count) {
   489     if (pos == 0 && Math.random() < 0.5)
   490         return randomGLConstant();
   491     if (pos == count-1 && Math.random() < 0.25)
   492         if (Math.random() < 0.5)
   493             return randomString();
   494         else
   495             return randomArray();
   496     var r = Math.random();
   497     if (r < 0.25) {
   498         return randomFloat();
   499     } else if (r < 0.6) {
   500         return randomInt();
   501     } else if (r < 0.7) {
   502         return (r < 0.65);
   503     } else if (r < 0.77) {
   504         return randomString();
   505     } else if (r < 0.84) {
   506         return randomArray();
   507     } else if (r < 0.98) {
   508         return randomGLConstant();
   509     } else {
   510         return null;
   511     }
   512 }
   515 function generateRandomArgs(count) {
   516     var arr = new Array(count);
   517     for (var i=0; i<count; i++)
   518         arr[i] = generateRandomArg(i, count);
   519     return arr;
   520 }
   522 // qc (arg1gen, arg2gen, ..., predicate)
   523 // qc (randomString, randomInt, randomInt, function(s,i,j){ s.substring(i,j) })
   524 function qc() {
   525 }
   527 GLConstants = [
   528 1,
   529 0x00000100,
   530 0x00000400,
   531 0x00004000,
   532 0x0000,
   533 0x0001,
   534 0x0002,
   535 0x0003,
   536 0x0004,
   537 0x0005,
   538 0x0006,
   539 0,
   540 1,
   541 0x0300,
   542 0x0301,
   543 0x0302,
   544 0x0303,
   545 0x0304,
   546 0x0305,
   547 0x0306,
   548 0x0307,
   549 0x0308,
   550 0x8006,
   551 0x8009,
   552 0x8009,
   553 0x883D,
   554 0x800A,
   555 0x800B,
   556 0x80C8,
   557 0x80C9,
   558 0x80CA,
   559 0x80CB,
   560 0x8001,
   561 0x8002,
   562 0x8003,
   563 0x8004,
   564 0x8005,
   565 0x8892,
   566 0x8893,
   567 0x8894,
   568 0x8895,
   569 0x88E0,
   570 0x88E4,
   571 0x88E8,
   572 0x8764,
   573 0x8765,
   574 0x8626,
   575 0x0404,
   576 0x0405,
   577 0x0408,
   578 0x0DE1,
   579 0x0B44,
   580 0x0BE2,
   581 0x0BD0,
   582 0x0B90,
   583 0x0B71,
   584 0x0C11,
   585 0x8037,
   586 0x809E,
   587 0x80A0,
   588 0,
   589 0x0500,
   590 0x0501,
   591 0x0502,
   592 0x0505,
   593 0x0900,
   594 0x0901,
   595 0x0B21,
   596 0x846D,
   597 0x846E,
   598 0x0B45,
   599 0x0B46,
   600 0x0B70,
   601 0x0B72,
   602 0x0B73,
   603 0x0B74,
   604 0x0B91,
   605 0x0B92,
   606 0x0B94,
   607 0x0B95,
   608 0x0B96,
   609 0x0B97,
   610 0x0B93,
   611 0x0B98,
   612 0x8800,
   613 0x8801,
   614 0x8802,
   615 0x8803,
   616 0x8CA3,
   617 0x8CA4,
   618 0x8CA5,
   619 0x0BA2,
   620 0x0C10,
   621 0x0C22,
   622 0x0C23,
   623 0x0CF5,
   624 0x0D05,
   625 0x0D33,
   626 0x0D3A,
   627 0x0D50,
   628 0x0D52,
   629 0x0D53,
   630 0x0D54,
   631 0x0D55,
   632 0x0D56,
   633 0x0D57,
   634 0x2A00,
   635 0x8038,
   636 0x8069,
   637 0x80A8,
   638 0x80A9,
   639 0x80AA,
   640 0x80AB,
   641 0x86A2,
   642 0x86A3,
   643 0x1100,
   644 0x1101,
   645 0x1102,
   646 0x8192,
   647 0x1400,
   648 0x1401,
   649 0x1402,
   650 0x1403,
   651 0x1404,
   652 0x1405,
   653 0x1406,
   654 0x140C,
   655 0x1902,
   656 0x1906,
   657 0x1907,
   658 0x1908,
   659 0x1909,
   660 0x190A,
   661 0x8033,
   662 0x8034,
   663 0x8363,
   664 0x8B30,
   665 0x8B31,
   666 0x8869,
   667 0x8DFB,
   668 0x8DFC,
   669 0x8B4D,
   670 0x8B4C,
   671 0x8872,
   672 0x8DFD,
   673 0x8B4F,
   674 0x8B80,
   675 0x8B82,
   676 0x8B83,
   677 0x8B85,
   678 0x8B86,
   679 0x8B87,
   680 0x8B89,
   681 0x8B8A,
   682 0x8B8C,
   683 0x8B8D,
   684 0x0200,
   685 0x0201,
   686 0x0202,
   687 0x0203,
   688 0x0204,
   689 0x0205,
   690 0x0206,
   691 0x0207,
   692 0x1E00,
   693 0x1E01,
   694 0x1E02,
   695 0x1E03,
   696 0x150A,
   697 0x8507,
   698 0x8508,
   699 0x1F00,
   700 0x1F01,
   701 0x1F02,
   702 0x1F03,
   703 0x2600,
   704 0x2601,
   705 0x2700,
   706 0x2701,
   707 0x2702,
   708 0x2703,
   709 0x2800,
   710 0x2801,
   711 0x2802,
   712 0x2803,
   713 0x1702,
   714 0x8513,
   715 0x8514,
   716 0x8515,
   717 0x8516,
   718 0x8517,
   719 0x8518,
   720 0x8519,
   721 0x851A,
   722 0x851C,
   723 0x84C0,
   724 0x84C1,
   725 0x84C2,
   726 0x84C3,
   727 0x84C4,
   728 0x84C5,
   729 0x84C6,
   730 0x84C7,
   731 0x84C8,
   732 0x84C9,
   733 0x84CA,
   734 0x84CB,
   735 0x84CC,
   736 0x84CD,
   737 0x84CE,
   738 0x84CF,
   739 0x84D0,
   740 0x84D1,
   741 0x84D2,
   742 0x84D3,
   743 0x84D4,
   744 0x84D5,
   745 0x84D6,
   746 0x84D7,
   747 0x84D8,
   748 0x84D9,
   749 0x84DA,
   750 0x84DB,
   751 0x84DC,
   752 0x84DD,
   753 0x84DE,
   754 0x84DF,
   755 0x84E0,
   756 0x2901,
   757 0x812F,
   758 0x8370,
   759 0x8B50,
   760 0x8B51,
   761 0x8B52,
   762 0x8B53,
   763 0x8B54,
   764 0x8B55,
   765 0x8B56,
   766 0x8B57,
   767 0x8B58,
   768 0x8B59,
   769 0x8B5A,
   770 0x8B5B,
   771 0x8B5C,
   772 0x8B5E,
   773 0x8B60,
   774 0x8622,
   775 0x8623,
   776 0x8624,
   777 0x8625,
   778 0x886A,
   779 0x8645,
   780 0x889F,
   781 0x8B9A,
   782 0x8B9B,
   783 0x8B81,
   784 0x8B84,
   785 0x8B88,
   786 0x8DFA,
   787 0x8DF8,
   788 0x8DF9,
   789 0x8DF0,
   790 0x8DF1,
   791 0x8DF2,
   792 0x8DF3,
   793 0x8DF4,
   794 0x8DF5,
   795 0x8D40,
   796 0x8D41,
   797 0x8056,
   798 0x8057,
   799 0x8D62,
   800 0x81A5,
   801 0x1901,
   802 0x8D48,
   803 0x8D42,
   804 0x8D43,
   805 0x8D44,
   806 0x8D50,
   807 0x8D51,
   808 0x8D52,
   809 0x8D53,
   810 0x8D54,
   811 0x8D55,
   812 0x8CD0,
   813 0x8CD1,
   814 0x8CD2,
   815 0x8CD3,
   816 0x8CE0,
   817 0x8D00,
   818 0x8D20,
   819 0,
   820 0x8CD5,
   821 0x8CD6,
   822 0x8CD7,
   823 0x8CD9,
   824 0x8CDD,
   825 0x8CA6,
   826 0x8CA7,
   827 0x84E8,
   828 0x0506,
   829 0x809D
   830 ];
   832 function reportTestResultsToHarness(success, msg) {
   833   if (window.parent.webglTestHarness) {
   834     window.parent.webglTestHarness.reportResults(success, msg);
   835   }
   836 }
   838 function notifyFinishedToHarness() {
   839   if (window.parent.webglTestHarness) {
   840     window.parent.webglTestHarness.notifyFinished();
   841   }
   842 }
   844 function initTests() {
   845   if (Tests.message != null) {
   846     var h = document.getElementById('test-message');
   847     if (h == null) {
   848       h = document.createElement('p');
   849       h.id = 'test-message';
   850       document.body.insertBefore(h, document.body.firstChild);
   851     }
   852     h.textContent = Tests.message;
   853   }
   854   if (Tests.autorun) {
   855     runTests();
   856   } else {
   857     var h = document.getElementById('test-run');
   858     if (h == null) {
   859       h = document.createElement('input');
   860       h.type = 'submit';
   861       h.value = "Run tests";
   862       h.addEventListener('click', function(ev){
   863         runTests();
   864         ev.preventDefault();
   865       }, false);
   866       h.id = 'test-run';
   867       document.body.insertBefore(h, document.body.firstChild);
   868     }
   869     h.textContent = Tests.message;
   870   }
   872 }
   874 window.addEventListener('load', function(){
   875   // let the browser hopefully finish updating the gl canvas surfaces if we are given a delay
   876   if (Tests.delay)
   877     setTimeout(initTests, Tests.delay);
   878   else
   879     initTests()
   880 }, false);

mercurial