From ea5f8163231a81e4f0769a518db819c8a1fc78f6 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 17 Nov 2021 10:19:43 +0100 Subject: Re-enable haptic using hfd-service fixes https://github.com/AyatanaIndicators/ayatana-indicator-datetime/issues/67 --- tests/manual | 2 +- tests/notification-fixture.h | 10 ++++------ tests/test-notification.cpp | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/manual b/tests/manual index d9e192c..cafc292 100644 --- a/tests/manual +++ b/tests/manual @@ -35,7 +35,7 @@ Test-case ayatana-indicator-datetime/new-alarm-wakeup
Unplug the phone from any USB connection and put it to sleep
Confirm that the alarm sounds on time even if the phone is asleep. (Note: if in doubt about sleep you can see in the syslog whether the device actually suspended or whether the suspend was aborted)
Confirm that the screen comes on when the alarm is triggered.
-
[FIXME: No haptic support right now. Remove this comment after https://github.com/AyatanaIndicators/ayatana-indicator-datetime/issues/67 is resolved] If the device supports haptic feedback, confirm the alarm vibrates.
+
If the device supports haptic feedback, confirm the alarm vibrates.
Test-case ayatana-indicator-datetime/disabled-alarms diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h index acb3e63..2349bab 100644 --- a/tests/notification-fixture.h +++ b/tests/notification-fixture.h @@ -52,7 +52,7 @@ protected: static constexpr char const * NOTIFY_INTERFACE {"org.freedesktop.Notifications"}; static constexpr char const * NOTIFY_PATH {"/org/freedesktop/Notifications"}; - static constexpr char const * HAPTIC_METHOD_VIBRATE_PATTERN {"VibratePattern"}; + static constexpr char const * HAPTIC_METHOD_VIBRATE {"vibrate"}; static constexpr int SCREEN_COOKIE {8675309}; static constexpr char const * SCREEN_METHOD_KEEP_DISPLAY_ON {"keepDisplayOn"}; @@ -279,8 +279,6 @@ protected: g_assert_no_error (error); dbus_test_service_add_task(service, DBUS_TEST_TASK(screen_mock)); - //TODO: Reimplement using hfd-service - /* /// /// Add the haptic mock /// @@ -292,13 +290,13 @@ protected: &error); dbus_test_dbus_mock_object_add_method(haptic_mock, haptic_obj, - HAPTIC_METHOD_VIBRATE_PATTERN, - G_VARIANT_TYPE("(auu)"), + HAPTIC_METHOD_VIBRATE, + G_VARIANT_TYPE("i"), nullptr, "", &error); g_assert_no_error (error); - dbus_test_service_add_task(service, DBUS_TEST_TASK(haptic_mock));*/ + dbus_test_service_add_task(service, DBUS_TEST_TASK(haptic_mock)); startDbusMock(); } diff --git a/tests/test-notification.cpp b/tests/test-notification.cpp index 80eb04c..7dccb96 100644 --- a/tests/test-notification.cpp +++ b/tests/test-notification.cpp @@ -158,9 +158,9 @@ TEST_F(NotificationFixture,Notification) // confirm that the vibration was as expected if (expected_vibrate_called) { - EXPECT_METHOD_CALLED_EVENTUALLY(haptic_mock, haptic_obj, HAPTIC_METHOD_VIBRATE_PATTERN); + EXPECT_METHOD_CALLED_EVENTUALLY(haptic_mock, haptic_obj, HAPTIC_METHOD_VIBRATE); } else { - EXPECT_METHOD_NOT_CALLED_EVENTUALLY(haptic_mock, haptic_obj, HAPTIC_METHOD_VIBRATE_PATTERN); + EXPECT_METHOD_NOT_CALLED_EVENTUALLY(haptic_mock, haptic_obj, HAPTIC_METHOD_VIBRATE); } // confirm that the notification was as expected -- cgit v1.2.3