OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 |
| 3 /* |
| 4 ** Copyright (c) 2012 The Khronos Group Inc. |
| 5 ** |
| 6 ** Permission is hereby granted, free of charge, to any person obtaining a |
| 7 ** copy of this software and/or associated documentation files (the |
| 8 ** "Materials"), to deal in the Materials without restriction, including |
| 9 ** without limitation the rights to use, copy, modify, merge, publish, |
| 10 ** distribute, sublicense, and/or sell copies of the Materials, and to |
| 11 ** permit persons to whom the Materials are furnished to do so, subject to |
| 12 ** the following conditions: |
| 13 ** |
| 14 ** The above copyright notice and this permission notice shall be included |
| 15 ** in all copies or substantial portions of the Materials. |
| 16 ** |
| 17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 24 */ |
| 25 |
| 26 --> |
| 27 <!DOCTYPE html> |
| 28 <html> |
| 29 <head> |
| 30 <meta charset="utf-8"> |
| 31 <title>WebGL Conformance Tests</title> |
| 32 <style> |
| 33 html, body { |
| 34 border: 0; |
| 35 margin: 0; |
| 36 height: 100%; |
| 37 height: 100%; |
| 38 text-align: center; |
| 39 font-family: monospace; |
| 40 } |
| 41 table { |
| 42 width: 100%; |
| 43 height: 100%; |
| 44 } |
| 45 .timeout { } |
| 46 .success { } |
| 47 .fail { } |
| 48 .testpage { border: 1px solid black; background-color: #ccc; } |
| 49 .testpagesuccess { border: 1px solid black; background-color: #8F8; } |
| 50 .testpagefail { border: 1px solid black; background-color: #F88; } |
| 51 .testpagetimeout { border: 1px solid black; background-color: #FC8; } |
| 52 .nowebgl { font-weight: bold; color: red; } |
| 53 #error-wrap { |
| 54 float: left; |
| 55 position: relative; |
| 56 left: 50%; |
| 57 } |
| 58 #error { |
| 59 color: red; |
| 60 float: left; |
| 61 position: relative; |
| 62 left: -50%; |
| 63 text-align: left; |
| 64 } |
| 65 ul { |
| 66 list-style: none; |
| 67 padding-left: 1em; |
| 68 } |
| 69 </style> |
| 70 <script type="text/javascript" src="resources/webgl-test-harness.js"></script> |
| 71 <script> |
| 72 var CONFORMANCE_TEST_VERSION = "1.0.2 (beta)"; |
| 73 |
| 74 var OPTIONS = { |
| 75 version: CONFORMANCE_TEST_VERSION |
| 76 }; |
| 77 |
| 78 function start() { |
| 79 |
| 80 function log(msg) { |
| 81 if (window.console && window.console.log) { |
| 82 window.console.log(msg); |
| 83 } |
| 84 } |
| 85 |
| 86 function create3DContext(canvas) |
| 87 { |
| 88 if (!canvas) { |
| 89 canvas = document.createElement("canvas"); |
| 90 } |
| 91 var context = null; |
| 92 var names = ["webgl", "experimental-webgl"]; |
| 93 for (var i = 0; i < names.length; ++i) { |
| 94 try { |
| 95 context = canvas.getContext(names[i]); |
| 96 } catch (e) { |
| 97 } |
| 98 if (context) { |
| 99 break; |
| 100 } |
| 101 } |
| 102 return context; |
| 103 } |
| 104 |
| 105 var reportType = WebGLTestHarnessModule.TestHarness.reportType; |
| 106 |
| 107 var Page = function(reporter, folder, testIndex, url) { |
| 108 this.reporter = reporter; |
| 109 this.folder = folder; |
| 110 this.url = url; |
| 111 this.totalTests = 0; |
| 112 this.totalSuccessful = 0; |
| 113 this.totalTimeouts = 0; |
| 114 this.testIndex = testIndex; |
| 115 |
| 116 var li = reporter.localDoc.createElement('li'); |
| 117 var div = reporter.localDoc.createElement('div'); |
| 118 var check = reporter.localDoc.createElement('input'); |
| 119 check.type = 'checkbox'; |
| 120 check.checked = true; |
| 121 div.appendChild(check); |
| 122 var button = reporter.localDoc.createElement('input'); |
| 123 button.type = 'button'; |
| 124 button.value = 'run'; |
| 125 button.onclick = function() { |
| 126 reporter.runTest(url); |
| 127 }; |
| 128 if (reporter.noWebGL) { |
| 129 button.disabled = true; |
| 130 } |
| 131 div.appendChild(button); |
| 132 var a = reporter.localDoc.createElement('a'); |
| 133 a.href = url; |
| 134 a.target = "_blank"; |
| 135 var node = reporter.localDoc.createTextNode(url); |
| 136 a.appendChild(node); |
| 137 div.appendChild(a); |
| 138 li.setAttribute('class', 'testpage'); |
| 139 li.appendChild(div); |
| 140 var ul = reporter.localDoc.createElement('ul'); |
| 141 var node = reporter.localDoc.createTextNode(''); |
| 142 li.appendChild(ul); |
| 143 div.appendChild(node); |
| 144 this.totalsElem = node; |
| 145 this.resultElem = ul; |
| 146 this.elem = li; |
| 147 this.check = check; |
| 148 }; |
| 149 |
| 150 Page.prototype.addResult = function(msg, success) { |
| 151 ++this.totalTests; |
| 152 if (success === undefined) { |
| 153 ++this.totalTimeouts; |
| 154 var result = "timeout"; |
| 155 var css = "timeout"; |
| 156 } else if (success) { |
| 157 ++this.totalSuccessful; |
| 158 var result = "success"; |
| 159 var css = "success"; |
| 160 // don't report success. |
| 161 return; |
| 162 } else { |
| 163 var result = "failed"; |
| 164 var css = "fail"; |
| 165 } |
| 166 |
| 167 var node = this.reporter.localDoc.createTextNode(result + ': ' + msg); |
| 168 var li = this.reporter.localDoc.createElement('li'); |
| 169 li.appendChild(node); |
| 170 li.setAttribute('class', css); |
| 171 this.resultElem.appendChild(li); |
| 172 }; |
| 173 |
| 174 Page.prototype.startPage = function() { |
| 175 this.totalTests = 0; |
| 176 this.totalSuccessful = 0; |
| 177 this.totalTimeouts = 0; |
| 178 // remove previous results. |
| 179 while (this.resultElem.hasChildNodes()) { |
| 180 this.resultElem.removeChild(this.resultElem.childNodes[0]); |
| 181 } |
| 182 this.totalsElem.textContent = ''; |
| 183 return this.check.checked && this.folder.checked(); |
| 184 }; |
| 185 |
| 186 Page.prototype.firstTestIndex = function() { |
| 187 return this.testIndex; |
| 188 }; |
| 189 |
| 190 Page.prototype.finishPage = function(success) { |
| 191 var msg = ' (' + this.totalSuccessful + ' of ' + |
| 192 this.totalTests + ' passed)'; |
| 193 if (success === undefined) { |
| 194 var css = 'testpagetimeout'; |
| 195 msg = '(*timeout*)'; |
| 196 ++this.totalTests; |
| 197 ++this.totalTimeouts; |
| 198 } else if (this.totalSuccessful != this.totalTests) { |
| 199 var css = 'testpagefail'; |
| 200 } else { |
| 201 var css = 'testpagesuccess'; |
| 202 } |
| 203 this.elem.setAttribute('class', css); |
| 204 this.totalsElem.textContent = msg; |
| 205 }; |
| 206 |
| 207 Page.prototype.enableTest = function(re) { |
| 208 if (this.url.match(re)) { |
| 209 this.check.checked = true; |
| 210 this.folder.enableUp_(); |
| 211 } |
| 212 }; |
| 213 |
| 214 Page.prototype.disableTest = function(re) { |
| 215 if (this.url.match(re)) { |
| 216 this.check.checked = false; |
| 217 } |
| 218 }; |
| 219 |
| 220 var Folder = function(reporter, folder, depth, opt_name) { |
| 221 this.reporter = reporter; |
| 222 this.depth = depth; |
| 223 this.name = opt_name || ""; |
| 224 this.subFolders = {}; |
| 225 this.pages = []; |
| 226 this.items = []; |
| 227 this.folder = folder; |
| 228 var that = this; |
| 229 |
| 230 var doc = reporter.localDoc; |
| 231 var li = doc.createElement('li'); |
| 232 var div = doc.createElement('div'); |
| 233 var check = doc.createElement('input'); |
| 234 check.type = 'checkbox'; |
| 235 check.checked = true; |
| 236 div.appendChild(check); |
| 237 var button = doc.createElement('input'); |
| 238 button.type = 'button'; |
| 239 button.value = 'run'; |
| 240 button.onclick = function() { |
| 241 that.run(); |
| 242 }; |
| 243 if (reporter.noWebGL) { |
| 244 button.disabled = true; |
| 245 } |
| 246 div.appendChild(button); |
| 247 var h = doc.createElement('span'); |
| 248 h.appendChild(doc.createTextNode(this.name)); |
| 249 div.appendChild(h); |
| 250 var ul = doc.createElement('ul'); |
| 251 li.appendChild(div); |
| 252 li.appendChild(ul); |
| 253 this.childUL = ul; |
| 254 this.elem = li; |
| 255 this.check = check; |
| 256 }; |
| 257 |
| 258 Folder.prototype.checked = function() { |
| 259 return this.check.checked && |
| 260 (this.folder ? this.folder.checked() : true); |
| 261 }; |
| 262 |
| 263 Folder.prototype.firstTestIndex = function() { |
| 264 return this.items[0].firstTestIndex(); |
| 265 }; |
| 266 |
| 267 Folder.prototype.numChildren = function() { |
| 268 var numChildren = 0; |
| 269 for (var name in this.subFolders) { |
| 270 numChildren += this.subFolders[name].numChildren(); |
| 271 } |
| 272 return numChildren + this.pages.length; |
| 273 }; |
| 274 |
| 275 Folder.prototype.run = function() { |
| 276 var firstTestIndex = this.firstTestIndex(); |
| 277 var count = this.numChildren(); |
| 278 log("run tests: " + firstTestIndex + " to " + (firstTestIndex + count - 1)) |
| 279 testHarness.runTests(firstTestIndex, count); |
| 280 }; |
| 281 |
| 282 Folder.prototype.getSubFolder = function(name) { |
| 283 var subFolder = this.subFolders[name]; |
| 284 if (subFolder === undefined) { |
| 285 subFolder = new Folder(this.reporter, this, this.depth + 1, name); |
| 286 this.subFolders[name] = subFolder; |
| 287 this.items.push(subFolder); |
| 288 this.childUL.appendChild(subFolder.elem); |
| 289 } |
| 290 return subFolder; |
| 291 }; |
| 292 |
| 293 Folder.prototype.getOrCreateFolder = function(url) { |
| 294 var parts = url.split('/'); |
| 295 var folder = this; |
| 296 for (var pp = 0; pp < parts.length - 1; ++pp) { |
| 297 folder = folder.getSubFolder(parts[pp]); |
| 298 } |
| 299 return folder; |
| 300 }; |
| 301 |
| 302 Folder.prototype.addPage = function(page) { |
| 303 this.pages.push(page); |
| 304 this.items.push(page); |
| 305 this.childUL.appendChild(page.elem); |
| 306 }; |
| 307 |
| 308 Folder.prototype.disableTest = function(re, opt_forceRecurse) { |
| 309 var recurse = true; |
| 310 if (this.name.match(re)) { |
| 311 this.check.checked = false; |
| 312 recurse = opt_forceRecurse; |
| 313 } |
| 314 if (recurse) { |
| 315 for (var name in this.subFolders) { |
| 316 this.subFolders[name].disableTest(re, opt_forceRecurse); |
| 317 } |
| 318 for (var ii = 0; ii < this.pages.length; ++ii) { |
| 319 this.pages[ii].disableTest(re); |
| 320 } |
| 321 } |
| 322 }; |
| 323 |
| 324 Folder.prototype.enableUp_ = function() { |
| 325 this.check.checked = true; |
| 326 var parent = this.folder; |
| 327 if (parent) { |
| 328 parent.enableUp_(); |
| 329 } |
| 330 } |
| 331 |
| 332 Folder.prototype.enableTest = function(re) { |
| 333 if (this.name.match(re)) { |
| 334 this.enableUp_(); |
| 335 } |
| 336 for (var name in this.subFolders) { |
| 337 this.subFolders[name].enableTest(re); |
| 338 } |
| 339 for (var ii = 0; ii < this.pages.length; ++ii) { |
| 340 this.pages[ii].enableTest(re); |
| 341 } |
| 342 }; |
| 343 |
| 344 var Reporter = function() { |
| 345 this.localDoc = document; |
| 346 this.resultElem = document.getElementById("results"); |
| 347 this.fullResultsElem = document.getElementById("fullresults"); |
| 348 var node = this.localDoc.createTextNode(''); |
| 349 this.fullResultsElem.appendChild(node); |
| 350 this.fullResultsNode = node; |
| 351 this.iframe = document.getElementById("testframe"); |
| 352 this.currentPageElem = null; |
| 353 this.totalPages = 0; |
| 354 this.pagesByURL = {}; |
| 355 var canvas = document.getElementById("webglcheck"); |
| 356 var ctx = create3DContext(canvas); |
| 357 this.noWebGL = !ctx; |
| 358 this.contextInfo = {}; |
| 359 this.root = new Folder(this, null, 0, "all"); |
| 360 this.resultElem.appendChild(this.root.elem); |
| 361 this.callbacks = { }; |
| 362 |
| 363 if (ctx) { |
| 364 this.contextInfo["VENDOR"] = ctx.getParameter(ctx.VENDOR); |
| 365 this.contextInfo["VERSION"] = ctx.getParameter(ctx.VERSION); |
| 366 this.contextInfo["RENDERER"] = ctx.getParameter(ctx.RENDERER); |
| 367 this.contextInfo["RED_BITS"] = ctx.getParameter(ctx.RED_BITS); |
| 368 this.contextInfo["GREEN_BITS"] = ctx.getParameter(ctx.GREEN_BITS); |
| 369 this.contextInfo["BLUE_BITS"] = ctx.getParameter(ctx.BLUE_BITS); |
| 370 this.contextInfo["ALPHA_BITS"] = ctx.getParameter(ctx.ALPHA_BITS); |
| 371 this.contextInfo["DEPTH_BITS"] = ctx.getParameter(ctx.DEPTH_BITS); |
| 372 this.contextInfo["STENCIL_BITS"] = ctx.getParameter(ctx.STENCIL_BITS); |
| 373 |
| 374 var ext = ctx.getExtension("WEBGL_debug_renderer_info"); |
| 375 if (ext) { |
| 376 this.contextInfo["UNMASKED_VENDOR"] = ctx.getParameter(ext.UNMASKED_VEND
OR_WEBGL); |
| 377 this.contextInfo["UNMASKED_RENDERER"] = ctx.getParameter(ext.UNMASKED_RE
NDERER_WEBGL); |
| 378 } |
| 379 } |
| 380 }; |
| 381 |
| 382 Reporter.prototype.enableTest = function(name) { |
| 383 this.root.enableTest(name); |
| 384 }; |
| 385 |
| 386 Reporter.prototype.disableTest = function(name) { |
| 387 this.root.disableTest(name); |
| 388 }; |
| 389 |
| 390 Reporter.prototype.disableAllTests = function() { |
| 391 this.root.disableTest(".*", true); |
| 392 }; |
| 393 |
| 394 Reporter.prototype.addEventListener = function(type, func) { |
| 395 if (!this.callbacks[type]) { |
| 396 this.callbacks[type] = []; |
| 397 } |
| 398 this.callbacks[type].push(func); |
| 399 }; |
| 400 |
| 401 Reporter.prototype.executeListenerEvents_ = function(type) { |
| 402 var callbacks = this.callbacks[type].slice(0); |
| 403 for (var ii = 0; ii < callbacks.length; ++ii) { |
| 404 setTimeout(callbacks[ii], 0); |
| 405 } |
| 406 }; |
| 407 |
| 408 Reporter.prototype.runTest = function(url) { |
| 409 var page = this.pagesByURL[url]; |
| 410 page.startPage(); |
| 411 this.currentPage = page; |
| 412 this.iframe.src = url; |
| 413 }; |
| 414 |
| 415 Reporter.prototype.getFolder = function(url) { |
| 416 return this.root.getOrCreateFolder(url); |
| 417 }; |
| 418 |
| 419 Reporter.prototype.addPage = function(url) { |
| 420 var folder = this.getFolder(url); |
| 421 var page = new Page(this, folder, this.totalPages, url); |
| 422 folder.addPage(page); |
| 423 ++this.totalPages; |
| 424 this.pagesByURL[url] = page; |
| 425 }; |
| 426 |
| 427 Reporter.prototype.startPage = function(url) { |
| 428 var page = this.pagesByURL[url]; |
| 429 this.currentPage = page; |
| 430 return page.startPage(); |
| 431 }; |
| 432 |
| 433 Reporter.prototype.addResult = function(msg, success) { |
| 434 if (this.currentPage != null) { |
| 435 this.currentPage.addResult(msg, success); |
| 436 } |
| 437 }; |
| 438 |
| 439 Reporter.prototype.finishPage = function(success) { |
| 440 if (this.currentPage != null) { |
| 441 this.currentPage.finishPage(success); |
| 442 this.currentPage = null; |
| 443 } |
| 444 }; |
| 445 |
| 446 Reporter.prototype.displayFinalResults = function(msg, success) { |
| 447 if (success) { |
| 448 var totalTests = 0; |
| 449 var totalSuccessful = 0; |
| 450 var totalTimeouts = 0; |
| 451 for (var url in this.pagesByURL) { |
| 452 var page = this.pagesByURL[url]; |
| 453 totalTests += page.totalTests; |
| 454 totalSuccessful += page.totalSuccessful; |
| 455 totalTimeouts += page.totalTimeouts; |
| 456 } |
| 457 var timeout = ''; |
| 458 if (totalTimeouts > 0) { |
| 459 timeout = ', ' + totalTimeouts + ' timed out'; |
| 460 } |
| 461 var msg = ' (' + totalSuccessful + ' of ' + |
| 462 totalTests + ' passed' + timeout + ')'; |
| 463 this.fullResultsNode.textContent = msg; |
| 464 |
| 465 // generate a text summary |
| 466 var tx = ""; |
| 467 tx += "WebGL Conformance Test Results\n"; |
| 468 tx += "Version " + OPTIONS.version + "\n"; |
| 469 tx += "\n"; |
| 470 tx += "-------------------\n\n"; |
| 471 tx += "User Agent: " + (navigator.userAgent ? navigator.userAgent : "(navi
gator.userAgent is null)") + "\n"; |
| 472 tx += "WebGL VENDOR: " + this.contextInfo["VENDOR"] + "\n"; |
| 473 tx += "WebGL VERSION: " + this.contextInfo["VERSION"] + "\n"; |
| 474 tx += "WebGL RENDERER: " + this.contextInfo["RENDERER"] + "\n"; |
| 475 tx += "Unmasked VENDOR: " + this.contextInfo["UNMASKED_VENDOR"] + "\n"; |
| 476 tx += "Unmasked RENDERER: " + this.contextInfo["UNMASKED_RENDERER"] + "\n"
; |
| 477 tx += "WebGL R/G/B/A/Depth/Stencil bits (default config): " + this.context
Info["RED_BITS"] + "/" + this.contextInfo["GREEN_BITS"] + "/" + this.contextInfo
["BLUE_BITS"] + "/" + this.contextInfo["ALPHA_BITS"] + "/" + this.contextInfo["D
EPTH_BITS"] + "/" + this.contextInfo["STENCIL_BITS"] + "\n"; |
| 478 tx += "\n"; |
| 479 tx += "-------------------\n\n"; |
| 480 tx += "Test Summary (" + totalTests + " total tests):\n"; |
| 481 tx += "Tests PASSED: " + totalSuccessful + "\n"; |
| 482 tx += "Tests FAILED: " + (totalTests - totalSuccessful) + "\n"; |
| 483 tx += "Tests TIMED OUT: " + totalTimeouts + "\n"; |
| 484 tx += "\n"; |
| 485 tx += "-------------------\n\n"; |
| 486 if (totalSuccessful < totalTests) { |
| 487 tx += "Failures:\n\n"; |
| 488 for (var url in this.pagesByURL) { |
| 489 var page = this.pagesByURL[url]; |
| 490 var pageTotalFail = page.totalTests - page.totalSuccessful; |
| 491 if (!(page.totalTests == 0 && page.totalTimeouts == 0) && |
| 492 pageTotalFail > 0) |
| 493 { |
| 494 tx += url + ": " + pageTotalFail + " tests failed"; |
| 495 if (page.totalTimeouts) |
| 496 tx += " (" + page.totalTimeouts + " timed out)"; |
| 497 tx += "\n"; |
| 498 } |
| 499 } |
| 500 } else { |
| 501 tx += "All tests PASSED\n\n"; |
| 502 } |
| 503 tx += "\n"; |
| 504 tx += "-------------------\n\n"; |
| 505 tx += "Complete Test Results (total / pass / fail / timeout):\n\n"; |
| 506 for (var url in this.pagesByURL) { |
| 507 var page = this.pagesByURL[url]; |
| 508 var pageTotalFail = page.totalTests - page.totalSuccessful; |
| 509 if (!(page.totalTests == 0 && page.totalTimeouts == 0)) { |
| 510 tx += url + ": " + page.totalTests + " / " + |
| 511 page.totalSuccessful + " / " + pageTotalFail + " / " + page.totalT
imeouts + "\n"; |
| 512 } |
| 513 } |
| 514 tx += "\n"; |
| 515 tx += "-------------------\n\n"; |
| 516 tx += "Generated on: " + (new Date()).toString() + "\n"; |
| 517 |
| 518 var r = document.getElementById("testResultsAsText"); |
| 519 while (r.firstChild) r.removeChild(r.firstChild); |
| 520 r.appendChild(document.createTextNode(tx)); |
| 521 document.getElementById("showTextSummary").style.visibility = "visible"; |
| 522 } else { |
| 523 var e = document.getElementById("error"); |
| 524 e.innerHTML = msg; |
| 525 } |
| 526 }; |
| 527 |
| 528 Reporter.prototype.ready = function() { |
| 529 var loading = document.getElementById("loading"); |
| 530 loading.style.display = "none"; |
| 531 if (!this.noWebGL) { |
| 532 var button = document.getElementById("runTestsButton"); |
| 533 button.disabled = false; |
| 534 this.executeListenerEvents_("ready"); |
| 535 } |
| 536 }; |
| 537 |
| 538 Reporter.prototype.reportFunc = function(type, msg, success) { |
| 539 switch (type) { |
| 540 case reportType.ADD_PAGE: |
| 541 return this.addPage(msg); |
| 542 case reportType.READY: |
| 543 return this.ready(); |
| 544 case reportType.START_PAGE: |
| 545 return this.startPage(msg); |
| 546 case reportType.TEST_RESULT: |
| 547 return this.addResult(msg, success); |
| 548 case reportType.FINISH_PAGE: |
| 549 return this.finishPage(success); |
| 550 case reportType.FINISHED_ALL_TESTS: |
| 551 return this.displayFinalResults(msg, success); |
| 552 default: |
| 553 throw 'unhandled'; |
| 554 break; |
| 555 }; |
| 556 }; |
| 557 |
| 558 var getURLOptions = function(obj) { |
| 559 var s = window.location.href; |
| 560 var q = s.indexOf("?"); |
| 561 var e = s.indexOf("#"); |
| 562 if (e < 0) { |
| 563 e = s.length; |
| 564 } |
| 565 var query = s.substring(q + 1, e); |
| 566 var pairs = query.split("&"); |
| 567 for (var ii = 0; ii < pairs.length; ++ii) { |
| 568 var keyValue = pairs[ii].split("="); |
| 569 var key = keyValue[0]; |
| 570 var value = decodeURIComponent(keyValue[1]); |
| 571 obj[key] = value; |
| 572 } |
| 573 }; |
| 574 |
| 575 getURLOptions(OPTIONS); |
| 576 |
| 577 document.getElementById("testVersion").innerHTML = OPTIONS.version; |
| 578 |
| 579 var reporter = new Reporter(); |
| 580 var iframe = document.getElementById("testframe"); |
| 581 var testHarness = new WebGLTestHarnessModule.TestHarness( |
| 582 iframe, |
| 583 '00_test_list.txt', |
| 584 function(type, msg, success) { |
| 585 return reporter.reportFunc(type, msg, success); |
| 586 }, |
| 587 OPTIONS); |
| 588 reporter.addEventListener("ready", function() { |
| 589 // Set which tests to include. |
| 590 if (OPTIONS.include) { |
| 591 reporter.disableAllTests(); |
| 592 var includes = OPTIONS.include.split(",") |
| 593 for (var ii = 0; ii < includes.length; ++ii) { |
| 594 reporter.enableTest(new RegExp(includes[ii])); |
| 595 } |
| 596 } |
| 597 // Remove tests based on skip=re1,re2 in URL. |
| 598 if (OPTIONS.skip) { |
| 599 var skips = OPTIONS.skip.split(",") |
| 600 for (var ii = 0; ii < skips.length; ++ii) { |
| 601 reporter.disableTest(new RegExp(skips[ii])); |
| 602 } |
| 603 } |
| 604 // Auto run the tests if the run=1 in URL |
| 605 if (OPTIONS.run != undefined && OPTIONS.run != 0) { |
| 606 testHarness.runTests(); |
| 607 } |
| 608 }); |
| 609 window.webglTestHarness = testHarness; |
| 610 var button = document.getElementById("runTestsButton"); |
| 611 button.disabled = true; |
| 612 button.onclick = function() { |
| 613 testHarness.runTests(); |
| 614 }; |
| 615 var textbutton = document.getElementById("showTextSummary"); |
| 616 textbutton.onclick = function() { |
| 617 log("click"); |
| 618 var htmldiv = document.getElementById("testResultsHTML"); |
| 619 var textdiv = document.getElementById("testResultsText"); |
| 620 if (textdiv.style.display == "none") { |
| 621 textdiv.style.display = "block"; |
| 622 htmldiv.style.display = "none"; |
| 623 textbutton.setAttribute("value", "display html summary"); |
| 624 } else { |
| 625 textdiv.style.display = "none"; |
| 626 htmldiv.style.display = "block"; |
| 627 textbutton.setAttribute("value", "display text summary"); |
| 628 } |
| 629 }; |
| 630 if (reporter.noWebGL) { |
| 631 button.disabled = true; |
| 632 var elem = document.getElementById("nowebgl"); |
| 633 elem.style.display = ""; |
| 634 } |
| 635 } |
| 636 </script> |
| 637 </head> |
| 638 <body onload="start()"> |
| 639 <table border="2"> |
| 640 <tr style="height: 300px;"> |
| 641 <td> |
| 642 <table> |
| 643 <tr><td><img src="resources/webgl-logo.png" /><br />WebGL Conformance Test Runne
r<br/>Version <span id="testVersion"></span><br/><input type="button" value="run
tests" id="runTestsButton"/><br/><input type="button" style="visibility: hidden
;" value="display text summary" id="showTextSummary"/> |
| 644 <div id="nowebgl" class="nowebgl" style="display: none;">This browser does not a
ppear to support WebGL</div></td></tr> |
| 645 <tr><td><div id="loading">Loading Tests...</div> |
| 646 <div style="border: 1px">Results: <span id="fullresults"></span></div> |
| 647 <canvas id="webglcheck" style="display: none;"></canvas></td></tr> |
| 648 <tr><td><div id="error-wrap"><pre id="error"></pre></div></td></tr> |
| 649 </table> |
| 650 </td> |
| 651 <td> |
| 652 <iframe id="testframe" scrolling="yes" width="100%" height="100%"></iframe> |
| 653 </td> |
| 654 </tr> |
| 655 <tr> |
| 656 <td colspan="2"> |
| 657 <div style="text-align: left; width: 100%; height: 100%; overflow: auto;"> |
| 658 <div id="testResultsHTML"><ul id="results"></ul></div> |
| 659 <div style="display: none;" id="testResultsText"><pre id="testResultsAsText"></p
re></div> |
| 660 </div> |
| 661 </td> |
| 662 </tr> |
| 663 </table> |
| 664 </body> |
| 665 </html> |
OLD | NEW |