[gnote] Run tests having Glib main loop
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Run tests having Glib main loop
- Date: Sun, 26 Apr 2020 12:40:31 +0000 (UTC)
commit 53359b0dbf1cdc0d03fea4ae4441261595458582
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Apr 26 15:40:12 2020 +0300
Run tests having Glib main loop
src/test/runner.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/test/runner.cpp b/src/test/runner.cpp
index a47355f9..234c3bfa 100644
--- a/src/test/runner.cpp
+++ b/src/test/runner.cpp
@@ -19,6 +19,8 @@
#include <glibmm/init.h>
+#include <glibmm/main.h>
+#include <glibmm/thread.h>
#include <giomm/init.h>
#include <UnitTest++/UnitTest++.h>
@@ -30,6 +32,14 @@ int main(int /*argc*/, char ** /*argv*/)
Glib::init();
Gio::init();
- return UnitTest::RunAllTests();
+ auto main_loop = Glib::MainLoop::create();
+ int ret = 0;
+ auto thread = Glib::Thread::create([&main_loop, &ret]() {
+ ret = UnitTest::RunAllTests();
+ main_loop->quit();
+ });
+ main_loop->run();
+ thread->join();
+ return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]