1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #6394

Brandon Mosher (1):
      refactor: Provide a Virtual Method Anchor for Classes in Headers
This commit is contained in:
Anthony Bilinski 2021-10-26 16:21:55 -07:00
commit 2dafd89052
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
56 changed files with 744 additions and 77 deletions

View File

@ -92,6 +92,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
# Hardening flags (ASLR, warnings, etc) # Hardening flags (ASLR, warnings, etc)
set(POSITION_INDEPENDENT_CODE True) set(POSITION_INDEPENDENT_CODE True)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wweak-vtables COMPILER_SUPPORTS_WARNING_WEAK_VTABLES)
if(COMPILER_SUPPORTS_WARNING_WEAK_VTABLES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wweak-vtables")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-overflow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast")
@ -232,7 +239,18 @@ set(${PROJECT_NAME}_SOURCES
src/core/core.h src/core/core.h
src/core/dhtserver.cpp src/core/dhtserver.cpp
src/core/dhtserver.h src/core/dhtserver.h
src/core/icoreextpacket.cpp
src/core/icoreextpacket.h
src/core/icoresettings.cpp
src/core/icoresettings.h src/core/icoresettings.h
src/core/icorefriendmessagesender.cpp
src/core/icorefriendmessagesender.h
src/core/icoregroupmessagesender.cpp
src/core/icoregroupmessagesender.h
src/core/icoregroupquery.cpp
src/core/icoregroupquery.h
src/core/icoreidhandler.cpp
src/core/icoreidhandler.h
src/core/toxcall.cpp src/core/toxcall.cpp
src/core/toxcall.h src/core/toxcall.h
src/core/toxencrypt.cpp src/core/toxencrypt.cpp
@ -262,11 +280,13 @@ set(${PROJECT_NAME}_SOURCES
src/ipc.h src/ipc.h
src/model/about/aboutfriend.cpp src/model/about/aboutfriend.cpp
src/model/about/aboutfriend.h src/model/about/aboutfriend.h
src/model/about/iaboutfriend.cpp
src/model/about/iaboutfriend.h src/model/about/iaboutfriend.h
src/model/chathistory.cpp src/model/chathistory.cpp
src/model/chathistory.h src/model/chathistory.h
src/model/chatlogitem.cpp src/model/chatlogitem.cpp
src/model/chatlogitem.h src/model/chatlogitem.h
src/model/chatroom/chatroom.cpp
src/model/chatroom/chatroom.h src/model/chatroom/chatroom.h
src/model/chatroom/friendchatroom.cpp src/model/chatroom/friendchatroom.cpp
src/model/chatroom/friendchatroom.h src/model/chatroom/friendchatroom.h
@ -274,11 +294,15 @@ set(${PROJECT_NAME}_SOURCES
src/model/chatroom/groupchatroom.h src/model/chatroom/groupchatroom.h
src/model/contact.cpp src/model/contact.cpp
src/model/contact.h src/model/contact.h
src/model/dialogs/idialogs.cpp
src/model/dialogs/idialogs.h src/model/dialogs/idialogs.h
src/model/dialogs/idialogsmanager.h
src/model/dialogs/idialogsmanager.cpp
src/model/exiftransform.cpp src/model/exiftransform.cpp
src/model/exiftransform.h src/model/exiftransform.h
src/model/friendlist/friendlistmanager.cpp src/model/friendlist/friendlistmanager.cpp
src/model/friendlist/friendlistmanager.h src/model/friendlist/friendlistmanager.h
src/model/friendlist/ifriendlistitem.cpp
src/model/friendlist/ifriendlistitem.h src/model/friendlist/ifriendlistitem.h
src/model/friendmessagedispatcher.cpp src/model/friendmessagedispatcher.cpp
src/model/friendmessagedispatcher.h src/model/friendmessagedispatcher.h
@ -290,6 +314,7 @@ set(${PROJECT_NAME}_SOURCES
src/model/groupmessagedispatcher.h src/model/groupmessagedispatcher.h
src/model/group.cpp src/model/group.cpp
src/model/group.h src/model/group.h
src/model/ibootstraplistgenerator.cpp
src/model/ibootstraplistgenerator.h src/model/ibootstraplistgenerator.h
src/model/ichatlog.h src/model/ichatlog.h
src/model/imessagedispatcher.h src/model/imessagedispatcher.h
@ -297,6 +322,7 @@ set(${PROJECT_NAME}_SOURCES
src/model/message.h src/model/message.h
src/model/notificationgenerator.cpp src/model/notificationgenerator.cpp
src/model/notificationgenerator.h src/model/notificationgenerator.h
src/model/profile/iprofileinfo.cpp
src/model/profile/iprofileinfo.h src/model/profile/iprofileinfo.h
src/model/profile/profileinfo.cpp src/model/profile/profileinfo.cpp
src/model/profile/profileinfo.h src/model/profile/profileinfo.h
@ -317,7 +343,12 @@ set(${PROJECT_NAME}_SOURCES
src/persistence/db/rawdatabase.h src/persistence/db/rawdatabase.h
src/persistence/history.cpp src/persistence/history.cpp
src/persistence/history.h src/persistence/history.h
src/persistence/ifriendsettings.cpp
src/persistence/ifriendsettings.h src/persistence/ifriendsettings.h
src/persistence/igroupsettings.cpp
src/persistence/igroupsettings.h
src/persistence/inotificationsettings.cpp
src/persistence/inotificationsettings.h
src/persistence/offlinemsgengine.cpp src/persistence/offlinemsgengine.cpp
src/persistence/offlinemsgengine.h src/persistence/offlinemsgengine.h
src/persistence/paths.cpp src/persistence/paths.cpp
@ -342,6 +373,7 @@ set(${PROJECT_NAME}_SOURCES
src/video/camerasource.h src/video/camerasource.h
src/video/corevideosource.cpp src/video/corevideosource.cpp
src/video/corevideosource.h src/video/corevideosource.h
src/video/ivideosettings.cpp
src/video/ivideosettings.h src/video/ivideosettings.h
src/video/netcamview.cpp src/video/netcamview.cpp
src/video/netcamview.h src/video/netcamview.h

View File

@ -20,6 +20,8 @@ set(SOURCE_FILES
"include/audio/iaudiosettings.h" "include/audio/iaudiosettings.h"
"include/audio/iaudiosink.h" "include/audio/iaudiosink.h"
"include/audio/iaudiosource.h" "include/audio/iaudiosource.h"
"src/iaudiosettings.cpp"
"src/iaudiosink.cpp"
"src/audio.cpp" "src/audio.cpp"
"src/backend/alsink.cpp" "src/backend/alsink.cpp"
"src/backend/alsink.h" "src/backend/alsink.h"

View File

@ -25,7 +25,12 @@
class IAudioSettings { class IAudioSettings {
public: public:
virtual ~IAudioSettings() = default; IAudioSettings() = default;
virtual ~IAudioSettings();
IAudioSettings(const IAudioSettings&) = default;
IAudioSettings& operator=(const IAudioSettings&) = default;
IAudioSettings(IAudioSettings&&) = default;
IAudioSettings& operator=(IAudioSettings&&) = default;
virtual QString getInDev() const = 0; virtual QString getInDev() const = 0;
virtual void setInDev(const QString& deviceSpecifier) = 0; virtual void setInDev(const QString& deviceSpecifier) = 0;

View File

@ -96,7 +96,13 @@ public:
return {}; return {};
} }
virtual ~IAudioSink() = default; IAudioSink() = default;
virtual ~IAudioSink();
IAudioSink(const IAudioSink&) = default;
IAudioSink& operator=(const IAudioSink&) = default;
IAudioSink(IAudioSink&&) = default;
IAudioSink& operator=(IAudioSink&&) = default;
virtual void playAudioBuffer(const int16_t* data, int samples, unsigned channels, virtual void playAudioBuffer(const int16_t* data, int samples, unsigned channels,
int sampleRate) const = 0; int sampleRate) const = 0;
virtual void playMono16Sound(const Sound& sound) = 0; virtual void playMono16Sound(const Sound& sound) = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "audio/iaudiosettings.h"
IAudioSettings::~IAudioSettings() = default;

22
audio/src/iaudiosink.cpp Normal file
View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "audio/iaudiosink.h"
IAudioSink::~IAudioSink() = default;

View File

@ -34,6 +34,11 @@ function(auto_test subsystem module extra_deps)
COMMAND ${TEST_CROSSCOMPILING_EMULATOR} test_${module}) COMMAND ${TEST_CROSSCOMPILING_EMULATOR} test_${module})
endfunction() endfunction()
set(MOCK_SOURCES
test/mock/mockcoreidhandler.cpp
test/mock/mockgroupquery.cpp
)
auto_test(core core "${${PROJECT_NAME}_RESOURCES}") auto_test(core core "${${PROJECT_NAME}_RESOURCES}")
auto_test(core contactid "") auto_test(core contactid "")
auto_test(core toxid "") auto_test(core toxid "")
@ -45,11 +50,11 @@ auto_test(persistence dbschema "")
auto_test(persistence offlinemsgengine "") auto_test(persistence offlinemsgengine "")
auto_test(persistence smileypack "${${PROJECT_NAME}_RESOURCES}") # needs emojione auto_test(persistence smileypack "${${PROJECT_NAME}_RESOURCES}") # needs emojione
auto_test(model friendmessagedispatcher "") auto_test(model friendmessagedispatcher "")
auto_test(model groupmessagedispatcher "") auto_test(model groupmessagedispatcher "${MOCK_SOURCES}")
auto_test(model messageprocessor "") auto_test(model messageprocessor "")
auto_test(model sessionchatlog "") auto_test(model sessionchatlog "")
auto_test(model exiftransform "") auto_test(model exiftransform "")
auto_test(model notificationgenerator "") auto_test(model notificationgenerator "${MOCK_SOURCES}")
if (UNIX) if (UNIX)
auto_test(platform posixsignalnotifier "") auto_test(platform posixsignalnotifier "")

View File

@ -45,6 +45,8 @@ ChatMessage::ChatMessage()
{ {
} }
ChatMessage::~ChatMessage() = default;
ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QString& rawMessage, ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QString& rawMessage,
MessageType type, bool isMe, MessageState state, MessageType type, bool isMe, MessageState state,
const QDateTime& date, bool colorizeName) const QDateTime& date, bool colorizeName)

View File

@ -48,6 +48,10 @@ public:
}; };
ChatMessage(); ChatMessage();
~ChatMessage();
ChatMessage(const ChatMessage&) = default;
ChatMessage& operator=(const ChatMessage&) = default;
ChatMessage(ChatMessage&&) = default;
static ChatMessage::Ptr createChatMessage(const QString& sender, const QString& rawMessage, static ChatMessage::Ptr createChatMessage(const QString& sender, const QString& rawMessage,
MessageType type, bool isMe, MessageState state, MessageType type, bool isMe, MessageState state,

View File

@ -30,6 +30,7 @@ ContactId::ContactId()
: id() : id()
{ {
} }
ContactId::~ContactId() = default;
/** /**
* @brief Constructs a ContactId from bytes. * @brief Constructs a ContactId from bytes.

View File

@ -28,9 +28,11 @@
class ContactId class ContactId
{ {
public: public:
virtual ~ContactId() = default; virtual ~ContactId();
ContactId& operator=(const ContactId& other) = default; ContactId(const ContactId&) = default;
ContactId& operator=(ContactId&& other) = default; ContactId& operator=(const ContactId&) = default;
ContactId(ContactId&&) = default;
ContactId& operator=(ContactId&&) = default;
bool operator==(const ContactId& other) const; bool operator==(const ContactId& other) const;
bool operator!=(const ContactId& other) const; bool operator!=(const ContactId& other) const;
bool operator<(const ContactId& other) const; bool operator<(const ContactId& other) const;

View File

@ -0,0 +1,25 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icoreextpacket.h"
ICoreExtPacket::~ICoreExtPacket() = default;
ICoreExtPacketAllocator::~ICoreExtPacketAllocator() = default;

View File

@ -36,8 +36,12 @@
class ICoreExtPacket class ICoreExtPacket
{ {
public: public:
virtual ~ICoreExtPacket() = default; ICoreExtPacket() = default;
virtual ~ICoreExtPacket();
ICoreExtPacket(const ICoreExtPacket&) = default;
ICoreExtPacket& operator=(const ICoreExtPacket&) = default;
ICoreExtPacket(ICoreExtPacket&&) = default;
ICoreExtPacket& operator=(ICoreExtPacket&&) = default;
/** /**
* @brief Adds message to packet * @brief Adds message to packet
* @return Extended message receipt, UINT64_MAX on failure * @return Extended message receipt, UINT64_MAX on failure
@ -59,7 +63,7 @@ public:
class ICoreExtPacketAllocator class ICoreExtPacketAllocator
{ {
public: public:
virtual ~ICoreExtPacketAllocator() = default; virtual ~ICoreExtPacketAllocator();
/** /**
* @brief Gets a new packet builder for friend with core friend id friendId * @brief Gets a new packet builder for friend with core friend id friendId

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icorefriendmessagesender.h"
ICoreFriendMessageSender::~ICoreFriendMessageSender() = default;

View File

@ -27,7 +27,12 @@
class ICoreFriendMessageSender class ICoreFriendMessageSender
{ {
public: public:
virtual ~ICoreFriendMessageSender() = default; ICoreFriendMessageSender() = default;
virtual ~ICoreFriendMessageSender();
ICoreFriendMessageSender(const ICoreFriendMessageSender&) = default;
ICoreFriendMessageSender& operator=(const ICoreFriendMessageSender&) = default;
ICoreFriendMessageSender(ICoreFriendMessageSender&&) = default;
ICoreFriendMessageSender& operator=(ICoreFriendMessageSender&&) = default;
virtual bool sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt) = 0; virtual bool sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt) = 0;
virtual bool sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt) = 0; virtual bool sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt) = 0;
}; };

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icoregroupmessagesender.h"
ICoreGroupMessageSender::~ICoreGroupMessageSender() = default;

View File

@ -24,7 +24,13 @@
class ICoreGroupMessageSender class ICoreGroupMessageSender
{ {
public: public:
virtual ~ICoreGroupMessageSender() = default; ICoreGroupMessageSender() = default;
virtual ~ICoreGroupMessageSender();
ICoreGroupMessageSender(const ICoreGroupMessageSender&) = default;
ICoreGroupMessageSender& operator=(const ICoreGroupMessageSender&) = default;
ICoreGroupMessageSender(ICoreGroupMessageSender&&) = default;
ICoreGroupMessageSender& operator=(ICoreGroupMessageSender&&) = default;
virtual void sendGroupAction(int groupId, const QString& message) = 0; virtual void sendGroupAction(int groupId, const QString& message) = 0;
virtual void sendGroupMessage(int groupId, const QString& message) = 0; virtual void sendGroupMessage(int groupId, const QString& message) = 0;
}; };

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icoregroupquery.h"
ICoreGroupQuery::~ICoreGroupQuery() = default;

View File

@ -31,7 +31,13 @@
class ICoreGroupQuery class ICoreGroupQuery
{ {
public: public:
virtual ~ICoreGroupQuery() = default; ICoreGroupQuery() = default;
virtual ~ICoreGroupQuery();
ICoreGroupQuery(const ICoreGroupQuery&) = default;
ICoreGroupQuery& operator=(const ICoreGroupQuery&) = default;
ICoreGroupQuery(ICoreGroupQuery&&) = default;
ICoreGroupQuery& operator=(ICoreGroupQuery&&) = default;
virtual GroupId getGroupPersistentId(uint32_t groupNumber) const = 0; virtual GroupId getGroupPersistentId(uint32_t groupNumber) const = 0;
virtual uint32_t getGroupNumberPeers(int groupId) const = 0; virtual uint32_t getGroupNumberPeers(int groupId) const = 0;
virtual QString getGroupPeerName(int groupId, int peerId) const = 0; virtual QString getGroupPeerName(int groupId, int peerId) const = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icoreidhandler.h"
ICoreIdHandler::~ICoreIdHandler() = default;

View File

@ -26,7 +26,13 @@ class ICoreIdHandler
{ {
public: public:
virtual ~ICoreIdHandler() = default; ICoreIdHandler() = default;
virtual ~ICoreIdHandler();
ICoreIdHandler(const ICoreIdHandler&) = default;
ICoreIdHandler& operator=(const ICoreIdHandler&) = default;
ICoreIdHandler(ICoreIdHandler&&) = default;
ICoreIdHandler& operator=(ICoreIdHandler&&) = default;
virtual ToxId getSelfId() const = 0; virtual ToxId getSelfId() const = 0;
virtual ToxPk getSelfPublicKey() const = 0; virtual ToxPk getSelfPublicKey() const = 0;
virtual QString getUsername() const = 0; virtual QString getUsername() const = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "icoresettings.h"
ICoreSettings::~ICoreSettings() = default;

View File

@ -34,7 +34,12 @@ public:
ptSOCKS5 = 1, ptSOCKS5 = 1,
ptHTTP = 2 ptHTTP = 2
}; };
virtual ~ICoreSettings() = default; ICoreSettings() = default;
virtual ~ICoreSettings();
ICoreSettings(const ICoreSettings&) = default;
ICoreSettings& operator=(const ICoreSettings&) = default;
ICoreSettings(ICoreSettings&&) = default;
ICoreSettings& operator=(ICoreSettings&&) = default;
virtual bool getEnableIPv6() const = 0; virtual bool getEnableIPv6() const = 0;
virtual void setEnableIPv6(bool enable) = 0; virtual void setEnableIPv6(bool enable) = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "iaboutfriend.h"
IAboutFriend::~IAboutFriend() = default;

View File

@ -27,7 +27,13 @@
class IAboutFriend class IAboutFriend
{ {
public: public:
virtual ~IAboutFriend() = default; IAboutFriend() = default;
virtual ~IAboutFriend();
IAboutFriend(const IAboutFriend&) = default;
IAboutFriend& operator=(const IAboutFriend&) = default;
IAboutFriend(IAboutFriend&&) = default;
IAboutFriend& operator=(IAboutFriend&&) = default;
virtual QString getName() const = 0; virtual QString getName() const = 0;
virtual QString getStatusMessage() const = 0; virtual QString getStatusMessage() const = 0;
virtual ToxPk getPublicKey() const = 0; virtual ToxPk getPublicKey() const = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "chatroom.h"
Chatroom::~Chatroom() = default;

View File

@ -24,5 +24,12 @@
class Chatroom class Chatroom
{ {
public: public:
Chatroom() = default;
virtual ~Chatroom();
Chatroom(const Chatroom&) = default;
Chatroom& operator=(const Chatroom&) = default;
Chatroom(Chatroom&&) = default;
Chatroom& operator=(Chatroom&&) = default;
virtual Contact* getContact() = 0; virtual Contact* getContact() = 0;
}; };

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "idialogs.h"
IDialogs::~IDialogs() = default;

View File

@ -26,7 +26,13 @@ class ToxPk;
class IDialogs class IDialogs
{ {
public: public:
virtual ~IDialogs() = default; IDialogs() = default;
virtual ~IDialogs();
IDialogs(const IDialogs&) = default;
IDialogs& operator=(const IDialogs&) = default;
IDialogs(IDialogs&&) = default;
IDialogs& operator=(IDialogs&&) = default;
virtual bool hasContact(const ContactId& contactId) const = 0; virtual bool hasContact(const ContactId& contactId) const = 0;
virtual bool isContactActive(const ContactId& contactId) const = 0; virtual bool isContactActive(const ContactId& contactId) const = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "idialogsmanager.h"
IDialogsManager::~IDialogsManager() = default;

View File

@ -27,7 +27,13 @@ class ToxPk;
class IDialogsManager class IDialogsManager
{ {
public: public:
virtual ~IDialogsManager() = default; IDialogsManager() = default;
virtual ~IDialogsManager();
IDialogsManager(const IDialogsManager&) = default;
IDialogsManager& operator=(const IDialogsManager&) = default;
IDialogsManager(IDialogsManager&&) = default;
IDialogsManager& operator=(IDialogsManager&&) = default;
virtual IDialogs* getFriendDialogs(const ToxPk& friendPk) const = 0; virtual IDialogs* getFriendDialogs(const ToxPk& friendPk) const = 0;
virtual IDialogs* getGroupDialogs(const GroupId& groupId) const = 0; virtual IDialogs* getGroupDialogs(const GroupId& groupId) const = 0;
}; };

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ifriendlistitem.h"
IFriendListItem::~IFriendListItem() = default;

View File

@ -26,8 +26,12 @@ class QWidget;
class IFriendListItem class IFriendListItem
{ {
public: public:
IFriendListItem() = default;
virtual ~IFriendListItem() = default; virtual ~IFriendListItem();
IFriendListItem(const IFriendListItem&) = default;
IFriendListItem& operator=(const IFriendListItem&) = default;
IFriendListItem(IFriendListItem&&) = default;
IFriendListItem& operator=(IFriendListItem&&) = default;
virtual bool isFriend() const = 0; virtual bool isFriend() const = 0;
virtual bool isGroup() const = 0; virtual bool isGroup() const = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ibootstraplistgenerator.h"
IBootstrapListGenerator::~IBootstrapListGenerator() = default;

View File

@ -25,6 +25,12 @@ class DhtServer;
class IBootstrapListGenerator class IBootstrapListGenerator
{ {
public: public:
virtual ~IBootstrapListGenerator() = default; IBootstrapListGenerator() = default;
virtual ~IBootstrapListGenerator();
IBootstrapListGenerator(const IBootstrapListGenerator&) = default;
IBootstrapListGenerator& operator=(const IBootstrapListGenerator&) = default;
IBootstrapListGenerator(IBootstrapListGenerator&&) = default;
IBootstrapListGenerator& operator=(IBootstrapListGenerator&&) = default;
virtual QList<DhtServer> getBootstrapnodes() = 0; virtual QList<DhtServer> getBootstrapnodes() = 0;
}; };

View File

@ -162,6 +162,8 @@ NotificationGenerator::NotificationGenerator(
, profile(profile) , profile(profile)
{} {}
NotificationGenerator::~NotificationGenerator() = default;
NotificationData NotificationGenerator::friendMessageNotification(const Friend* f, const QString& message) NotificationData NotificationGenerator::friendMessageNotification(const Friend* f, const QString& message)
{ {
friendNotifications[f]++; friendNotifications[f]++;

View File

@ -39,6 +39,11 @@ public:
// currently mockable so we allow profile to be nullptr for unit // currently mockable so we allow profile to be nullptr for unit
// testing // testing
Profile* profile); Profile* profile);
virtual ~NotificationGenerator();
NotificationGenerator(const NotificationGenerator&) = delete;
NotificationGenerator& operator=(const NotificationGenerator&) = delete;
NotificationGenerator(NotificationGenerator&&) = delete;
NotificationGenerator& operator=(NotificationGenerator&&) = delete;
NotificationData friendMessageNotification(const Friend* f, const QString& message); NotificationData friendMessageNotification(const Friend* f, const QString& message);
NotificationData groupMessageNotification(const Group* g, const ToxPk& sender, const QString& message); NotificationData groupMessageNotification(const Group* g, const ToxPk& sender, const QString& message);

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "iprofileinfo.h"
IProfileInfo::~IProfileInfo() = default;

View File

@ -39,7 +39,13 @@ public:
enum class SetAvatarResult { enum class SetAvatarResult {
OK, EmptyPath, CanNotOpen, CanNotRead, TooLarge OK, EmptyPath, CanNotOpen, CanNotRead, TooLarge
}; };
virtual ~IProfileInfo() = default;
IProfileInfo() = default;
virtual ~IProfileInfo();
IProfileInfo(const IProfileInfo&) = default;
IProfileInfo& operator=(const IProfileInfo&) = default;
IProfileInfo(IProfileInfo&&) = default;
IProfileInfo& operator=(IProfileInfo&&) = default;
virtual bool setPassword(const QString& password) = 0; virtual bool setPassword(const QString& password) = 0;
virtual bool deletePassword() = 0; virtual bool deletePassword() = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ifriendsettings.h"
IFriendSettings::~IFriendSettings() = default;

View File

@ -38,7 +38,12 @@ public:
}; };
Q_DECLARE_FLAGS(AutoAcceptCallFlags, AutoAcceptCall) Q_DECLARE_FLAGS(AutoAcceptCallFlags, AutoAcceptCall)
virtual ~IFriendSettings() = default; IFriendSettings() = default;
virtual ~IFriendSettings();
IFriendSettings(const IFriendSettings&) = default;
IFriendSettings& operator=(const IFriendSettings&) = default;
IFriendSettings(IFriendSettings&&) = default;
IFriendSettings& operator=(IFriendSettings&&) = default;
virtual QString getContactNote(const ToxPk& pk) const = 0; virtual QString getContactNote(const ToxPk& pk) const = 0;
virtual void setContactNote(const ToxPk& pk, const QString& note) = 0; virtual void setContactNote(const ToxPk& pk, const QString& note) = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "igroupsettings.h"
IGroupSettings::~IGroupSettings() = default;

View File

@ -24,7 +24,13 @@
class IGroupSettings class IGroupSettings
{ {
public: public:
virtual ~IGroupSettings() = default; IGroupSettings() = default;
virtual ~IGroupSettings();
IGroupSettings(const IGroupSettings&) = default;
IGroupSettings& operator=(const IGroupSettings&) = default;
IGroupSettings(IGroupSettings&&) = default;
IGroupSettings& operator=(IGroupSettings&&) = default;
virtual QStringList getBlackList() const = 0; virtual QStringList getBlackList() const = 0;
virtual void setBlackList(const QStringList& blist) = 0; virtual void setBlackList(const QStringList& blist) = 0;
}; };

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "inotificationsettings.h"
INotificationSettings::~INotificationSettings() = default;

View File

@ -24,7 +24,12 @@
class INotificationSettings class INotificationSettings
{ {
public: public:
virtual ~INotificationSettings() = default; INotificationSettings() = default;
virtual ~INotificationSettings();
INotificationSettings(const INotificationSettings&) = default;
INotificationSettings& operator=(const INotificationSettings&) = default;
INotificationSettings(INotificationSettings&&) = default;
INotificationSettings& operator=(INotificationSettings&&) = default;
virtual bool getNotify() const = 0; virtual bool getNotify() const = 0;
virtual void setNotify(bool newValue) = 0; virtual void setNotify(bool newValue) = 0;

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ivideosettings.h"
IVideoSettings::~IVideoSettings() = default;

View File

@ -26,7 +26,12 @@
class IVideoSettings { class IVideoSettings {
public: public:
virtual ~IVideoSettings() = default; IVideoSettings() = default;
virtual ~IVideoSettings();
IVideoSettings(const IVideoSettings&) = default;
IVideoSettings& operator=(const IVideoSettings&) = default;
IVideoSettings(IVideoSettings&&) = default;
IVideoSettings& operator=(IVideoSettings&&) = default;
virtual QString getVideoDev() const = 0; virtual QString getVideoDev() const = 0;
virtual void setVideoDev(const QString& deviceSpecifier) = 0; virtual void setVideoDev(const QString& deviceSpecifier) = 0;

View File

@ -103,6 +103,8 @@ QString getToolTipDisplayingImage(const QPixmap& image)
} // namespace } // namespace
ImagePreviewButton::~ImagePreviewButton() = default;
void ImagePreviewButton::initialize(const QPixmap& image) void ImagePreviewButton::initialize(const QPixmap& image)
{ {
auto desiredSize = qMin(width(), height()); // Assume widget is a square auto desiredSize = qMin(width(), height()); // Assume widget is a square

View File

@ -29,6 +29,11 @@ public:
ImagePreviewButton(QWidget* parent = nullptr) ImagePreviewButton(QWidget* parent = nullptr)
: QPushButton(parent) : QPushButton(parent)
{} {}
~ImagePreviewButton();
ImagePreviewButton(const ImagePreviewButton&) = delete;
ImagePreviewButton& operator=(const ImagePreviewButton&) = delete;
ImagePreviewButton(ImagePreviewButton&&) = delete;
ImagePreviewButton& operator=(ImagePreviewButton&&) = delete;
void setIconFromFile(const QString& filename); void setIconFromFile(const QString& filename);
void setIconFromPixmap(const QPixmap& image); void setIconFromPixmap(const QPixmap& image);

View File

@ -77,11 +77,13 @@ private:
class MockNodeListGenerator : public IBootstrapListGenerator class MockNodeListGenerator : public IBootstrapListGenerator
{ {
QList<DhtServer> getBootstrapnodes() { QList<DhtServer> getBootstrapnodes();
return BootstrapNodeUpdater::loadDefaultBootstrapNodes();
}
}; };
QList<DhtServer> MockNodeListGenerator::getBootstrapnodes() {
return BootstrapNodeUpdater::loadDefaultBootstrapNodes();
}
class TestCore : public QObject class TestCore : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mockcoreidhandler.h"
MockCoreIdHandler::~MockCoreIdHandler() = default;

View File

@ -26,6 +26,13 @@
class MockCoreIdHandler : public ICoreIdHandler class MockCoreIdHandler : public ICoreIdHandler
{ {
public: public:
MockCoreIdHandler() = default;
virtual ~MockCoreIdHandler();
MockCoreIdHandler(const MockCoreIdHandler&) = default;
MockCoreIdHandler& operator=(const MockCoreIdHandler&) = default;
MockCoreIdHandler(MockCoreIdHandler&&) = default;
MockCoreIdHandler& operator=(MockCoreIdHandler&&) = default;
ToxId getSelfId() const override ToxId getSelfId() const override
{ {
std::terminate(); std::terminate();

View File

@ -0,0 +1,22 @@
/*
Copyright © 2021 by The qTox Project Contributors
This file is part of qTox, a Qt-based graphical interface for Tox.
qTox is libre software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
qTox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY 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 qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mockgroupquery.h"
MockGroupQuery::~MockGroupQuery() = default;

View File

@ -29,6 +29,13 @@
class MockGroupQuery : public ICoreGroupQuery class MockGroupQuery : public ICoreGroupQuery
{ {
public: public:
MockGroupQuery() = default;
virtual ~MockGroupQuery();
MockGroupQuery(const MockGroupQuery&) = default;
MockGroupQuery& operator=(const MockGroupQuery&) = default;
MockGroupQuery(MockGroupQuery&&) = default;
MockGroupQuery& operator=(MockGroupQuery&&) = default;
GroupId getGroupPersistentId(uint32_t groupNumber) const override GroupId getGroupPersistentId(uint32_t groupNumber) const override
{ {
return GroupId(0); return GroupId(0);

View File

@ -40,17 +40,9 @@ public:
, currentReceiptId(currentReceiptId) , currentReceiptId(currentReceiptId)
{} {}
uint64_t addExtendedMessage(QString message) override uint64_t addExtendedMessage(QString message) override;
{
this->message = message;
return currentReceiptId++;
}
bool send() override bool send() override;
{
numSentMessages++;
return true;
}
uint64_t& numSentMessages; uint64_t& numSentMessages;
uint64_t& currentReceiptId; uint64_t& currentReceiptId;
@ -58,46 +50,65 @@ public:
QString message; QString message;
}; };
uint64_t MockCoreExtPacket::addExtendedMessage(QString message)
{
this->message = message;
return currentReceiptId++;
}
bool MockCoreExtPacket::send()
{
numSentMessages++;
return true;
}
class MockCoreExtPacketAllocator : public ICoreExtPacketAllocator class MockCoreExtPacketAllocator : public ICoreExtPacketAllocator
{ {
public: public:
std::unique_ptr<ICoreExtPacket> getPacket(uint32_t friendId) override std::unique_ptr<ICoreExtPacket> getPacket(uint32_t friendId) override;
{
return std::unique_ptr<MockCoreExtPacket>(new MockCoreExtPacket(numSentMessages, currentReceiptId));
}
uint64_t numSentMessages; uint64_t numSentMessages;
uint64_t currentReceiptId; uint64_t currentReceiptId;
}; };
std::unique_ptr<ICoreExtPacket> MockCoreExtPacketAllocator::getPacket(uint32_t friendId)
{
return std::unique_ptr<MockCoreExtPacket>(new MockCoreExtPacket(numSentMessages, currentReceiptId));
}
class MockFriendMessageSender : public ICoreFriendMessageSender class MockFriendMessageSender : public ICoreFriendMessageSender
{ {
public: public:
bool sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt) override bool sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt) override;
{
if (canSend) {
numSentActions++;
receipt = receiptNum;
receiptNum.get() += 1;
}
return canSend;
}
bool sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt) override bool sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt) override;
{
if (canSend) {
numSentMessages++;
receipt = receiptNum;
receiptNum.get() += 1;
}
return canSend;
}
bool canSend = true; bool canSend = true;
ReceiptNum receiptNum{0}; ReceiptNum receiptNum{0};
size_t numSentActions = 0; size_t numSentActions = 0;
size_t numSentMessages = 0; size_t numSentMessages = 0;
}; };
bool MockFriendMessageSender::sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt)
{
if (canSend) {
numSentActions++;
receipt = receiptNum;
receiptNum.get() += 1;
}
return canSend;
}
bool MockFriendMessageSender::sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt)
{
if (canSend) {
numSentMessages++;
receipt = receiptNum;
receiptNum.get() += 1;
}
return canSend;
}
class TestFriendMessageDispatcher : public QObject class TestFriendMessageDispatcher : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -36,37 +36,45 @@
class MockGroupMessageSender : public ICoreGroupMessageSender class MockGroupMessageSender : public ICoreGroupMessageSender
{ {
public: public:
void sendGroupAction(int groupId, const QString& action) override void sendGroupAction(int groupId, const QString& action) override;
{
numSentActions++;
}
void sendGroupMessage(int groupId, const QString& message) override void sendGroupMessage(int groupId, const QString& message) override;
{
numSentMessages++;
}
size_t numSentActions = 0; size_t numSentActions = 0;
size_t numSentMessages = 0; size_t numSentMessages = 0;
}; };
void MockGroupMessageSender::sendGroupAction(int groupId, const QString& action)
{
numSentActions++;
}
void MockGroupMessageSender::sendGroupMessage(int groupId, const QString& message)
{
numSentMessages++;
}
class MockGroupSettings : public IGroupSettings class MockGroupSettings : public IGroupSettings
{ {
public: public:
QStringList getBlackList() const override QStringList getBlackList() const override;
{
return blacklist;
}
void setBlackList(const QStringList& blist) override void setBlackList(const QStringList& blist) override;
{
blacklist = blist;
}
private: private:
QStringList blacklist; QStringList blacklist;
}; };
QStringList MockGroupSettings::getBlackList() const
{
return blacklist;
}
void MockGroupSettings::setBlackList(const QStringList& blist)
{
blacklist = blist;
}
class TestGroupMessageDispatcher : public QObject class TestGroupMessageDispatcher : public QObject
{ {
Q_OBJECT Q_OBJECT