fix: don't initialize GIFTimer in tests (#5608)

This commit is contained in:
nerix 2024-09-29 14:05:28 +02:00 committed by GitHub
parent ef3c51a4e2
commit 0db477665c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 53 additions and 13 deletions

View file

@ -94,6 +94,7 @@
- Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594) - Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594)
- Dev: The JSON output when copying a message (<kbd>SHIFT</kbd> + right-click) is now more extensive. (#5600) - Dev: The JSON output when copying a message (<kbd>SHIFT</kbd> + right-click) is now more extensive. (#5600)
- Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607) - Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607)
- Dev: `GIFTimer` is no longer initialized in tests. (#5608)
## 2.5.1 ## 2.5.1

View file

@ -4,6 +4,7 @@
#include "messages/Emote.hpp" #include "messages/Emote.hpp"
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "mocks/DisabledStreamerMode.hpp" #include "mocks/DisabledStreamerMode.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/LinkResolver.hpp" #include "mocks/LinkResolver.hpp"
#include "mocks/TwitchIrcServer.hpp" #include "mocks/TwitchIrcServer.hpp"
#include "mocks/UserData.hpp" #include "mocks/UserData.hpp"
@ -16,7 +17,6 @@
#include "providers/seventv/SeventvEmotes.hpp" #include "providers/seventv/SeventvEmotes.hpp"
#include "providers/twitch/TwitchBadges.hpp" #include "providers/twitch/TwitchBadges.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include <benchmark/benchmark.h> #include <benchmark/benchmark.h>
@ -111,7 +111,7 @@ public:
} }
AccountController accounts; AccountController accounts;
Emotes emotes; mock::Emotes emotes;
mock::UserDataController userData; mock::UserDataController userData;
mock::MockTwitchIrcServer twitch; mock::MockTwitchIrcServer twitch;
mock::EmptyLinkResolver linkResolver; mock::EmptyLinkResolver linkResolver;

View file

@ -0,0 +1,38 @@
#pragma once
#include "singletons/Emotes.hpp"
namespace chatterino::mock {
class Emotes : public IEmotes
{
public:
Emotes()
{
this->emojis.load();
// don't initialize GIFTimer
}
ITwitchEmotes *getTwitchEmotes() override
{
return &this->twitch;
}
IEmojis *getEmojis() override
{
return &this->emojis;
}
GIFTimer &getGIFTimer() override
{
return this->gifTimer;
}
private:
TwitchEmotes twitch;
Emojis emojis;
GIFTimer gifTimer;
};
} // namespace chatterino::mock

View file

@ -4,12 +4,12 @@
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "controllers/commands/common/ChannelAction.hpp" #include "controllers/commands/common/ChannelAction.hpp"
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Helix.hpp" #include "mocks/Helix.hpp"
#include "mocks/Logging.hpp" #include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp" #include "mocks/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "Test.hpp" #include "Test.hpp"
@ -59,7 +59,7 @@ public:
AccountController accounts; AccountController accounts;
CommandController commands; CommandController commands;
mock::MockTwitchIrcServer twitch; mock::MockTwitchIrcServer twitch;
Emotes emotes; mock::Emotes emotes;
}; };
} // namespace } // namespace

View file

@ -7,6 +7,7 @@
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "mocks/Channel.hpp" #include "mocks/Channel.hpp"
#include "mocks/ChatterinoBadges.hpp" #include "mocks/ChatterinoBadges.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/EmptyApplication.hpp" #include "mocks/EmptyApplication.hpp"
#include "mocks/Logging.hpp" #include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp" #include "mocks/TwitchIrcServer.hpp"
@ -14,7 +15,6 @@
#include "providers/ffz/FfzBadges.hpp" #include "providers/ffz/FfzBadges.hpp"
#include "providers/seventv/SeventvBadges.hpp" #include "providers/seventv/SeventvBadges.hpp"
#include "providers/twitch/TwitchBadge.hpp" #include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Emotes.hpp"
#include "Test.hpp" #include "Test.hpp"
#include <QColor> #include <QColor>
@ -81,7 +81,7 @@ public:
mock::EmptyLogging logging; mock::EmptyLogging logging;
AccountController accounts; AccountController accounts;
Emotes emotes; mock::Emotes emotes;
mock::UserDataController userData; mock::UserDataController userData;
mock::MockTwitchIrcServer twitch; mock::MockTwitchIrcServer twitch;
mock::ChatterinoBadges chatterinoBadges; mock::ChatterinoBadges chatterinoBadges;

View file

@ -8,6 +8,7 @@
#include "messages/Emote.hpp" #include "messages/Emote.hpp"
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "mocks/Channel.hpp" #include "mocks/Channel.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Helix.hpp" #include "mocks/Helix.hpp"
#include "mocks/Logging.hpp" #include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp" #include "mocks/TwitchIrcServer.hpp"
@ -79,7 +80,7 @@ public:
mock::EmptyLogging logging; mock::EmptyLogging logging;
AccountController accounts; AccountController accounts;
mock::MockTwitchIrcServer twitch; mock::MockTwitchIrcServer twitch;
Emotes emotes; mock::Emotes emotes;
BttvEmotes bttvEmotes; BttvEmotes bttvEmotes;
FfzEmotes ffzEmotes; FfzEmotes ffzEmotes;
SeventvEmotes seventvEmotes; SeventvEmotes seventvEmotes;

View file

@ -7,13 +7,13 @@
#include "mocks/Channel.hpp" #include "mocks/Channel.hpp"
#include "mocks/ChatterinoBadges.hpp" #include "mocks/ChatterinoBadges.hpp"
#include "mocks/DisabledStreamerMode.hpp" #include "mocks/DisabledStreamerMode.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Logging.hpp" #include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp" #include "mocks/TwitchIrcServer.hpp"
#include "mocks/UserData.hpp" #include "mocks/UserData.hpp"
#include "providers/ffz/FfzBadges.hpp" #include "providers/ffz/FfzBadges.hpp"
#include "providers/seventv/SeventvBadges.hpp" #include "providers/seventv/SeventvBadges.hpp"
#include "providers/twitch/TwitchBadge.hpp" #include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Emotes.hpp"
#include "Test.hpp" #include "Test.hpp"
#include "util/IrcHelpers.hpp" #include "util/IrcHelpers.hpp"
@ -99,7 +99,7 @@ public:
mock::EmptyLogging logging; mock::EmptyLogging logging;
AccountController accounts; AccountController accounts;
Emotes emotes; mock::Emotes emotes;
mock::UserDataController userData; mock::UserDataController userData;
mock::MockTwitchIrcServer twitch; mock::MockTwitchIrcServer twitch;
mock::ChatterinoBadges chatterinoBadges; mock::ChatterinoBadges chatterinoBadges;

View file

@ -2,7 +2,7 @@
#include "messages/Image.hpp" #include "messages/Image.hpp"
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "singletons/Emotes.hpp" #include "mocks/Emotes.hpp"
#include "singletons/Resources.hpp" #include "singletons/Resources.hpp"
#include "Test.hpp" #include "Test.hpp"
@ -24,7 +24,7 @@ public:
return &this->emotes; return &this->emotes;
} }
Emotes emotes; mock::Emotes emotes;
}; };
class ModerationActionTest : public ::testing::Test class ModerationActionTest : public ::testing::Test

View file

@ -6,7 +6,7 @@
#include "controllers/commands/CommandController.hpp" #include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp" #include "controllers/hotkeys/HotkeyController.hpp"
#include "mocks/BaseApplication.hpp" #include "mocks/BaseApplication.hpp"
#include "singletons/Emotes.hpp" #include "mocks/Emotes.hpp"
#include "singletons/Fonts.hpp" #include "singletons/Fonts.hpp"
#include "singletons/Paths.hpp" #include "singletons/Paths.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
@ -62,7 +62,7 @@ public:
WindowManager windowManager; WindowManager windowManager;
AccountController accounts; AccountController accounts;
CommandController commands; CommandController commands;
Emotes emotes; mock::Emotes emotes;
}; };
class SplitInputTest class SplitInputTest