From d3732ff1a0d149544f89d08fa489e4f0fca8da07 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 2 Sep 2014 10:37:03 -0500 Subject: add snooze properties to our schema; export it on the bus; add tests --- tests/test-exporter.cpp | 11 ++++++++++- tests/test-settings.cpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test-exporter.cpp b/tests/test-exporter.cpp index 96665cf..ec19ef4 100644 --- a/tests/test-exporter.cpp +++ b/tests/test-exporter.cpp @@ -184,11 +184,13 @@ TEST_F(ExporterFixture, AlarmProperties) ***/ auto expected_volume = 1; - int expected_duration = 60; + int expected_duration = 4; + int expected_snooze_duration = 5; const char * expected_sound = "/tmp/foo.wav"; const char * expected_haptic = "pulse"; settings->alarm_volume.set(expected_volume); settings->alarm_duration.set(expected_duration); + settings->snooze_duration.set(expected_snooze_duration); settings->alarm_sound.set(expected_sound); settings->alarm_haptic.set(expected_haptic); wait_msec(); @@ -197,20 +199,24 @@ TEST_F(ExporterFixture, AlarmProperties) static constexpr const char* const VOLUME_PROP {"default-volume"}; static constexpr const char* const DURATION_PROP {"duration"}; static constexpr const char* const HAPTIC_PROP {"haptic-feedback"}; + static constexpr const char* const SNOOZE_PROP {"snooze-duration"}; char* sound = nullptr; char* haptic = nullptr; int volume = -1; int duration = -1; + int snooze = -1; g_object_get(proxy, SOUND_PROP, &sound, HAPTIC_PROP, &haptic, VOLUME_PROP, &volume, DURATION_PROP, &duration, + SNOOZE_PROP, &snooze, nullptr); EXPECT_STREQ(expected_sound, sound); EXPECT_STREQ(expected_haptic, haptic); EXPECT_EQ(expected_volume, volume); EXPECT_EQ(expected_duration, duration); + EXPECT_EQ(expected_snooze_duration, snooze); g_clear_pointer (&sound, g_free); g_clear_pointer (&haptic, g_free); @@ -223,10 +229,12 @@ TEST_F(ExporterFixture, AlarmProperties) expected_duration = 30; expected_sound = "/tmp/bar.wav"; expected_haptic = "none"; + expected_snooze_duration = 5; g_object_set(proxy, SOUND_PROP, expected_sound, HAPTIC_PROP, expected_haptic, VOLUME_PROP, expected_volume, DURATION_PROP, expected_duration, + SNOOZE_PROP, expected_snooze_duration, nullptr); wait_msec(); @@ -234,6 +242,7 @@ TEST_F(ExporterFixture, AlarmProperties) EXPECT_STREQ(expected_haptic, settings->alarm_haptic.get().c_str()); EXPECT_EQ(expected_volume, settings->alarm_volume.get()); EXPECT_EQ(expected_duration, settings->alarm_duration.get()); + EXPECT_EQ(expected_snooze_duration, settings->snooze_duration.get()); // cleanup g_clear_object(&proxy); diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp index 4fb0a08..5dfb5ae 100644 --- a/tests/test-settings.cpp +++ b/tests/test-settings.cpp @@ -152,6 +152,7 @@ TEST_F(SettingsFixture, UIntProperties) { TestUIntProperty(m_settings->alarm_duration, SETTINGS_ALARM_DURATION_S); TestUIntProperty(m_settings->alarm_volume, SETTINGS_ALARM_VOLUME_S); + TestUIntProperty(m_settings->snooze_duration, SETTINGS_SNOOZE_DURATION_S); } TEST_F(SettingsFixture, StringProperties) -- cgit v1.2.3 From 84a8bb0debeb68d92049ccb8731d4d07aee7e2f9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 2 Sep 2014 23:17:38 -0500 Subject: add manual test for snooze --- tests/manual | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/manual b/tests/manual index c932004..64d59c3 100644 --- a/tests/manual +++ b/tests/manual @@ -33,6 +33,16 @@ Test-case indicator-datetime/new-alarm-wakeup
If the device supports haptic feedback, confirm the alarm vibrates.
+Test-case indicator-datetime/snooze +
+
Create and save an upcoming alarm in ubuntu-clock-app
+
When the alarm goes off, press the 'Snooze' button
+
The alarm should go away, then reappear N minutes later. + By default the N is 5 minutes but will be configurable from ubuntu-clock-app.
+
When the snoozed alarm reappears, press the 'OK' button
+
This time when the alarm is dismissed, it should not reappear.
+
+ Test-case indicator-datetime/edited-alarm-wakeup
Edit an alarm that's already passed. (see previous test)
-- cgit v1.2.3 From 7b42ea114c18dab35129a5c98b196ff173892498 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 2 Sep 2014 23:22:04 -0500 Subject: update manual-test-snap's diagnostic text to reflect snooze/ok buttons --- tests/manual-test-snap.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp index 7d4403d..369e6cd 100644 --- a/tests/manual-test-snap.cpp +++ b/tests/manual-test-snap.cpp @@ -78,12 +78,12 @@ int main(int argc, const char* argv[]) g_date_time_unref(begin); auto loop = g_main_loop_new(nullptr, false); - auto show = [loop](const Appointment& appt){ - g_message("You clicked 'show' for appt url '%s'", appt.url.c_str()); + auto on_snooze = [loop](const Appointment& appt){ + g_message("You clicked 'Snooze' for appt url '%s'", appt.url.c_str()); g_idle_add(quit_idle, loop); }; - auto dismiss = [loop](const Appointment&){ - g_message("You clicked 'dismiss'"); + auto on_ok = [loop](const Appointment&){ + g_message("You clicked 'OK'"); g_idle_add(quit_idle, loop); }; @@ -97,7 +97,7 @@ int main(int argc, const char* argv[]) auto notification_engine = std::make_shared("indicator-datetime-service"); Snap snap (notification_engine, settings); - snap(a, show, dismiss); + snap(a, on_snooze, on_ok); g_main_loop_run(loop); g_main_loop_unref(loop); -- cgit v1.2.3