From 3aec729d05cd2ecccb7e911f657744076ec79c54 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 16 Dec 2021 13:01:45 +0100 Subject: Whitespace fix --- tests/test-formatter.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/test-formatter.cpp b/tests/test-formatter.cpp index a8d798b..e63f098 100644 --- a/tests/test-formatter.cpp +++ b/tests/test-formatter.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2013 Canonical Ltd. * -- cgit v1.2.3 From cd920da7e3d049dcc6867e0816db8ec66d4f52db Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 17 Dec 2021 12:31:57 +0100 Subject: Remove unused print-to.h --- tests/print-to.h | 89 ---------------------- tests/test-eds-ics-all-day-events.cpp | 1 - tests/test-eds-ics-missing-trigger.cpp | 1 - tests/test-eds-ics-non-attending-alarms.cpp | 3 +- tests/test-eds-ics-nonrepeating-events.cpp | 1 - ...ics-repeating-events-with-individual-change.cpp | 3 +- tests/test-eds-ics-repeating-events.cpp | 1 - tests/test-eds-ics-repeating-valarms.cpp | 1 - tests/test-eds-ics-tzids-2.cpp | 1 - tests/test-eds-ics-tzids-utc.cpp | 3 +- tests/test-eds-ics-tzids.cpp | 1 - tests/test-menu-appointments.cpp | 1 - 12 files changed, 6 insertions(+), 100 deletions(-) delete mode 100644 tests/print-to.h (limited to 'tests') 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 . - * - * Authors: - * Charles Kerr - * Robert Tari - */ - -#ifndef INDICATOR_DATETIME_TESTS_PRINT_TO -#define INDICATOR_DATETIME_TESTS_PRINT_TO - -#include -#include - -#include - -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& 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-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 #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 #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 + * Robert Tari */ #include @@ -28,7 +30,6 @@ #include #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 #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 + * Robert Tari */ #include @@ -28,7 +30,6 @@ #include #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 #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 #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 #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 + * Robert Tari */ #include @@ -28,7 +30,6 @@ #include #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 #include "glib-fixture.h" -#include "print-to.h" #include "timezone-mock.h" #include "wakeup-timer-mock.h" diff --git a/tests/test-menu-appointments.cpp b/tests/test-menu-appointments.cpp index 4d15b9f..60086b8 100644 --- a/tests/test-menu-appointments.cpp +++ b/tests/test-menu-appointments.cpp @@ -20,7 +20,6 @@ */ #include "glib-fixture.h" -#include "print-to.h" #include #include -- cgit v1.2.3 From 02cc4073ae00af6287e4086b9c8ffa2be55cda67 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 17 Dec 2021 12:49:08 +0100 Subject: tests/test-menu-appointments.cpp: Remove unused variables --- tests/test-menu-appointments.cpp | 64 ---------------------------------------- 1 file changed, 64 deletions(-) (limited to 'tests') diff --git a/tests/test-menu-appointments.cpp b/tests/test-menu-appointments.cpp index 60086b8..cbe6b33 100644 --- a/tests/test-menu-appointments.cpp +++ b/tests/test-menu-appointments.cpp @@ -116,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; -- cgit v1.2.3 From 7f380782f57089b97a04125f18d61da05292d2ba Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 16 Dec 2021 13:06:08 +0100 Subject: Fix cppcheck errors/warnings --- tests/test-actions.cpp | 4 +--- tests/test-alarm-queue.cpp | 6 ++---- tests/test-dbus-fixture.h | 6 ++++-- tests/test-formatter.cpp | 5 +++-- tests/test-menu-appointments.cpp | 2 +- tests/test-menus.cpp | 4 +--- 6 files changed, 12 insertions(+), 15 deletions(-) (limited to 'tests') 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({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 m_range_planner; std::shared_ptr 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 + * Robert Tari */ #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 service_dirs; virtual void SetUp() override diff --git a/tests/test-formatter.cpp b/tests/test-formatter.cpp index e63f098..d8c0afb 100644 --- a/tests/test-formatter.cpp +++ b/tests/test-formatter.cpp @@ -1,8 +1,10 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2021 Robert Tari * * Authors: * Charles Kerr + * 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 @@ -142,10 +144,9 @@ TEST_F(FormatterFixture, DISABLED_TestDesktopHeader) auto now = DateTime::Local(2020, 10, 31, 18, 30, 59); auto clock = std::make_shared(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 cbe6b33..ed02395 100644 --- a/tests/test-menu-appointments.cpp +++ b/tests/test-menu-appointments.cpp @@ -23,7 +23,7 @@ #include #include - +#include #include using MenuAppointmentFixture = GlibFixture; 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({a1, a2}); -- cgit v1.2.3