aboutsummaryrefslogtreecommitdiff
path: root/tests/test-snap.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-31 17:06:50 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-31 17:06:50 -0500
commit8afa4ba3102138f245fba704eba03b907edefa2b (patch)
treeeb5146377847db4edf2063818c0e962fe325d4dd /tests/test-snap.cpp
parent4148750ea93e67e5d9aaa15ebc8e3c7a5a5554f1 (diff)
downloadayatana-indicator-datetime-8afa4ba3102138f245fba704eba03b907edefa2b.tar.gz
ayatana-indicator-datetime-8afa4ba3102138f245fba704eba03b907edefa2b.tar.bz2
ayatana-indicator-datetime-8afa4ba3102138f245fba704eba03b907edefa2b.zip
configurable haptic mode, part 2 of 3: use the new haptic mode setting when popping up notifications; sync notification tests
Diffstat (limited to 'tests/test-snap.cpp')
-rw-r--r--tests/test-snap.cpp49
1 files changed, 42 insertions, 7 deletions
diff --git a/tests/test-snap.cpp b/tests/test-snap.cpp
index 06e0a80..5afaab1 100644
--- a/tests/test-snap.cpp
+++ b/tests/test-snap.cpp
@@ -416,13 +416,6 @@ TEST_F(SnapFixture, InhibitSleep)
nullptr,
&error));
- // confirm that haptic feedback got called
- EXPECT_TRUE (dbus_test_dbus_mock_object_check_method_call (haptic_mock,
- haptic_obj,
- HAPTIC_METHOD_VIBRATE_PATTERN,
- nullptr,
- &error));
-
// force-close the snap
wait_msec(100);
delete snap;
@@ -485,3 +478,45 @@ TEST_F(SnapFixture, ForceScreen)
&error));
g_assert_no_error(error);
}
+
+/***
+****
+***/
+
+TEST_F(SnapFixture, HapticModes)
+{
+ auto settings = std::make_shared<Settings>();
+ auto ne = std::make_shared<unity::indicator::notifications::Engine>(APP_NAME);
+ auto func = [this](const Appointment&){g_idle_add(quit_idle, loop);};
+ GError * error = nullptr;
+
+ // invoke a snap decision while haptic feedback is set to "pulse",
+ // confirm that VibratePattern got called
+ settings->alarm_haptic.set("pulse");
+ auto snap = new Snap (ne, settings);
+ (*snap)(appt, func, func);
+ wait_msec(100);
+ EXPECT_TRUE (dbus_test_dbus_mock_object_check_method_call (haptic_mock,
+ haptic_obj,
+ HAPTIC_METHOD_VIBRATE_PATTERN,
+ nullptr,
+ &error));
+ delete snap;
+
+ // invoke a snap decision while haptic feedback is set to "none",
+ // confirm that VibratePattern =didn't= get called
+ wait_msec(100);
+ dbus_test_dbus_mock_object_clear_method_calls (haptic_mock, haptic_obj, &error);
+ settings->alarm_haptic.set("none");
+ snap = new Snap (ne, settings);
+ (*snap)(appt, func, func);
+ wait_msec(100);
+ EXPECT_FALSE (dbus_test_dbus_mock_object_check_method_call (haptic_mock,
+ haptic_obj,
+ HAPTIC_METHOD_VIBRATE_PATTERN,
+ nullptr,
+ &error));
+ delete snap;
+
+ g_assert_no_error (error);
+}