From 92fc8f2d98f6fa99ed265e7483772275484a783a Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 10 May 2021 12:12:11 +0300 Subject: [PATCH] Tests: StatTest: Setup resources for DB migrations. --- src/tests/StatTest/tst_main.cpp | 4 ++++ src/ui/fortmanager.cpp | 10 ++++++++++ src/ui/fortmanager.h | 2 ++ src/ui_bin/main.cpp | 12 +----------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/tests/StatTest/tst_main.cpp b/src/tests/StatTest/tst_main.cpp index 441995bc..7b1f6bcb 100644 --- a/src/tests/StatTest/tst_main.cpp +++ b/src/tests/StatTest/tst_main.cpp @@ -5,6 +5,8 @@ #include #include +#include + int main(int argc, char *argv[]) { ::testing::InitGoogleTest(&argc, argv); @@ -12,5 +14,7 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); + FortManager::setupResources(); + return RUN_ALL_TESTS(); } diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index 1bb17007..60488925 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -785,3 +785,13 @@ void FortManager::activateModalWidget() w->activateWindow(); } } + +void FortManager::setupResources() +{ + Q_INIT_RESOURCE(appinfo_migrations); + Q_INIT_RESOURCE(conf_migrations); + Q_INIT_RESOURCE(conf_zone); + Q_INIT_RESOURCE(stat_migrations); + + Q_INIT_RESOURCE(fort_icons); +} diff --git a/src/ui/fortmanager.h b/src/ui/fortmanager.h index 2b4c9313..a9a44912 100644 --- a/src/ui/fortmanager.h +++ b/src/ui/fortmanager.h @@ -127,6 +127,8 @@ public slots: bool showYesNoBox(const QString &text, const QString &yesText, const QString &noText, const QString &title = QString()); + static void setupResources(); + private: void setupThreadPool(); diff --git a/src/ui_bin/main.cpp b/src/ui_bin/main.cpp index 3baf303c..e09eada2 100644 --- a/src/ui_bin/main.cpp +++ b/src/ui_bin/main.cpp @@ -28,16 +28,6 @@ static void uninstall() DriverCommon::provUnregister(); // Unregister booted provider } -static void setupResources() -{ - Q_INIT_RESOURCE(appinfo_migrations); - Q_INIT_RESOURCE(conf_migrations); - Q_INIT_RESOURCE(conf_zone); - Q_INIT_RESOURCE(stat_migrations); - - Q_INIT_RESOURCE(fort_icons); -} - static void setupAppStyle() { const auto fusionStyle = QStyleFactory::create("Fusion"); @@ -81,7 +71,7 @@ int main(int argc, char *argv[]) return controlManager.postCommand() ? 0 : FORT_ERROR_CONTROL; } - setupResources(); + FortManager::setupResources(); FortManager fortManager(&settings, &envManager, &controlManager);