Move mocks to their own interface (#4645)
This commit is contained in:
@@ -15,6 +15,7 @@ add_executable(${PROJECT_NAME} ${benchmark_SOURCES})
|
||||
add_sanitizers(${PROJECT_NAME})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-lib)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE chatterino-mocks)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE benchmark::benchmark)
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "common/Channel.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "controllers/highlights/HighlightController.hpp"
|
||||
#include "controllers/highlights/HighlightPhrase.hpp"
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/SharedMessageBuilder.hpp"
|
||||
#include "mocks/EmptyApplication.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
|
||||
#include <benchmark/benchmark.h>
|
||||
@@ -45,65 +46,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class MockApplication : IApplication
|
||||
class MockApplication : mock::EmptyApplication
|
||||
{
|
||||
public:
|
||||
Theme *getThemes() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
Fonts *getFonts() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
IEmotes *getEmotes() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
AccountController *getAccounts() override
|
||||
{
|
||||
return &this->accounts;
|
||||
}
|
||||
HotkeyController *getHotkeys() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
WindowManager *getWindows() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
Toasts *getToasts() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
CommandController *getCommands() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
NotificationController *getNotifications() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
HighlightController *getHighlights() override
|
||||
{
|
||||
return &this->highlights;
|
||||
}
|
||||
TwitchIrcServer *getTwitch() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
ChatterinoBadges *getChatterinoBadges() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
FfzBadges *getFfzBadges() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
IUserDataController *getUserData() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AccountController accounts;
|
||||
HighlightController highlights;
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
#include "singletons/Settings.hpp"
|
||||
|
||||
#include <benchmark/benchmark.h>
|
||||
#include <QApplication>
|
||||
#include <QtConcurrent>
|
||||
|
||||
using namespace chatterino;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
::benchmark::Initialize(&argc, argv);
|
||||
|
||||
// Ensure settings are initialized before any tests are run
|
||||
chatterino::Settings settings("/tmp/c2-empty-test");
|
||||
|
||||
QtConcurrent::run([&app] {
|
||||
::benchmark::RunSpecifiedBenchmarks();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user