diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual | 10 | ||||
-rw-r--r-- | tests/manual-test-snap.cpp | 10 | ||||
-rw-r--r-- | tests/test-exporter.cpp | 11 | ||||
-rw-r--r-- | tests/test-settings.cpp | 1 |
4 files changed, 26 insertions, 6 deletions
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 <dd>If the device supports haptic feedback, confirm the alarm vibrates.</dd> </dl> +Test-case indicator-datetime/snooze +<dl> + <dt>Create and save an upcoming alarm in ubuntu-clock-app</dt> + <dt>When the alarm goes off, press the 'Snooze' button</dt> + <dd>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.</dd> + <dt>When the snoozed alarm reappears, press the 'OK' button</dt> + <dd>This time when the alarm is dismissed, it should not reappear.</dd> +</dl> + Test-case indicator-datetime/edited-alarm-wakeup <dl> <dt>Edit an alarm that's already passed. (see previous test)</dt> 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<uin::Engine>("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); 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) |