NOISSUE fix Windows kernel numbers and add unit test for them
This commit is contained in:
parent
5994c47d7c
commit
ef73a2bd32
@ -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
|
||||
)
|
||||
|
22
libraries/ganalytics/src/sys_test.cpp
Normal file
22
libraries/ganalytics/src/sys_test.cpp
Normal file
@ -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"
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user