From 4d760b9776f6694c3952858cd03a81ac371d9ef1 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 17 Jul 2023 14:20:35 +0300 Subject: [PATCH] Tests: Fix tests --- src/tests/StatTest/tst_stat.h | 9 +++++++-- src/tests/UtilTest/tst_confutil.h | 2 +- src/ui/stat/statmanager.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tests/StatTest/tst_stat.h b/src/tests/StatTest/tst_stat.h index 97836ef7..d3b1e3c7 100644 --- a/src/tests/StatTest/tst_stat.h +++ b/src/tests/StatTest/tst_stat.h @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -99,9 +100,13 @@ void debugStatTraf(SqliteDb *sqliteDb) TEST_F(StatTest, dbWriteRead) { - NiceMock quotaManager; + IocContainer ioc; + ioc.pinToThread(); - StatManager statManager(":memory:", "aManager); + NiceMock quotaManager; + ioc.set(quotaManager); + + StatManager statManager(":memory:"); statManager.setUp(); diff --git a/src/tests/UtilTest/tst_confutil.h b/src/tests/UtilTest/tst_confutil.h index a71932d5..7b4c85fc 100644 --- a/src/tests/UtilTest/tst_confutil.h +++ b/src/tests/UtilTest/tst_confutil.h @@ -92,7 +92,7 @@ TEST_F(ConfUtilTest, confWriteRead) ASSERT_TRUE(DriverCommon::confAppBlocked( data, DriverCommon::confAppFind(data, "System"), &blockReason)); - ASSERT_EQ(blockReason, FORT_BLOCK_REASON_FILTER_MODE); + ASSERT_EQ(blockReason, FORT_BLOCK_REASON_APP_GROUP_FOUND); ASSERT_FALSE(DriverCommon::confAppBlocked(data, DriverCommon::confAppFind( diff --git a/src/ui/stat/statmanager.cpp b/src/ui/stat/statmanager.cpp index f907b094..5d932448 100644 --- a/src/ui/stat/statmanager.cpp +++ b/src/ui/stat/statmanager.cpp @@ -128,7 +128,7 @@ void StatManager::updateActivePeriod() m_isActivePeriodSet = true; m_isActivePeriod = true; - if (conf()->activePeriodEnabled()) { + if (conf() && conf()->activePeriodEnabled()) { const QTime now = QTime::currentTime(); m_isActivePeriod = DriverCommon::isTimeInPeriod(quint8(now.hour()),