diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-04-02 20:49:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-04-02 20:49:49 +0530 |
| commit | 96727d6e63ca927f3c7b68d4baa4fe672a4dcd0b (patch) | |
| tree | 2e5b99bb3324a35a0bd9ecdaa2caefcf9260767a /spec/testUtils.cpp | |
| parent | 4f945367ebc8e34263acbfca0416e3f75653924e (diff) | |
| download | null-browser-96727d6e63ca927f3c7b68d4baa4fe672a4dcd0b.tar.gz null-browser-96727d6e63ca927f3c7b68d4baa4fe672a4dcd0b.zip | |
Add events system for lua runtime to dispatch and register events
Diffstat (limited to 'spec/testUtils.cpp')
| -rw-r--r-- | spec/testUtils.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/testUtils.cpp b/spec/testUtils.cpp index cea7a3d..8f348bd 100644 --- a/spec/testUtils.cpp +++ b/spec/testUtils.cpp @@ -1,3 +1,4 @@ +#include "LuaRuntime.hpp" #include <QtTest/QtTest> #include <QtTest/qtestcase.h> #include <cstdio> @@ -22,3 +23,14 @@ int run_all_tests() { get_qtest_registry().clear(); return exit_code; } + +bool wait_for_lua_to_be_true(QString lua_code) { + return QTest::qWaitFor([&lua_code]() { + auto &lua = LuaRuntime::instance(); + QSignalSpy evaluation_completed_spy(&lua, + &LuaRuntime::evaluation_completed); + lua.evaluate(lua_code); + evaluation_completed_spy.wait(); + return evaluation_completed_spy.first().first().toBool(); + }); +} |
