Mercurial > hg > webaudioevaluationtool
changeset 231:b51da1e7547c Dev_main
Added check type 'scalerange' with min max attributes to enforce use of the scale.
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Fri, 19 Jun 2015 16:31:14 +0100 |
parents | ccb62b429a85 |
children | ed0f60b100c0 |
files | ape.js core.js example_eval/project.xml |
diffstat | 3 files changed, 57 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ape.js Thu Jun 18 16:39:40 2015 +0100 +++ b/ape.js Fri Jun 19 16:31:14 2015 +0100 @@ -147,6 +147,38 @@ return state; }; + Interface.prototype.checkScaleRange = function() + { + var audioObjs = audioEngineContext.audioObjects; + var audioHolder = testState.stateMap[testState.stateIndex]; + var interfaces = audioHolder.interfaces; + + var minRanking = audioObjs[0].interfaceDOM.getValue(); + var maxRanking = minRanking; + + var minScale; + var maxScale; + for (var i=0; i<interfaces[0].options.length; i++) + { + if (interfaces[0].options[i].check == "scalerange") { + minScale = interfaces[0].options[i].min; + maxScale = interfaces[0].options[i].max; + } + } + + for (var i=1; i<audioObjs.length; i++){ + var ranking = audioObjs[i].interfaceDOM.getValue(); + if (ranking < minRanking) { minRanking = ranking;} + if (ranking > maxRanking) { maxRanking = ranking;} + } + if (minRanking > minScale || maxRanking < maxScale) { + alert('Please use the full width of the scale'); + return false; + } else { + return true; + } + }; + // Bindings for audioObjects // Create the top div for the Title element @@ -530,9 +562,15 @@ var checkState = interfaceContext.checkAllCommented(); if (checkState == false) {canContinue = false;} break; + case 'scalerange': + // Check the scale is used to its full width outlined by the node + var checkState = interfaceContext.checkScaleRange(); + if (checkState == false) {canContinue = false;} + break; } } + if (!canContinue) {break;} } if (canContinue) {
--- a/core.js Thu Jun 18 16:39:40 2015 +0100 +++ b/core.js Fri Jun 19 16:31:14 2015 +0100 @@ -1246,6 +1246,22 @@ this.type = child.nodeName; if (this.type == 'check') { this.check = child.getAttribute('name'); + if (this.check == 'scalerange') { + this.min = child.getAttribute('min'); + this.max = child.getAttribute('max'); + if (this.min == null) {this.min = 1;} + else if (Number(this.min) > 1 && this.min != null) { + this.min = Number(this.min)/100; + } else { + this.min = Number(this.min); + } + if (this.max == null) {this.max = 0;} + else if (Number(this.max) > 1 && this.max != null) { + this.max = Number(this.max)/100; + } else { + this.max = Number(this.max); + } + } } else if (this.type == 'anchor' || this.type == 'reference') { this.value = Number(child.textContent); } @@ -1345,7 +1361,7 @@ var title = DOM.getElementsByTagName('title'); if (title.length == 0) {this.title = null;} else {this.title = title[0].textContent;} - + this.options = parent.commonInterface.options; var scale = DOM.getElementsByTagName('scale'); this.scale = []; for (var i=0; i<scale.length; i++) {
--- a/example_eval/project.xml Thu Jun 18 16:39:40 2015 +0100 +++ b/example_eval/project.xml Fri Jun 19 16:31:14 2015 +0100 @@ -39,6 +39,7 @@ <check name="fragmentFullPlayback"/> <check name="fragmentMoved"/> <check name="fragmentComments"/>--> + <check name="scalerange" min="25" max="75"/> <anchor>20</anchor> <reference>80</reference> </interface> @@ -92,6 +93,7 @@ <scale position="100">Max</scale> <scale position="50">Middle</scale> <scale position="75">75</scale> + <scalerange min="25" max="75"/> <commentBoxPrefix>Comment on fragment</commentBoxPrefix> </interface> <audioElements url="0.wav" id="0" reference="true"/>