Showing the changes to tests/script-engine/src/ScriptEngineTests.cpp (1 of 11 files). Show all
Unified · Split
| @@ -333,42 +333,3 @@ void ScriptEngineTests::testQuat() { · 332 unmodified lines | |||
| 333 | sm->run(); | 333 | sm->run(); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | |||
| 337 | void ScriptEngineTests::scriptTest() { | ||
| 338 | return; | ||
| 339 | |||
| 340 | QSharedPointer<ScriptEngines> ac = DependencyManager::get<ScriptEngines>(); | ||
| 341 | QVERIFY(!ac.isNull()); | ||
| 342 | |||
| 343 | |||
| 344 | QDir testScriptsDir("tests"); | ||
| 345 | QStringList testScripts = testScriptsDir.entryList(QStringList() << "*.js", QDir::Files); | ||
| 346 | testScripts.sort(); | ||
| 347 | |||
| 348 | for(QString scriptFilename : testScripts) { | ||
| 349 | scriptFilename = "tests/" + scriptFilename; | ||
| 350 | qInfo() << "Running test script: " << scriptFilename; | ||
| 351 | |||
| 352 | QString scriptSource; | ||
| 353 | |||
| 354 | { | ||
| 355 | QFile scriptFile(scriptFilename); | ||
| 356 | scriptFile.open(QIODevice::ReadOnly); | ||
| 357 | QTextStream scriptStream(&scriptFile); | ||
| 358 | scriptSource.append(scriptStream.readAll()); | ||
| 359 | |||
| 360 | // Scripts keep on running until Script.stop() is called. For our tests here, | ||
| 361 | // that's not desirable, so we append an automatic stop at the end of every | ||
| 362 | // script. | ||
| 363 | scriptSource.append("\nScript.stop(true);\n"); | ||
| 364 | } | ||
| 365 | |||
| 366 | |||
| 367 | //qDebug() << "Source: " << scriptSource; | ||
| 368 | |||
| 369 | ScriptManagerPointer sm = makeManager(scriptSource, scriptFilename); | ||
| 370 | sm->run(); | ||
| 371 | } | ||
| 372 | |||
| 373 | //TODO: Add a test for Script.require(JSON) | ||
| 374 | } | ||