refactor: some more Application refactors (#5551)

This commit is contained in:
pajlada
2024-08-25 13:04:48 +02:00
committed by GitHub
parent f4d6845587
commit 3e510fd9e9
14 changed files with 199 additions and 169 deletions
+2 -16
View File
@@ -21,26 +21,14 @@ using namespace chatterino;
namespace {
class MockApplication : mock::BaseApplication
class MockApplication : public mock::BaseApplication
{
public:
MockApplication()
: theme(this->paths_)
, fonts(this->settings)
, windowManager(this->paths_)
: windowManager(this->paths_, this->settings, this->theme, this->fonts)
{
}
Theme *getThemes() override
{
return &this->theme;
}
Fonts *getFonts() override
{
return &this->fonts;
}
WindowManager *getWindows() override
{
return &this->windowManager;
@@ -52,8 +40,6 @@ public:
}
AccountController accounts;
Theme theme;
Fonts fonts;
WindowManager windowManager;
};
+2 -15
View File
@@ -17,32 +17,19 @@ using namespace chatterino;
namespace {
class MockApplication : mock::BaseApplication
class MockApplication : public mock::BaseApplication
{
public:
MockApplication()
: theme(this->paths_)
, fonts(this->settings)
, windowManager(this->paths_)
: windowManager(this->paths_, this->settings, this->theme, this->fonts)
{
}
Theme *getThemes() override
{
return &this->theme;
}
Fonts *getFonts() override
{
return &this->fonts;
}
WindowManager *getWindows() override
{
return &this->windowManager;
}
Theme theme;
Fonts fonts;
WindowManager windowManager;
};
+4 -4
View File
@@ -28,16 +28,16 @@ TEST(SeventvEventAPI, AllEvents)
std::optional<EmoteRemoveDispatch> removeDispatch;
std::optional<UserConnectionUpdateDispatch> userDispatch;
eventAPI.signals_.emoteAdded.connect([&](const auto &d) {
std::ignore = eventAPI.signals_.emoteAdded.connect([&](const auto &d) {
addDispatch = d;
});
eventAPI.signals_.emoteUpdated.connect([&](const auto &d) {
std::ignore = eventAPI.signals_.emoteUpdated.connect([&](const auto &d) {
updateDispatch = d;
});
eventAPI.signals_.emoteRemoved.connect([&](const auto &d) {
std::ignore = eventAPI.signals_.emoteRemoved.connect([&](const auto &d) {
removeDispatch = d;
});
eventAPI.signals_.userUpdated.connect([&](const auto &d) {
std::ignore = eventAPI.signals_.userUpdated.connect([&](const auto &d) {
userDispatch = d;
});
+1 -14
View File
@@ -28,27 +28,16 @@ class MockApplication : public mock::BaseApplication
{
public:
MockApplication()
: theme(this->paths_)
, fonts(this->settings)
, windowManager(this->paths_)
: windowManager(this->paths_, this->settings, this->theme, this->fonts)
, commands(this->paths_)
{
}
Theme *getThemes() override
{
return &this->theme;
}
HotkeyController *getHotkeys() override
{
return &this->hotkeys;
}
Fonts *getFonts() override
{
return &this->fonts;
}
WindowManager *getWindows() override
{
return &this->windowManager;
@@ -69,9 +58,7 @@ public:
return &this->emotes;
}
Theme theme;
HotkeyController hotkeys;
Fonts fonts;
WindowManager windowManager;
AccountController accounts;
CommandController commands;