Mercurial > hg > webaudioevaluationtool
comparison ape.js @ 666:2c25ca4d7ec6
Really complete state machine with post test commands
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Fri, 10 Apr 2015 15:21:49 +0100 |
parents | 88a5278b9332 |
children | 2cc25941c433 |
comparison
equal
deleted
inserted
replaced
665:88a5278b9332 | 666:2c25ca4d7ec6 |
---|---|
301 { | 301 { |
302 //Specific test pre-test | 302 //Specific test pre-test |
303 var testId = currentState.substr(11,currentState.length-10); | 303 var testId = currentState.substr(11,currentState.length-10); |
304 var preTest = testXMLSetups.find('PreTest')[testId]; | 304 var preTest = testXMLSetups.find('PreTest')[testId]; |
305 this.value = preTestButtonClick(preTest,this.value); | 305 this.value = preTestButtonClick(preTest,this.value); |
306 } else if (currentState.substr(0,11) == 'testRunPost') | |
307 { | |
308 // Specific test post-test | |
309 var testId = currentState.substr(12,currentState.length-11); | |
310 var preTest = testXMLSetups.find('PostTest')[testId]; | |
311 this.value = preTestButtonClick(preTest,this.value); | |
306 } else if (currentState == 'postTest') | 312 } else if (currentState == 'postTest') |
307 { | 313 { |
308 // At the end of the test, running global post test | 314 // At the end of the test, running global post test |
309 var xmlTree = projectXML.find('setup'); | 315 var xmlTree = projectXML.find('setup'); |
310 var PostTest = xmlTree.find('PostTest')[0]; | 316 var PostTest = xmlTree.find('PostTest')[0]; |
400 } else if (currentState.substr(0,10) == 'testRunPre') | 406 } else if (currentState.substr(0,10) == 'testRunPre') |
401 { | 407 { |
402 // Start the test | 408 // Start the test |
403 var testId = currentState.substr(11,currentState.length-10); | 409 var testId = currentState.substr(11,currentState.length-10); |
404 currentState = 'testRun-'+testId; | 410 currentState = 'testRun-'+testId; |
411 } else if (currentState.substr(0,11) == 'testRunPost') | |
412 { | |
413 testEnded(testId); | |
405 } else if (currentState.substr(0,7) == 'testRun') | 414 } else if (currentState.substr(0,7) == 'testRun') |
406 { | 415 { |
407 var testId = currentState.substr(8,currentState.length-7); | 416 var testId = currentState.substr(8,currentState.length-7); |
408 // Check if we have any post tests to perform | 417 // Check if we have any post tests to perform |
409 var postXML = testXMLSetups.find('PostTest')[testId]; | 418 var postXML = testXMLSetups.find('PostTest')[testId]; |
410 if (postXML.children.length > 0) | 419 if (postXML.children.length > 0) |
411 { | 420 { |
412 console.log('POST TEST') | 421 currentState = 'testRunPost-'+testId; |
413 } | |
414 // else | |
415 | |
416 | |
417 // No post tests, check if we have another test to perform instead | |
418 if (testXMLSetups.length-1 > testId) | |
419 { | |
420 // Yes we have another test to perform | |
421 currentState = 'testRun-'+Number(testId)+1; | |
422 loadTest(testId+1); | |
423 } else { | |
424 console.log('Testing Completed!'); | |
425 currentState = 'postTest'; | |
426 // Check for any post tests | |
427 var xmlSetup = projectXML.find('setup'); | |
428 var postTest = xmlSetup.find('PostTest')[0]; | |
429 showPopup(); | 422 showPopup(); |
430 preTestPopupStart(postTest); | 423 preTestPopupStart(postXML); |
424 } | |
425 else { | |
426 | |
427 | |
428 // No post tests, check if we have another test to perform instead | |
429 testEnded(testId); | |
431 } | 430 } |
432 } | 431 } |
433 console.log(currentState); | 432 console.log(currentState); |
433 } | |
434 | |
435 function testEnded(testId) | |
436 { | |
437 if (testXMLSetups.length-1 > testId) | |
438 { | |
439 // Yes we have another test to perform | |
440 currentState = 'testRun-'+Number(testId)+1; | |
441 loadTest(testId+1); | |
442 } else { | |
443 console.log('Testing Completed!'); | |
444 currentState = 'postTest'; | |
445 // Check for any post tests | |
446 var xmlSetup = projectXML.find('setup'); | |
447 var postTest = xmlSetup.find('PostTest')[0]; | |
448 showPopup(); | |
449 preTestPopupStart(postTest); | |
450 } | |
434 } | 451 } |
435 | 452 |
436 function buttonSubmitClick() | 453 function buttonSubmitClick() |
437 { | 454 { |
438 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options | 455 // This function is called when the submit button is clicked. Will check for any further tests to perform, or any post-test options |