Przeglądaj źródła

initial commit of validation tests for the viewer

Raanan Weber 7 lat temu
rodzic
commit
9e6f29e698

BIN
Viewer/tests/validation/LogoV3.png


BIN
Viewer/tests/validation/ReferenceImages/basicHelmet.png


+ 16 - 0
Viewer/tests/validation/config.json

@@ -0,0 +1,16 @@
+{
+    "root": "https://viewer.babylonjs.com",
+    "tests": [
+        {
+            "title": "Basic Helmet",
+            "configuration": {
+                "extends": "minimal",
+                "model": {
+                    "title": "Basic Helmet",
+                    "url": "https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf"
+                }
+            },
+            "referenceImage": "basicHelmet.png"
+        }
+    ]
+}

+ 88 - 0
Viewer/tests/validation/index.css

@@ -0,0 +1,88 @@
+html,
+body {
+    width: 100%;
+    height: 100%;
+    padding: 0;
+    margin: 0;
+    background-color: white;
+}
+
+body {
+    background: url("LogoV3.png");
+    background-position: center center;
+    background-repeat: no-repeat;
+}
+
+.container {
+    width: calc(100% - 50px);
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: center;
+    align-items: center;
+    background: rgba(255, 255, 255, 0.6);
+    margin: auto;
+    margin-top: 10px;
+    margin-bottom: 10px;
+    outline: 2px solid black;
+    max-width: 1000px;
+}
+
+.containerTitle {
+    width: 100%;
+    order: 1;
+    display: flex;
+    background-color: rgba(0, 0, 0, 0.8);
+    height: 50px;
+}
+
+.title {
+    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
+    font-size: 40px;
+    color: white;
+    text-align: center;
+    margin-left: 20px;
+    order: 1;
+}
+
+.result {
+    color: green;
+    font-size: 30px;
+    order: 2;
+    text-align: center;
+    margin-top: 5px;
+    margin-left: 20px;
+}
+
+.result.failed {
+    color: red;
+}
+
+.waitRing {
+    order: 3;
+    height: 40px;
+    margin-top: 5px;
+    margin-bottom: 5px;
+}
+
+.waitRing.hidden {
+    display: none;
+}
+
+babylon {
+    position: absolute !important;
+    transform: translateY(600px);
+    width: 600px;
+    height: 400px;
+}
+
+.renderImage {
+    order: 1;
+    flex-basis: 50%;
+    width: 50%;
+}
+
+.resultImage {
+    width: 50%;
+    flex-basis: 50%;
+    order: 2;
+}

+ 55 - 0
Viewer/tests/validation/index.html

@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+
+    <head>
+        <title>BabylonJS - Build validation page</title>
+        <link href="index.css" rel="stylesheet" />
+        <script src="https://preview.babylonjs.com/draco_decoder.js"></script>
+    </head>
+
+    <body>
+        <script>
+            /*BABYLONDEVTOOLS.Loader.require('validation.js')
+                .load(function() {*/
+            // Loading tests
+            var xhr = new XMLHttpRequest();
+
+            xhr.open("GET", "config.json", true);
+
+            xhr.addEventListener("load", function () {
+                if (xhr.status === 200) {
+
+                    config = JSON.parse(xhr.responseText);
+
+                    // Run tests
+                    var index = 0;
+                    if (window.location.search) {
+                        justOnce = true;
+                        var title = window.location.search.replace("?", "").replace(/%20/g, " ");
+                        for (var index = 0; index < config.tests.length; index++) {
+                            if (config.tests[index].title === title) {
+                                break;
+                            }
+                        }
+                    }
+
+                    var recursiveRunTest = function (i) {
+                        runTest(i, function () {
+                            i++;
+                            if (justOnce || i >= config.tests.length) {
+                                return;
+                            }
+                            recursiveRunTest(i);
+                        });
+                    }
+
+                    recursiveRunTest(index);
+                }
+            }, false);
+
+            xhr.send();
+			//});
+        </script>
+    </body>
+
+</html>

BIN
Viewer/tests/validation/loading.gif


+ 60 - 0
Viewer/tests/validation/validate.html

@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<title>BabylonJS - Build validation page</title>
+	<link href="index.css" rel="stylesheet" />
+    <script src="https://preview.babylonjs.com/draco_decoder.js"></script>
+    <script src="https://preview.babylonjs.com/cannon.js"></script>
+    <script src="https://preview.babylonjs.com/Oimo.js"></script>
+    <script src="https://preview.babylonjs.com/babylon.js"></script>
+    <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
+
+    <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
+	<script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
+    <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
+	<script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
+    <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>	
+</head>
+<body>
+	<script src="validation.js"></script>
+	<script>
+		// Loading tests
+		var xhr = new XMLHttpRequest();
+
+		xhr.open("GET", "config.json", true);
+
+		xhr.addEventListener("load", function () {
+			if (xhr.status === 200) {
+
+				config = JSON.parse(xhr.responseText);
+
+				// Run tests
+				var index = 0;
+				if (window.location.search) {
+					justOnce = true;
+					var title = window.location.search.replace("?", "").replace(/%20/g, " ");
+					for (var index = 0; index < config.tests.length; index++) {
+						if (config.tests[index].title === title) {
+							break;
+						}
+					}
+				}
+
+				var recursiveRunTest = function(i) {
+					runTest(i, function() {
+						i++;
+						if (justOnce || i >= config.tests.length) {
+							return;
+						}
+						recursiveRunTest(i);
+					});
+				}
+
+				recursiveRunTest(index);
+			}
+		}, false);
+
+		xhr.send();
+    </script>	
+</body>
+</html>