diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 25b116d8e..9edcc8853 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -218,7 +218,7 @@ add_unit_test(NAME testdatabase SOURCES TestDatabase.cpp LIBS testsupport ${TEST_LIBRARIES}) add_unit_test(NAME testtools SOURCES TestTools.cpp - LIBS ${TEST_LIBRARIES}) + LIBS testsupport ${TEST_LIBRARIES}) add_unit_test(NAME testconfig SOURCES TestConfig.cpp LIBS testsupport ${TEST_LIBRARIES}) diff --git a/tests/TestTools.cpp b/tests/TestTools.cpp index 3455e97c8..3d59399e0 100644 --- a/tests/TestTools.cpp +++ b/tests/TestTools.cpp @@ -19,6 +19,7 @@ #include "core/Clock.h" #include "core/Tools.h" +#include "mock/MockClock.h" #include #include @@ -33,8 +34,23 @@ namespace { return wholes + QLocale().decimalPoint() + fractions + " " + unit; } + + MockClock* s_clock = nullptr; } // namespace +void TestTools::initTestCase() +{ + Q_ASSERT(s_clock == nullptr); + s_clock = new MockClock(2026, 3, 8, 21, 45, 05); + MockClock::setup(s_clock); +} + +void TestTools::cleanupTestCase() +{ + MockClock::teardown(); + s_clock = nullptr; +} + void TestTools::testHumanReadableFileSize() { constexpr auto kibibyte = 1024u; diff --git a/tests/TestTools.h b/tests/TestTools.h index dc17f5b13..a540fd499 100644 --- a/tests/TestTools.h +++ b/tests/TestTools.h @@ -24,6 +24,8 @@ class TestTools : public QObject { Q_OBJECT private slots: + void initTestCase(); + void cleanupTestCase(); void testHumanReadableFileSize(); void testIsHex(); void testIsBase64();