aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-05-14 12:49:09 -0500
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:37:39 +0200
commit7eee00bc63a561ee1700dcf75bce90b2e4ffb335 (patch)
treee11f36fb8e701e5d9b4b8c199bec07042a4d8494 /tests
parentb8df067a9fa8e5db5fcccc88de5be3071b64b3ec (diff)
downloadayatana-indicator-datetime-7eee00bc63a561ee1700dcf75bce90b2e4ffb335.tar.gz
ayatana-indicator-datetime-7eee00bc63a561ee1700dcf75bce90b2e4ffb335.tar.bz2
ayatana-indicator-datetime-7eee00bc63a561ee1700dcf75bce90b2e4ffb335.zip
in tests/glib-fixture.h, tweaks to the new idle_add() and timeout_add() helpers
Diffstat (limited to 'tests')
-rw-r--r--tests/glib-fixture.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/glib-fixture.h b/tests/glib-fixture.h
index eb2a8c5..840acf2 100644
--- a/tests/glib-fixture.h
+++ b/tests/glib-fixture.h
@@ -17,8 +17,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
-#define INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
+#pragma once
#include <chrono>
#include <functional> // std::function
@@ -198,13 +197,11 @@ class GlibFixture : public ::testing::Test
ASSERT_FALSE(wait_for_name_owned(connection, name, timeout_msec, flags)) << "name: " << name;
}
- GMainLoop * loop;
-
using source_func = std::function<gboolean()>;
- void idle_add(source_func&& func)
+ guint idle_add(source_func&& func)
{
- g_idle_add_full(
+ return g_idle_add_full(
G_PRIORITY_DEFAULT_IDLE,
[](gpointer gf){return (*static_cast<source_func*>(gf))();},
new std::function<gboolean()>(func),
@@ -212,9 +209,9 @@ class GlibFixture : public ::testing::Test
);
}
- void timeout_add(source_func&& func, std::chrono::milliseconds msec)
+ guint timeout_add(source_func&& func, std::chrono::milliseconds msec)
{
- g_timeout_add_full(
+ return g_timeout_add_full(
G_PRIORITY_DEFAULT,
msec.count(),
[](gpointer gf){return (*static_cast<source_func*>(gf))();},
@@ -222,6 +219,7 @@ class GlibFixture : public ::testing::Test
[](gpointer gf){delete static_cast<source_func*>(gf);}
);
}
+
+ GMainLoop* loop {};
};
-#endif /* INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H */