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