diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-11-27 00:40:02 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-11-27 00:40:02 +0100 |
commit | ef73a2bd322c7df43922cd4b4ed4f49440b1b92f (patch) | |
tree | 657210493a6dd88fed4288e86050bc576fe4e17a | |
parent | 5994c47d7c6845c71c9c37bf30e9511914a017f4 (diff) | |
download | MultiMC-ef73a2bd322c7df43922cd4b4ed4f49440b1b92f.tar MultiMC-ef73a2bd322c7df43922cd4b4ed4f49440b1b92f.tar.gz MultiMC-ef73a2bd322c7df43922cd4b4ed4f49440b1b92f.tar.lz MultiMC-ef73a2bd322c7df43922cd4b4ed4f49440b1b92f.tar.xz MultiMC-ef73a2bd322c7df43922cd4b4ed4f49440b1b92f.zip |
NOISSUE fix Windows kernel numbers and add unit test for them
-rw-r--r-- | libraries/ganalytics/CMakeLists.txt | 6 | ||||
-rw-r--r-- | libraries/ganalytics/src/sys_test.cpp | 22 | ||||
-rw-r--r-- | libraries/ganalytics/src/sys_win32.cpp | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/libraries/ganalytics/CMakeLists.txt b/libraries/ganalytics/CMakeLists.txt index 1f2ff4e2..9d218c6d 100644 --- a/libraries/ganalytics/CMakeLists.txt +++ b/libraries/ganalytics/CMakeLists.txt @@ -25,3 +25,9 @@ endif() add_library(ganalytics STATIC ${ganalytics_SOURCES}) qt5_use_modules(ganalytics Core Gui Network) target_include_directories(ganalytics PUBLIC include) + +include (UnitTest) +add_unit_test(sys + SOURCES src/sys_test.cpp + LIBS ganalytics +) diff --git a/libraries/ganalytics/src/sys_test.cpp b/libraries/ganalytics/src/sys_test.cpp new file mode 100644 index 00000000..6221da45 --- /dev/null +++ b/libraries/ganalytics/src/sys_test.cpp @@ -0,0 +1,22 @@ +#include <QTest> +#include "TestUtil.h" + +#include <sys.h> + +class SysTest : public QObject +{ + Q_OBJECT +private +slots: + + void test_kernelNotNull() + { + auto kinfo = Sys::getKernelInfo(); + QVERIFY(!kinfo.kernelName.isEmpty()); + QVERIFY(kinfo.kernelVersion != "0.0"); + } +}; + +QTEST_GUILESS_MAIN(SysTest) + +#include "sys_test.moc" diff --git a/libraries/ganalytics/src/sys_win32.cpp b/libraries/ganalytics/src/sys_win32.cpp index 4d43169b..502b980d 100644 --- a/libraries/ganalytics/src/sys_win32.cpp +++ b/libraries/ganalytics/src/sys_win32.cpp @@ -8,6 +8,7 @@ Sys::KernelInfo Sys::getKernelInfo() out.kernelName = "Windows"; OSVERSIONINFOW osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFOW)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&osvi); out.kernelVersion = QString("%1.%2").arg(osvi.dwMajorVersion).arg(osvi.dwMinorVersion); return out; |