aboutsummaryrefslogtreecommitdiff
path: root/tests/notification-fixture.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/notification-fixture.h')
-rw-r--r--tests/notification-fixture.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h
index 2349bab..5aedadc 100644
--- a/tests/notification-fixture.h
+++ b/tests/notification-fixture.h
@@ -1,6 +1,6 @@
/*
* Copyright 2014-2016 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2023 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -77,7 +77,9 @@ protected:
static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"};
- static constexpr char const * HINT_TIMEOUT {"x-lomiri-snap-decisions-timeout"};
+#ifdef LOMIRI_FEATURES_ENABLED
+ static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"};
+#endif
static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"};
static constexpr char const * AS_INTERFACE {"com.lomiri.touch.AccountsService.Sound"};
@@ -312,20 +314,31 @@ protected:
super::TearDown();
}
- void make_interactive()
+ void mock_capabilities(bool mock_lomiri_caps = false)
{
// GetCapabilities returns an array containing 'actions',
- // so our snap decision will be interactive.
- // For this test, it means we should get a timeout Notify Hint
- // that matches duration_minutes
+ // so our notifications will be interactive.
+
+ #ifndef LOMIRI_FEATURES_ENABLED
+ g_assert_false(mock_lomiri_caps);
+ #endif
+
+ std::string python_code =
+ std::string("ret = ['actions', 'body'") +
+ #ifdef LOMIRI_FEATURES_ENABLED
+ (mock_lomiri_caps ? std::string(", '") + HINT_LOMIRI_TIMEOUT + "'" : "") +
+ #endif
+ "]";
+
GError * error = nullptr;
dbus_test_dbus_mock_object_add_method(notify_mock,
notify_obj,
METHOD_GET_CAPS,
nullptr,
G_VARIANT_TYPE_STRING_ARRAY,
- "ret = ['actions', 'body']",
+ python_code.c_str(),
&error);
+
g_assert_no_error (error);
}