aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-02-18 00:35:47 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-02-18 08:25:19 +0100
commite112ae970b0719de8158fdc1deb281e2ee098390 (patch)
treed2b0ebe43f0857e771d55d245c46588938237384
parent412bb6e3c6de84096722ca93be7c36733f0c189b (diff)
downloadayatana-indicator-sound-e112ae970b0719de8158fdc1deb281e2ee098390.tar.gz
ayatana-indicator-sound-e112ae970b0719de8158fdc1deb281e2ee098390.tar.bz2
ayatana-indicator-sound-e112ae970b0719de8158fdc1deb281e2ee098390.zip
Fix build warnings
-rw-r--r--CMakeLists.txt2
-rw-r--r--tests/CMakeLists.txt3
-rw-r--r--tests/integration/test-indicator.cpp10
-rw-r--r--tests/pa-mock.cpp16
-rw-r--r--tests/volume-control-test.cc4
5 files changed, 20 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c3dfa4..89fd075 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,8 @@ else()
add_definitions("-Wall")
endif()
+add_definitions("-Wno-sign-compare") # Needed for GTest on Ubuntu
+
set(GETTEXT_PACKAGE "ayatana-indicator-sound")
set(LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}")
add_definitions( -DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}" )
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9a72e0e..dab8408 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -80,7 +80,7 @@ vala_init(vala-mocks
--vapidir=.
)
-set_source_files_properties(media-player-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-discarded-qualifiers")
+set_source_files_properties(media-player-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-warning-option -Wno-incompatible-pointer-types -Wno-discarded-qualifiers")
set_source_files_properties(media-player-list-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable")
set_source_files_properties(options-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-unused-variable")
set_source_files_properties(volume-control-mock.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types -Wno-int-to-pointer-cast -Wno-implicit-function-declaration")
@@ -131,6 +131,7 @@ set(
)
add_definitions(
+ -Wno-unknown-warning-option
-Wno-unused-but-set-variable
-DVALA_EXTERN=extern
)
diff --git a/tests/integration/test-indicator.cpp b/tests/integration/test-indicator.cpp
index cbf1c6d..624176a 100644
--- a/tests/integration/test-indicator.cpp
+++ b/tests/integration/test-indicator.cpp
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2022 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
@@ -276,8 +276,8 @@ TEST_F(TestIndicator, DISABLED_PhoneChangeRoleVolume)
// Generate a random volume in the range [0...0.33]
QTime now = QTime::currentTime();
- qsrand(now.msec());
- int randInt = qrand() % 33;
+ QRandomGenerator::global()->bounded(now.msec());
+ int randInt = QRandomGenerator::global()->generate() % 33;
const double randomVolume = randInt / 100.0;
QSignalSpy &userAccountsSpy = *signal_spy_volume_changed_;
@@ -1412,8 +1412,8 @@ TEST_F(TestIndicator, DISABLED_DesktopChangeRoleVolume)
// Generate a random volume in the range [0...0.33]
QTime now = QTime::currentTime();
- qsrand(now.msec());
- int randInt = qrand() % 33;
+ QRandomGenerator::global()->bounded(now.msec());
+ int randInt = QRandomGenerator::global()->generate() % 33;
const double randomVolume = randInt / 100.0;
// play a test sound, it should NOT change the role in the indicator
diff --git a/tests/pa-mock.cpp b/tests/pa-mock.cpp
index 50e5f28..bb11b86 100644
--- a/tests/pa-mock.cpp
+++ b/tests/pa-mock.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2015 Canonical Ltd.
+ * Copyright 2022 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +16,7 @@
*
* Authors:
* Ted Gould <ted@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include <atomic>
@@ -237,7 +239,7 @@ pa_operation*
pa_context_get_sink_info_by_name (pa_context *c, const gchar * name, pa_sink_info_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, name, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb == nullptr)
return;
@@ -268,7 +270,7 @@ pa_operation *
pa_context_get_sink_input_info (pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void * userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, idx, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb == nullptr)
return;
@@ -284,7 +286,7 @@ pa_operation*
pa_context_get_source_info_by_name (pa_context *c, const char * name, pa_source_info_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, name, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb == nullptr)
return;
@@ -302,7 +304,7 @@ pa_operation*
pa_context_get_source_output_info (pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, idx, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb == nullptr)
return;
@@ -319,7 +321,7 @@ pa_operation*
pa_context_set_sink_mute_by_index (pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, idx, mute, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb != nullptr)
cb(c, 1, userdata);
});
@@ -331,7 +333,7 @@ pa_operation*
pa_context_set_sink_volume_by_index (pa_context *c, uint32_t idx, const pa_cvolume * cvol, pa_context_success_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, idx, cvol, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb != nullptr)
cb(c, 1, userdata);
});
@@ -343,7 +345,7 @@ pa_operation*
pa_context_set_source_volume_by_name (pa_context *c, const char * name, const pa_cvolume * cvol, pa_context_success_cb_t cb, void *userdata)
{
reinterpret_cast<PAMockContext*>(c)->idleOnce(
- [c, name, cvol, cb, userdata]() {
+ [c, cb, userdata]() {
if (cb != nullptr)
cb(c, 1, userdata);
});
diff --git a/tests/volume-control-test.cc b/tests/volume-control-test.cc
index 36fa05e..15032b5 100644
--- a/tests/volume-control-test.cc
+++ b/tests/volume-control-test.cc
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Canonical Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2022 Robert Tari
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ class VolumeControlTest : public ::testing::Test
g_object_add_weak_pointer(G_OBJECT(session), (gpointer *)&session);
}
- virtual void TearDown() {
+ virtual void TearDown() override {
g_clear_object(&service);
g_object_unref(session);