mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:37:49 +02:00
Add test for update event
This commit is contained in:
parent
acd19f7c40
commit
1e1b96765f
1 changed files with 18 additions and 0 deletions
|
@ -250,7 +250,25 @@ void ScriptEngineTests::testRaiseExceptionAndCatch() {
|
||||||
|
|
||||||
|
|
||||||
void ScriptEngineTests::testSignal() {
|
void ScriptEngineTests::testSignal() {
|
||||||
|
QString script =
|
||||||
|
"var count = 0;"
|
||||||
|
"Script.update.connect(function(deltaTime) {"
|
||||||
|
" count++;"
|
||||||
|
" print(deltaTime);"
|
||||||
|
" if (count >= 10) {"
|
||||||
|
" Script.stop(true);"
|
||||||
|
" }"
|
||||||
|
"});";
|
||||||
|
|
||||||
|
QStringList printed;
|
||||||
|
auto sm = makeManager(script, "testSignal.js");
|
||||||
|
|
||||||
|
connect(sm.get(), &ScriptManager::printedMessage, [&printed](const QString& message, const QString& engineName){
|
||||||
|
printed.append(message);
|
||||||
|
});
|
||||||
|
|
||||||
|
sm->run();
|
||||||
|
QVERIFY(printed.length() >= 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue