Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't initialize GIFTimer in tests #5608

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
- 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: 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

Expand Down
38 changes: 38 additions & 0 deletions mocks/include/mocks/Emotes.hpp
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions tests/src/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include "controllers/commands/CommandController.hpp"
#include "controllers/commands/common/ChannelAction.hpp"
#include "mocks/BaseApplication.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Helix.hpp"
#include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Settings.hpp"
#include "Test.hpp"

Expand Down Expand Up @@ -59,7 +59,7 @@ class MockApplication : public mock::BaseApplication
AccountController accounts;
CommandController commands;
mock::MockTwitchIrcServer twitch;
Emotes emotes;
mock::Emotes emotes;
};

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions tests/src/Filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
#include "mocks/BaseApplication.hpp"
#include "mocks/Channel.hpp"
#include "mocks/ChatterinoBadges.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/EmptyApplication.hpp"
#include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp"
#include "mocks/UserData.hpp"
#include "providers/ffz/FfzBadges.hpp"
#include "providers/seventv/SeventvBadges.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Emotes.hpp"
#include "Test.hpp"

#include <QColor>
Expand Down Expand Up @@ -81,7 +81,7 @@ class MockApplication : public mock::BaseApplication

mock::EmptyLogging logging;
AccountController accounts;
Emotes emotes;
mock::Emotes emotes;
mock::UserDataController userData;
mock::MockTwitchIrcServer twitch;
mock::ChatterinoBadges chatterinoBadges;
Expand Down
3 changes: 2 additions & 1 deletion tests/src/InputCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "messages/Emote.hpp"
#include "mocks/BaseApplication.hpp"
#include "mocks/Channel.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Helix.hpp"
#include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp"
Expand Down Expand Up @@ -79,7 +80,7 @@ class MockApplication : public mock::BaseApplication
mock::EmptyLogging logging;
AccountController accounts;
mock::MockTwitchIrcServer twitch;
Emotes emotes;
mock::Emotes emotes;
BttvEmotes bttvEmotes;
FfzEmotes ffzEmotes;
SeventvEmotes seventvEmotes;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#include "mocks/Channel.hpp"
#include "mocks/ChatterinoBadges.hpp"
#include "mocks/DisabledStreamerMode.hpp"
#include "mocks/Emotes.hpp"
#include "mocks/Logging.hpp"
#include "mocks/TwitchIrcServer.hpp"
#include "mocks/UserData.hpp"
#include "providers/ffz/FfzBadges.hpp"
#include "providers/seventv/SeventvBadges.hpp"
#include "providers/twitch/TwitchBadge.hpp"
#include "singletons/Emotes.hpp"
#include "Test.hpp"
#include "util/IrcHelpers.hpp"

Expand Down Expand Up @@ -99,7 +99,7 @@ class MockApplication : public mock::BaseApplication

mock::EmptyLogging logging;
AccountController accounts;
Emotes emotes;
mock::Emotes emotes;
mock::UserDataController userData;
mock::MockTwitchIrcServer twitch;
mock::ChatterinoBadges chatterinoBadges;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/ModerationAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "messages/Image.hpp"
#include "mocks/BaseApplication.hpp"
#include "singletons/Emotes.hpp"
#include "mocks/Emotes.hpp"
#include "singletons/Resources.hpp"
#include "Test.hpp"

Expand All @@ -24,7 +24,7 @@ class MockApplication : public mock::BaseApplication
return &this->emotes;
}

Emotes emotes;
mock::Emotes emotes;
};

class ModerationActionTest : public ::testing::Test
Expand Down
4 changes: 2 additions & 2 deletions tests/src/SplitInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "mocks/BaseApplication.hpp"
#include "singletons/Emotes.hpp"
#include "mocks/Emotes.hpp"
#include "singletons/Fonts.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
Expand Down Expand Up @@ -62,7 +62,7 @@ class MockApplication : public mock::BaseApplication
WindowManager windowManager;
AccountController accounts;
CommandController commands;
Emotes emotes;
mocks::Emotes emotes;
Nerixyz marked this conversation as resolved.
Show resolved Hide resolved
};

class SplitInputTest
Expand Down
Loading