changeset 2908:9c26e579e64d

Test create supports template XMLs. Added ITU-R BS.1116 template.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 01 Aug 2017 09:13:57 +0100
parents a1e294297380
children e2b241c88b74
files test_create.html test_create/interfaces/specifications.json test_create/test_core.js tests/templates/itur1116.xml
diffstat 4 files changed, 72 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/test_create.html	Mon Jul 31 16:15:47 2017 +0100
+++ b/test_create.html	Tue Aug 01 09:13:57 2017 +0100
@@ -1063,7 +1063,7 @@
                     </div>
                     <div class="row">
                         <div class="col-md-6" style="overflow-y: scroll;height: 333px;">
-                            <div class="new-test" ng-repeat="i in testSpecifications.interfaces" ng-mouseover="mouseover(i.name)" ng-click="initialise(i.name)">
+                            <div class="new-test" ng-repeat="i in testSpecifications.interfaces" ng-mouseover="mouseover(i.name)" ng-click="select(i.name)">
                                 <label style="cursor:pointer">
                                     <input type="radio" name="new-test" value="{{i.name}}" id="i.name" style="cursor:pointer" /> {{i.name}}
                                 </label>
--- a/test_create/interfaces/specifications.json	Mon Jul 31 16:15:47 2017 +0100
+++ b/test_create/interfaces/specifications.json	Tue Aug 01 09:13:57 2017 +0100
@@ -13,52 +13,10 @@
             "name": "MUSHRA",
             "interface": "MUSHRA",
             "description": {
-                "en": "Multi-stimulus with hidden reference and anchor. Each fragment is shown on its own vertical slider. One fragment must be labelled as a reference and another labelled as an anchor. One external reference must also be shown."
+                "en": "Multi-stimulus with hidden reference and anchor. Each fragment is shown on its own vertical slider. One fragment must be labelled as a reference and another labelled as an anchor. One external reference must also be shown. ITU-R BS.1116-3"
             },
             "scales": ["ACR"],
-            "checks": [{
-                "name": "fragmentMoved",
-                "support": "none"
-            }, {
-                "name": "fragmentPlayed",
-                "support": "none"
-            }, {
-                "name": "fragmentFullPlayback",
-                "support": "none"
-            }, {
-                "name": "fragmentComments",
-                "support": "none"
-            }, {
-                "name": "scalerange",
-                "support": "none"
-            }],
-            "show": [{
-                "name": "volume",
-                "support": "none"
-            }, {
-                "name": "page-count",
-                "support": "none"
-            }, {
-                "name": "playhead",
-                "support": "none"
-            }, {
-                "name": "comments",
-                "support": "none"
-            }],
-            "elements": [{
-                "anchor": {
-                    "min": 1,
-                    "max": "undefined"
-                },
-                "reference": {
-                    "min": 1,
-                    "max": "undefined"
-                },
-                "outsidereference": {
-                    "min": 1,
-                    "max": "undefined"
-                }
-            }]
+            "template": "./tests/templates/itur1116.xml"
         }, {
             "name": "Vertical Sliders",
             "interface": "MUSHRA",
@@ -83,7 +41,7 @@
             "description": {
                 "en": "Each stimulus is placed on a discrete scale equalling the number of fragments. The fragments are then ranked based on the question posed. Only one element can occupy a rank position"
             }
-        },{
+        }, {
             "name": "Likert",
             "interface": "discrete",
             "description": {
--- a/test_create/test_core.js	Mon Jul 31 16:15:47 2017 +0100
+++ b/test_create/test_core.js	Tue Aug 01 09:13:57 2017 +0100
@@ -153,10 +153,12 @@
 
 AngularInterface.controller("introduction", ['$scope', '$element', '$window', function ($s, $e, $w) {
     $s.state = 0;
+    $s.selected = undefined;
     $s.next = function () {
         $s.state++;
         if ($s.state > 1 || $s.file) {
             $s.hidePopup();
+            $s.initialise($s.selected);
         }
     };
     $s.back = function () {
@@ -177,19 +179,32 @@
         if (obj === undefined) {
             throw ("Cannot find specification");
         }
-        $s.setTestPrototype(obj);
+        if (typeof obj.template === "string") {
+            get(obj.template).then(function (data) {
+                $s.parseFile(data);
+            }, function (err) {})
+        } else {
+            $s.setTestPrototype(obj);
+        }
     };
-    // Get the test interface specifications
+    $s.select = function (name) {
+            $s.selected = name;
+        }
+        // Get the test interface specifications
     $s.file = undefined;
     $s.description = "";
 
+    $s.parseFile = function (f) {
+        var p = new DOMParser();
+        specification.decode(p.parseFromString(f, "text/xml"));
+        $s.$apply();
+    }
+
     $s.handleFiles = function ($event) {
         $s.file = $event.currentTarget.files[0];
         var r = new FileReader();
         r.onload = function () {
-            var p = new DOMParser();
-            specification.decode(p.parseFromString(r.result, "text/xml"));
-            $s.$apply();
+            $s.parseFile(r.result);
         };
         r.readAsText($s.file);
     };
@@ -242,12 +257,14 @@
     $s.$watch("selectedTestPrototype", $s.configure);
 
     $s.placeholder = function (name) {
-        var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
-        var attr = spec.getAttribute("default");
-        if (attr === undefined) {
-            return "";
+        if ($s.schema) {
+            var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
+            var attr = spec.getAttribute("default");
+            if (attr === undefined) {
+                return "";
+            }
+            return attr;
         }
-        return attr;
     }
 }]);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/templates/itur1116.xml	Tue Aug 01 09:13:57 2017 +0100
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+    <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd">
+        <setup interface="MUSHRA" projectReturn="save.php" randomiseOrder="true" loudness="-23">
+            <exitText>Thank you for participating in this listening test. You may now exit the test environment</exitText>
+            <metric>
+                <metricenable>testTimer</metricenable>
+                <metricenable>elementTimer</metricenable>
+                <metricenable>elementInitialPosition</metricenable>
+                <metricenable>elementTracker</metricenable>
+                <metricenable>elementFlagListenedTo</metricenable>
+                <metricenable>elementFlagMoved</metricenable>
+                <metricenable>elementListenTracker</metricenable>
+            </metric>
+            <interface>
+                <interfaceoption type="check" name="fragmentMoved" />
+                <scales>
+                    <scalelabel position="100">Imperceptible</scalelabel>
+                    <scalelabel position="75">Perceptible but not annoying</scalelabel>
+                    <scalelabel position="50">Slightly annoying</scalelabel>
+                    <scalelabel position="25">Annoying</scalelabel>
+                    <scalelabel position="0">Very annoying</scalelabel>
+                </scales>
+            </interface>
+        </setup>
+        <page id="training" randomiseOrder="true" repeatCount="0" loop="true" synchronous="true" position="0">
+            <interface>
+                <title>Quality</title>
+            </interface>
+            <audioelement url="0.wav" id="training-A" type="reference" label="A" position="0" />
+            <audioelement url="1.wav" id="training-1" />
+            <audioelement url="0.wav" id="training-2" />
+        </page>
+        <page id="test-0" randomiseOrder="true" repeatCount="0" loop="true" synchronous="true" position="0">
+            <interface>
+                <title>Quality</title>
+            </interface>
+            <audioelement url="0.wav" id="test-0-A" type="reference" label="A" position="0" />
+            <audioelement url="1.wav" id="test-0-1" />
+            <audioelement url="0.wav" id="test-0-2" />
+        </page>
+    </waet>