123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>BabylonJS - Build validation page</title>
- <link href="index.css" rel="stylesheet" />
- <script src="https://preview.babylonjs.com/draco_decoder_gltf.js"></script>
- <script src="https://unpkg.com/earcut@2.1.1/dist/earcut.min.js"></script>
- <script src="../../Tools/DevLoader/BabylonLoader.js"></script>
- </head>
- <body>
- <button id="buttonToggleResult" class="buttonToggleResult">Show only failed tests</button>
- <script>
- let toggle = 0, ebutton = document.getElementById("buttonToggleResult");
- ebutton.onclick = function(event) {
- Array.from(document.getElementsByClassName("container")).forEach((elem) => {
- const result = elem.getAttribute("result");
- elem.style.display = toggle === 0 && result !== "false" ? "none" : "";
- });
- toggle ^= 1;
- if (toggle) {
- ebutton.innerHTML = "Show all tests";
- } else {
- ebutton.innerHTML = "Show only failed tests";
- }
- };
- function QueryString() {
- const idx = window.location.search.indexOf('?');
- if (idx < 0) {
- return {};
- }
- const queryString = {},
- query = window.location.search.substring(idx + 1),
- vars = query.split("&");
- for (let i = 0; i < vars.length; i++) {
- const pair = vars[i].split("=");
- const name = decodeURIComponent(pair[0]);
- const val = pair.length > 1 ? decodeURIComponent(pair[1]) : null;
- if (val === null) {
- queryString["test"] = name;
- } else if (queryString[name] === undefined) {
- queryString[name] = val;
- } else if (typeof queryString[name] === "string") {
- queryString[name] = [ queryString[name], val ];
- } else {
- queryString[name].push(val);
- }
- }
- return queryString;
- }
- BABYLONDEVTOOLS.Loader.require('validation.js')
- .load(function() {
- // Loading tests
- var xhr = new XMLHttpRequest();
- var qs = QueryString();
- xhr.open("GET", qs.list ? qs.list + ".json" : "config.json", true);
- xhr.addEventListener("load", async function() {
- if (xhr.status === 200) {
- config = JSON.parse(xhr.responseText);
- // Run tests
- var index = 0;
- if (qs.test) {
- justOnce = true;
- for (var index = 0; index < config.tests.length; index++) {
- if (config.tests[index].title === qs.test) {
- break;
- }
- }
- }
- if (qs.fromtest) {
- for (var index = 0; index < config.tests.length; index++) {
- if (config.tests[index].title === qs.fromtest) {
- break;
- }
- }
- }
- await init(qs.engine || "webgl2");
- var recursiveRunTest = function(i) {
- runTest(i, function() {
- i++;
- if (justOnce || i >= config.tests.length) {
- showResultSummary();
- return;
- }
- recursiveRunTest(i);
- }, qs.list !== "config" && qs.list || "");
- }
- recursiveRunTest(index);
- }
- }, false);
- xhr.send();
- });
- </script>
- </body>
- </html>
|