diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-09 19:47:50 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-09 19:47:50 +0530 |
| commit | 61f99089288138989cf244d174882aa5088b738b (patch) | |
| tree | ea1202b098b92e85b16e670d1c3ea1b86fcaef58 /spec/testUtils.cpp | |
| parent | 1e2302be2b47fbeb340db7482ed8476c829a7f66 (diff) | |
| download | null-browser-61f99089288138989cf244d174882aa5088b738b.tar.gz null-browser-61f99089288138989cf244d174882aa5088b738b.zip | |
Refactor directory structure
Diffstat (limited to 'spec/testUtils.cpp')
| -rw-r--r-- | spec/testUtils.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/testUtils.cpp b/spec/testUtils.cpp new file mode 100644 index 0000000..e496a9b --- /dev/null +++ b/spec/testUtils.cpp @@ -0,0 +1,20 @@ +#include <QtTest/QtTest> +#include <QtTest/qtestcase.h> +#include <cstdio> + +std::vector<std::function<QObject *()>> &getQTestRegistry() { + static std::vector<std::function<QObject *()>> registry; + return registry; +} + +int runAllTests() { + int exitCode = 0; + for (const auto &runTest : getQTestRegistry()) { + auto test = runTest(); + // printf(":::: %s\n", test->objectName().toStdString().c_str()); + exitCode |= QTest::qExec(test); + delete test; + } + getQTestRegistry().clear(); + return exitCode; +} |
