aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build.yml3
-rw-r--r--src/actions.cpp14
-rw-r--r--src/engine-eds.cpp22
-rw-r--r--src/exporter.cpp10
-rw-r--r--src/haptic.cpp2
-rw-r--r--src/locations-settings.cpp16
-rw-r--r--src/menu.cpp16
-rw-r--r--src/notifications.cpp2
-rw-r--r--src/planner-aggregate.cpp4
-rw-r--r--src/wakeup-timer-mainloop.cpp4
-rw-r--r--src/wakeup-timer-powerd.cpp4
-rw-r--r--tests/print-to.h89
-rw-r--r--tests/test-actions.cpp4
-rw-r--r--tests/test-alarm-queue.cpp6
-rw-r--r--tests/test-dbus-fixture.h6
-rw-r--r--tests/test-eds-ics-all-day-events.cpp1
-rw-r--r--tests/test-eds-ics-missing-trigger.cpp1
-rw-r--r--tests/test-eds-ics-non-attending-alarms.cpp3
-rw-r--r--tests/test-eds-ics-nonrepeating-events.cpp1
-rw-r--r--tests/test-eds-ics-repeating-events-with-individual-change.cpp3
-rw-r--r--tests/test-eds-ics-repeating-events.cpp1
-rw-r--r--tests/test-eds-ics-repeating-valarms.cpp1
-rw-r--r--tests/test-eds-ics-tzids-2.cpp1
-rw-r--r--tests/test-eds-ics-tzids-utc.cpp3
-rw-r--r--tests/test-eds-ics-tzids.cpp1
-rw-r--r--tests/test-formatter.cpp6
-rw-r--r--tests/test-menu-appointments.cpp67
-rw-r--r--tests/test-menus.cpp4
28 files changed, 76 insertions, 219 deletions
diff --git a/.build.yml b/.build.yml
index 5d776ad..220f078 100644
--- a/.build.yml
+++ b/.build.yml
@@ -227,8 +227,7 @@ before_scripts:
build_scripts:
- if [ ${DISTRO_NAME} == "debian" ];then
- export CFLAGS+=" -Wsign-compare -Wunused-parameter"
-# FIXME: uninitMemberVar can perhaps be fixed in the source and dropped here
- - cppcheck --enable=warning,style,performance,portability,information --suppress=uninitMemberVar --suppress=missingInclude .
+ - cppcheck --enable=warning,style,performance,portability,information --suppress=missingInclude .
- fi
-
- if [ -e ./CMakeLists.txt ]; then
diff --git a/src/actions.cpp b/src/actions.cpp
index 315340a..c184aef 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,11 +16,12 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/actions.h>
#include <datetime/utils.h> // split_settings_location()
-
+#include <algorithm>
#include <glib.h>
#include <gio/gio.h>
@@ -50,16 +52,18 @@ DateTime datetime_from_timet_variant(GVariant* v)
bool lookup_appointment_by_uid(const std::shared_ptr<State>& state, const gchar* uid, Appointment& setme)
{
- for(const auto& appt : state->calendar_upcoming->appointments().get())
+ bool bRet = false;
+
+ std::for_each(state->calendar_upcoming->appointments().get().begin(), state->calendar_upcoming->appointments().get().end(), [uid, &setme, &bRet](const Appointment& appt)
{
if (appt.uid == uid)
{
setme = appt;
- return true;
+ bRet = true;
}
- }
+ });
- return false;
+ return bRet;
}
void on_appointment_activated (GSimpleAction*, GVariant *vdata, gpointer gself)
diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp
index 4396d45..b7f4682 100644
--- a/src/engine-eds.cpp
+++ b/src/engine-eds.cpp
@@ -19,6 +19,10 @@
* Robert Tari <robert@tari.in>
*/
+#ifndef ALARM_DEFAULT_SOUND
+#define ALARM_DEFAULT_SOUND "dummy"
+#endif
+
#include <datetime/engine-eds.h>
#include <datetime/myself.h>
#include <libical/ical.h>
@@ -48,7 +52,7 @@ class EdsEngine::Impl
{
public:
- Impl(const std::shared_ptr<Myself> &myself)
+ explicit Impl(const std::shared_ptr<Myself> &myself)
: m_myself(myself)
{
auto cancellable_deleter = [](GCancellable * c) {
@@ -473,14 +477,14 @@ private:
// for each component..
for (auto l=components; l!=nullptr; l=l->next)
{
- bool changed = false;
+ bool bChanged = false;
// for each alarm...
auto component = E_CAL_COMPONENT(l->data);
auto auids = e_cal_component_get_alarm_uids(component);
- for(auto l=auids; l!=nullptr; l=l->next)
+ for(auto lAlarms=auids; lAlarms!=nullptr; lAlarms=lAlarms->next)
{
- auto auid = static_cast<const char*>(l->data);
+ auto auid = static_cast<const char*>(lAlarms->data);
auto alarm = e_cal_component_get_alarm(component, auid);
if (alarm == nullptr)
continue;
@@ -490,13 +494,13 @@ private:
{
e_cal_component_remove_alarm (component, auid);
e_cal_component_add_alarm (component, new_alarm);
- changed = true;
+ bChanged = true;
g_clear_pointer (&new_alarm, e_cal_component_alarm_free);
}
}
g_slist_free_full (auids, g_free);
- if (changed)
+ if (bChanged)
{
auto icc = e_cal_component_get_icalcomponent(component); // icc owned by ecc
modify_slist = g_slist_prepend(modify_slist, icc);
@@ -1127,9 +1131,9 @@ private:
alarm.text = get_alarm_text(a);
if (alarm.audio_url.empty())
- alarm.audio_url = get_alarm_sound_url(a, (baseline.is_alarm() ?
- "file://" ALARM_DEFAULT_SOUND :
- "file://" CALENDAR_DEFAULT_SOUND));
+ {
+ alarm.audio_url = get_alarm_sound_url(a, (baseline.is_alarm() ? "file://" ALARM_DEFAULT_SOUND : "file://" CALENDAR_DEFAULT_SOUND));
+ }
if (!alarm.time.is_set())
alarm.time = trigger_time;
diff --git a/src/exporter.cpp b/src/exporter.cpp
index ea514c0..41a1583 100644
--- a/src/exporter.cpp
+++ b/src/exporter.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/dbus-shared.h>
@@ -37,7 +39,7 @@ class Exporter::Impl
{
public:
- Impl(const std::shared_ptr<Settings>& settings):
+ explicit Impl(const std::shared_ptr<Settings>& settings):
m_settings(settings),
m_alarm_props(datetime_alarm_properties_skeleton_new())
{
@@ -190,10 +192,10 @@ private:
for(auto& menu : m_menus)
{
const auto path = std::string(BUS_DATETIME_PATH) + "/" + menu->name();
- const auto id = g_dbus_connection_export_menu_model(m_bus, path.c_str(), menu->menu_model(), &error);
- if (id)
+ const auto nId = g_dbus_connection_export_menu_model(m_bus, path.c_str(), menu->menu_model(), &error);
+ if (nId)
{
- m_exported_menu_ids.insert(id);
+ m_exported_menu_ids.insert(nId);
}
else
{
diff --git a/src/haptic.cpp b/src/haptic.cpp
index 7e09c24..370f0f9 100644
--- a/src/haptic.cpp
+++ b/src/haptic.cpp
@@ -39,7 +39,7 @@ class Haptic::Impl
{
public:
- Impl(bool repeat):
+ explicit Impl(bool repeat):
m_cancellable(g_cancellable_new()),
m_repeat(repeat)
{
diff --git a/src/locations-settings.cpp b/src/locations-settings.cpp
index f1e2b42..2673e66 100644
--- a/src/locations-settings.cpp
+++ b/src/locations-settings.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/locations-settings.h>
@@ -59,10 +61,10 @@ SettingsLocations::reload()
}
// add the other detected timezones
- for(const auto& zone : m_timezones->timezones.get())
+ for(const auto& sZone : m_timezones->timezones.get())
{
- gchar * name = get_beautified_timezone_name(zone.c_str(), timezone_name.c_str());
- Location l(zone, name);
+ gchar * name = get_beautified_timezone_name(sZone.c_str(), timezone_name.c_str());
+ Location l(sZone, name);
if (std::find(v.begin(), v.end(), l) == v.end())
v.push_back(l);
g_free(name);
@@ -73,14 +75,14 @@ SettingsLocations::reload()
{
for(const auto& locstr : m_settings->locations.get())
{
- gchar* zone;
+ gchar* sZone;
gchar* name;
- split_settings_location(locstr.c_str(), &zone, &name);
- Location loc(zone, name);
+ split_settings_location(locstr.c_str(), &sZone, &name);
+ Location loc(sZone, name);
if (std::find(v.begin(), v.end(), loc) == v.end())
v.push_back(loc);
g_free(name);
- g_free(zone);
+ g_free(sZone);
}
}
diff --git a/src/menu.cpp b/src/menu.cpp
index ab0bd71..1f80cd4 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -107,10 +107,6 @@ Menu::get_display_appointments(const std::vector<Appointment>& appointments_in,
if (a_full_day_today != b_full_day_today)
return a_full_day_today;
- const bool a_after_today = (a.begin > end_of_day) || (a.end > end_of_day);
- const bool b_after_today = (a.begin > end_of_day) || (a.end > end_of_day);
- if (a_after_today != b_after_today)
- return a_after_today;
if (a.begin != b.begin)
return a.begin < b.begin;
if (b.end != b.end)
@@ -554,7 +550,7 @@ protected:
update_header();
}
- GVariant* create_header_state()
+ GVariant* create_header_state() override
{
const auto title = _("Date and Time");
auto label = g_variant_new_string(m_formatter->header.get().c_str());
@@ -597,13 +593,19 @@ protected:
update_header();
}
- GVariant* create_header_state()
+ GVariant* create_header_state() override
{
// are there alarms?
bool has_alarms = false;
for(const auto& appointment : m_upcoming)
- if((has_alarms = appointment.is_alarm()))
+ {
+ has_alarms = appointment.is_alarm();
+
+ if (has_alarms)
+ {
break;
+ }
+ }
GVariantBuilder b;
g_variant_builder_init(&b, G_VARIANT_TYPE_VARDICT);
diff --git a/src/notifications.cpp b/src/notifications.cpp
index e38e5dc..bb0e05c 100644
--- a/src/notifications.cpp
+++ b/src/notifications.cpp
@@ -165,7 +165,7 @@ class Engine::Impl
public:
- Impl(const std::string& app_name):
+ explicit Impl(const std::string& app_name):
m_app_name(app_name)
{
if (!notify_init(app_name.c_str()))
diff --git a/src/planner-aggregate.cpp b/src/planner-aggregate.cpp
index 23a1230..3b05ea1 100644
--- a/src/planner-aggregate.cpp
+++ b/src/planner-aggregate.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/planner-aggregate.h>
@@ -30,7 +32,7 @@ namespace datetime {
class AggregatePlanner::Impl
{
public:
- Impl(AggregatePlanner* owner):
+ explicit Impl(AggregatePlanner* owner):
m_owner(owner)
{
}
diff --git a/src/wakeup-timer-mainloop.cpp b/src/wakeup-timer-mainloop.cpp
index 56961f2..738306c 100644
--- a/src/wakeup-timer-mainloop.cpp
+++ b/src/wakeup-timer-mainloop.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/wakeup-timer-mainloop.h>
@@ -36,7 +38,7 @@ class MainloopWakeupTimer::Impl
public:
- Impl(const std::shared_ptr<Clock>& clock):
+ explicit Impl(const std::shared_ptr<Clock>& clock):
m_clock(clock)
{
}
diff --git a/src/wakeup-timer-powerd.cpp b/src/wakeup-timer-powerd.cpp
index e66c94c..f775999 100644
--- a/src/wakeup-timer-powerd.cpp
+++ b/src/wakeup-timer-powerd.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <datetime/clock.h>
@@ -38,7 +40,7 @@ class PowerdWakeupTimer::Impl
{
public:
- Impl(const std::shared_ptr<Clock>& clock):
+ explicit Impl(const std::shared_ptr<Clock>& clock):
m_clock(clock),
m_cancellable(g_cancellable_new())
{
diff --git a/tests/print-to.h b/tests/print-to.h
deleted file mode 100644
index 7cd6c2a..0000000
--- a/tests/print-to.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2015 Canonical Ltd.
- * Copyright 2021 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
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Charles Kerr <charles.kerr@canonical.com>
- * Robert Tari <robert@tari.in>
- */
-
-#ifndef INDICATOR_DATETIME_TESTS_PRINT_TO
-#define INDICATOR_DATETIME_TESTS_PRINT_TO
-
-#include <algorithm>
-#include <vector>
-
-#include <datetime/appointment.h>
-
-namespace ayatana {
-namespace indicator {
-namespace datetime {
-
-/***
-**** PrintTo() functions for GTest to represent objects as strings
-***/
-
-void
-PrintTo(const DateTime& datetime, std::ostream* os)
-{
- *os << "{time:'" << datetime.format("%F %T %z") << '}';
-}
-
-void
-PrintTo(const Alarm& alarm, std::ostream* os)
-{
- *os << '{';
- *os << "{text:" << alarm.text << '}';
- PrintTo(alarm.time, os);
- *os << '}';
-}
-
-void
-PrintTo(const Appointment& appointment, std::ostream* os)
-{
- *os << '{';
-
- *os << "{uid:'" << appointment.uid << "'}"
- << "{color:'" << appointment.color << "'}"
- << "{summary:'" << appointment.summary << "'}";
-
- *os << "{begin:";
- PrintTo(appointment.begin, os);
- *os << '}';
-
- *os << "{end:";
- PrintTo(appointment.end, os);
- *os << '}';
-
- for(const auto& alarm : appointment.alarms)
- PrintTo(alarm, os);
-
- *os << '}';
-}
-
-void
-PrintTo(const std::vector<Appointment>& appointments, std::ostream* os)
-{
- *os << '{';
- for (const auto& appointment : appointments)
- PrintTo(appointment, os);
- *os << '}';
-}
-
-} // namespace datetime
-} // namespace indicator
-} // namespace ayatana
-
-#endif
diff --git a/tests/test-actions.cpp b/tests/test-actions.cpp
index 09f3a5d..8316357 100644
--- a/tests/test-actions.cpp
+++ b/tests/test-actions.cpp
@@ -36,7 +36,6 @@ class ActionsFixture: public StateFixture
Appointment a1; // an alarm clock appointment
a1.color = "red";
- a1.summary = "Alarm";
a1.summary = "http://www.example.com/";
a1.uid = "example";
a1.type = Appointment::ALARM;
@@ -44,10 +43,9 @@ class ActionsFixture: public StateFixture
Appointment a2; // a non-alarm appointment
a2.color = "green";
- a2.summary = "Other Text";
a2.summary = "http://www.monkey.com/";
a2.uid = "monkey";
- a1.type = Appointment::EVENT;
+ a2.type = Appointment::EVENT;
a2.begin = a2.end = tomorrow;
return std::vector<Appointment>({a1, a2});
diff --git a/tests/test-alarm-queue.cpp b/tests/test-alarm-queue.cpp
index aad93e9..b2aeb49 100644
--- a/tests/test-alarm-queue.cpp
+++ b/tests/test-alarm-queue.cpp
@@ -42,7 +42,7 @@ protected:
std::shared_ptr<RangePlanner> m_range_planner;
std::shared_ptr<UpcomingPlanner> m_upcoming;
- void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -57,7 +57,7 @@ protected:
EXPECT_TRUE(m_triggered.empty());
}
- void TearDown()
+ void TearDown() override
{
m_triggered.clear();
m_watcher.reset();
@@ -75,7 +75,6 @@ protected:
Appointment a1; // an alarm
a1.color = "red";
- a1.summary = "Alarm";
a1.summary = "http://www.example.com/";
a1.uid = "example";
a1.type = Appointment::ALARM;
@@ -88,7 +87,6 @@ protected:
Appointment a2; // something else
a2.color = "green";
- a2.summary = "Other Text";
a2.summary = "http://www.monkey.com/";
a2.uid = "monkey";
a2.type = Appointment::EVENT;
diff --git a/tests/test-dbus-fixture.h b/tests/test-dbus-fixture.h
index 0f19b50..7525e06 100644
--- a/tests/test-dbus-fixture.h
+++ b/tests/test-dbus-fixture.h
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#ifndef INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H
@@ -65,8 +67,8 @@ class TestDBusFixture: public GlibFixture
protected:
- GTestDBus * test_dbus;
- GDBusConnection * system_bus;
+ GTestDBus * test_dbus = NULL;
+ GDBusConnection * system_bus = NULL;
const std::vector<std::string> service_dirs;
virtual void SetUp() override
diff --git a/tests/test-eds-ics-all-day-events.cpp b/tests/test-eds-ics-all-day-events.cpp
index 5d7cdc6..93bc9e3 100644
--- a/tests/test-eds-ics-all-day-events.cpp
+++ b/tests/test-eds-ics-all-day-events.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-missing-trigger.cpp b/tests/test-eds-ics-missing-trigger.cpp
index 3eeb919..61271e6 100644
--- a/tests/test-eds-ics-missing-trigger.cpp
+++ b/tests/test-eds-ics-missing-trigger.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-non-attending-alarms.cpp b/tests/test-eds-ics-non-attending-alarms.cpp
index bfa3ac3..ca1c8ed 100644
--- a/tests/test-eds-ics-non-attending-alarms.cpp
+++ b/tests/test-eds-ics-non-attending-alarms.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <algorithm>
@@ -28,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-nonrepeating-events.cpp b/tests/test-eds-ics-nonrepeating-events.cpp
index 8aa2b82..25bbed4 100644
--- a/tests/test-eds-ics-nonrepeating-events.cpp
+++ b/tests/test-eds-ics-nonrepeating-events.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-repeating-events-with-individual-change.cpp b/tests/test-eds-ics-repeating-events-with-individual-change.cpp
index a4a85c0..c63cafc 100644
--- a/tests/test-eds-ics-repeating-events-with-individual-change.cpp
+++ b/tests/test-eds-ics-repeating-events-with-individual-change.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2016 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Renato Araujo Oliveira Filho <renato.filho@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <algorithm>
@@ -28,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-repeating-events.cpp b/tests/test-eds-ics-repeating-events.cpp
index 4125623..d33c339 100644
--- a/tests/test-eds-ics-repeating-events.cpp
+++ b/tests/test-eds-ics-repeating-events.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-repeating-valarms.cpp b/tests/test-eds-ics-repeating-valarms.cpp
index 1584983..ba44662 100644
--- a/tests/test-eds-ics-repeating-valarms.cpp
+++ b/tests/test-eds-ics-repeating-valarms.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-tzids-2.cpp b/tests/test-eds-ics-tzids-2.cpp
index a1d2f5a..608b80a 100644
--- a/tests/test-eds-ics-tzids-2.cpp
+++ b/tests/test-eds-ics-tzids-2.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-tzids-utc.cpp b/tests/test-eds-ics-tzids-utc.cpp
index f79bf3e..06aac71 100644
--- a/tests/test-eds-ics-tzids-utc.cpp
+++ b/tests/test-eds-ics-tzids-utc.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
+ * Copyright 2021 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
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <algorithm>
@@ -28,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-eds-ics-tzids.cpp b/tests/test-eds-ics-tzids.cpp
index 11d44b7..8f6f76b 100644
--- a/tests/test-eds-ics-tzids.cpp
+++ b/tests/test-eds-ics-tzids.cpp
@@ -30,7 +30,6 @@
#include <gtest/gtest.h>
#include "glib-fixture.h"
-#include "print-to.h"
#include "timezone-mock.h"
#include "wakeup-timer-mock.h"
diff --git a/tests/test-formatter.cpp b/tests/test-formatter.cpp
index a8d798b..d8c0afb 100644
--- a/tests/test-formatter.cpp
+++ b/tests/test-formatter.cpp
@@ -1,9 +1,10 @@
-
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2021 Robert Tari
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*
* 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
@@ -143,10 +144,9 @@ TEST_F(FormatterFixture, DISABLED_TestDesktopHeader)
auto now = DateTime::Local(2020, 10, 31, 18, 30, 59);
auto clock = std::make_shared<MockClock>(now);
- bool locale_set = false;
for(const auto& test_case : test_cases)
{
- test_case.is_12h ? locale_set = Set12hLocale() : locale_set = Set24hLocale();
+ bool locale_set = test_case.is_12h ? Set12hLocale() : Set24hLocale();
DesktopFormatter f(clock, m_settings);
m_settings->show_day.set(test_case.show_day);
diff --git a/tests/test-menu-appointments.cpp b/tests/test-menu-appointments.cpp
index 4d15b9f..ed02395 100644
--- a/tests/test-menu-appointments.cpp
+++ b/tests/test-menu-appointments.cpp
@@ -20,11 +20,10 @@
*/
#include "glib-fixture.h"
-#include "print-to.h"
#include <datetime/appointment.h>
#include <datetime/menu.h>
-
+#include <algorithm>
#include <vector>
using MenuAppointmentFixture = GlibFixture;
@@ -117,70 +116,6 @@ TEST_F(MenuAppointmentFixture, DisplayEvents)
DateTime::Local(2017,1,1,0,0,0)
);
- const auto nye_party = create_appointment(
- Appointment::EVENT,
- "uid-new-years-party",
- "New Year Party at Ted's",
- DateTime::Local(2016,12,31,19,0,0),
- DateTime::Local(2017, 1, 1, 2,0,0)
- );
-
- const auto new_years_day = create_appointment(
- Appointment::EVENT,
- "uid-new-years-day",
- "New Years' Day",
- DateTime::Local(2017,1,1,0,0,0),
- DateTime::Local(2017,1,2,0,0,0)
- );
-
- const auto weekday_wakeup_alarm = create_appointment(
- Appointment::ALARM,
- "wakeup-alarm",
- "Wake Up",
- DateTime::Local(2017,1,3,6,0,0),
- DateTime::Local(2017,1,3,6,0,0)
- );
-
- const auto dentist_appointment = create_appointment(
- Appointment::EVENT,
- "dentist",
- "Dentist",
- DateTime::Local(2017,1,5,14,0,0),
- DateTime::Local(2017,1,5,15,0,0)
- );
-
- const auto marcus_birthday = create_appointment(
- Appointment::EVENT,
- "uid-mlk",
- "Marcus' Birthday",
- DateTime::Local(2017,1,8,0,0,0),
- DateTime::Local(2017,1,9,0,0,0)
- );
-
- const auto mlk_day = create_appointment(
- Appointment::EVENT,
- "uid-mlk",
- "Martin Luther King Day",
- DateTime::Local(2017,1,16,0,0,0),
- DateTime::Local(2017,1,17,0,0,0)
- );
-
- const auto rodney_party = create_appointment(
- Appointment::EVENT,
- "uid-rodney",
- "Rodney's Party",
- DateTime::Local(2017,1,30,19,0,0),
- DateTime::Local(2017,1,30,23,0,0)
- );
-
- const auto pub_with_pawel = create_appointment(
- Appointment::ALARM,
- "uid-pawel",
- "Meet Pawel at the Pub",
- DateTime::Local(2017,2,4,19,0,0),
- DateTime::Local(2017,2,4,19,0,0)
- );
-
const struct
{
const char* const description;
diff --git a/tests/test-menus.cpp b/tests/test-menus.cpp
index de323d3..1f73193 100644
--- a/tests/test-menus.cpp
+++ b/tests/test-menus.cpp
@@ -186,7 +186,6 @@ private:
Appointment a1; // an alarm clock appointment
a1.color = "red";
- a1.summary = "Alarm";
a1.summary = "http://www.example.com/";
a1.uid = "example";
a1.type = Appointment::ALARM;
@@ -194,10 +193,9 @@ private:
Appointment a2; // a non-alarm appointment
a2.color = "green";
- a2.summary = "Other Text";
a2.summary = "http://www.monkey.com/";
a2.uid = "monkey";
- a1.type = Appointment::EVENT;
+ a2.type = Appointment::EVENT;
a2.begin = a2.end = tomorrow;
return std::vector<Appointment>({a1, a2});