Showing the changes to tests/script-engine/src/ScriptEngineTests.cpp (1 of 4 files). Show all
Unified · Split
| @@ -12,6 +12,8 @@ · 11 unmodified lines | |||
| 12 | #include "StatTracker.h" | 12 | #include "StatTracker.h" |
| 13 | 13 | ||
| 14 | #include "NodeList.h" | 14 | #include "NodeList.h" |
| 15 | #include "../../../libraries/entities/src/EntityScriptingInterface.h" | ||
| 16 | //#include "../../../libraries/entities/src/EntityScriptingInterface.h" | ||
| 15 | 17 | ||
| 16 | QTEST_MAIN(ScriptEngineTests) | 18 | QTEST_MAIN(ScriptEngineTests) |
| 17 | 19 | ||
| @@ -43,7 +45,7 @@ void ScriptEngineTests::initTestCase() { · 25 unmodified lines | |||
| 43 | DependencyManager::set<ResourceRequestObserver>(); | 45 | DependencyManager::set<ResourceRequestObserver>(); |
| 44 | DependencyManager::set<StatTracker>(); | 46 | DependencyManager::set<StatTracker>(); |
| 45 | DependencyManager::set<ScriptInitializers>(); | 47 | DependencyManager::set<ScriptInitializers>(); |
| 46 | 48 | DependencyManager::set<EntityScriptingInterface>(true); | |
| 47 | 49 | ||
| 48 | QSharedPointer<ScriptEngines> ac = DependencyManager::get<ScriptEngines>(); | 50 | QSharedPointer<ScriptEngines> ac = DependencyManager::get<ScriptEngines>(); |
| 49 | QVERIFY(!ac.isNull()); | 51 | QVERIFY(!ac.isNull()); |
| @@ -75,8 +77,8 @@ void ScriptEngineTests::scriptTest() { · 25 unmodified lines | |||
| 75 | QSharedPointer<ScriptEngines> ac = DependencyManager::get<ScriptEngines>(); | 77 | QSharedPointer<ScriptEngines> ac = DependencyManager::get<ScriptEngines>(); |
| 76 | QVERIFY(!ac.isNull()); | 78 | QVERIFY(!ac.isNull()); |
| 77 | 79 | ||
| 78 | 80 | // TODO: can we execute test scripts in serial way rather than parallel | |
| 79 | QDir testScriptsDir("tests"); | 81 | /*QDir testScriptsDir("tests"); |
| 80 | QStringList testScripts = testScriptsDir.entryList(QStringList() << "*.js", QDir::Files); | 82 | QStringList testScripts = testScriptsDir.entryList(QStringList() << "*.js", QDir::Files); |
| 81 | testScripts.sort(); | 83 | testScripts.sort(); |
| 82 | 84 | ||
| @@ -84,14 +86,15 @@ void ScriptEngineTests::scriptTest() { · 1 unmodified line | |||
| 84 | script = "tests/" + script; | 86 | script = "tests/" + script; |
| 85 | qInfo() << "Running test script: " << script; | 87 | qInfo() << "Running test script: " << script; |
| 86 | ac->loadOneScript(script); | 88 | ac->loadOneScript(script); |
| 87 | } | 89 | }*/ |
| 90 | ac->loadOneScript("tests/script-engine/tests/003_vector_math.js"); | ||
| 88 | 91 | ||
| 89 | qDebug() << ac->getRunning(); | 92 | qDebug() << ac->getRunning(); |
| 90 | 93 | ||
| 91 | 94 | // TODO: if I don't have infinite loop here, it exits before scripts finish. It also reports: QSignalSpy: No such signal: 'scriptCountChanged' | |
| 92 | while (true) { | 95 | for (int n = 0; n > -1; n++) { |
| 93 | QSignalSpy spy(ac.get(), SIGNAL(scriptCountChanged)); | 96 | QSignalSpy spy(ac.get(), SIGNAL(scriptCountChanged)); |
| 94 | spy.wait(3000000); | 97 | spy.wait(1000); |
| 95 | qDebug() << "Signal happened"; | 98 | qDebug() << "Signal happened"; |
| 96 | } | 99 | } |
| 97 | //spy.wait(5000); | 100 | //spy.wait(5000); |