Author: ygrego Date: 2015-05-04 10:57:53 +0000 (Mon, 04 May 2015) New Revision: 1319 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1319 Log: New methods added : "startAnimationInProgress", "stopAnimationInProgress". New test section added in property "testsObjects": "RecordingTest". A new property called "animation" is initialized in constructor class. Modification of method "updateTestResult" in order to call when that is necessary either method "startAnimationInProgress" or "stopAnimationInProgress". Modified: oipf/js/test/Test.js Modified: oipf/js/test/Test.js =================================================================== --- oipf/js/test/Test.js 2015-05-01 13:57:43 UTC (rev 1318) +++ oipf/js/test/Test.js 2015-05-04 10:57:53 UTC (rev 1319) @@ -525,10 +525,24 @@ label: "Call method 'hasDigestCredentials' with an excessive number of parameters.", method: "testHasDigestCredentialsWithExcessiveParametersNumber" } + ]},{ + name: "RecordingSchedulerTest", + object: new RecordingSchedulerTest(), + timer: 120000, + tests: [ + { + label: "Call method 'setRecord' in order to record current programme.", + method: "testRecordCurrentProgramme" + } ] }], init: function() { + this.animation = { + i: 1, + start: true, + intervalID: 0 + }; }, runAll: function() { @@ -729,21 +743,24 @@ var result = false; var promiseTest = new Promise(function(resolve, reject) { try { - timeout(5000) + timeout(object.timer || 5000) .then(reject.bind(null, "No result returned.")) .then(function() { !result + && self.stopAnimationInProgress(currentTest) && object.afterTest && object.afterTest.bind(object); self.currentResult && self.currentResult.failed++; }); object.beforeTest && object.beforeTest(resolve, reject); object[currentTest["method"]] && object[currentTest["method"]](resolve, reject); + self.startAnimationInProgress(currentTest); } catch (error) { reject(error); } }) .then(function(val) { + self.stopAnimationInProgress(currentTest); result = true; console.groupEnd(currentTest["label"]); var timeEnd = new Date(); @@ -752,6 +769,7 @@ object.afterTest && object.afterTest(); }) .catch(function(val) { + self.stopAnimationInProgress(currentTest); self.currentResult && self.currentResult.failed++; result = true; console.log(val); @@ -774,6 +792,35 @@ document.getElementById(currentTest["method"] + "Result").textContent = message || "Error"; document.getElementById(currentTest["method"] + "Result").style.backgroundColor = "red"; document.getElementById(currentTest["method"] + "Duration").textContent = (timeEnd - timeStart).toFixed(2) + " ms"; + }, + + startAnimationInProgress: function(currentTest) { + var self = this; + + self.animation.intervalID = setInterval(function() { + var currentTestResult = document + .getElementById(currentTest["method"] + "Result"); + + if((self.animation.i%6) == 0) { + currentTestResult.textContent = "*"; + self.animation.i = 1; + } else { + if (self.animation.start) { + currentTestResult.textContent = "*"; + self.animation.start = false; + } else { + currentTestResult.textContent += "*"; + } + console.log("Test in progress"); + self.animation.i++; + } + + }, 500); + }, + + stopAnimationInProgress: function(object, currentTest) { + + clearInterval(this.animation.intervalID); } });
participants (1)
-
ygregoï¼ users.nuiton.org