diff options
author | Miguel Borges de Freitas <92enen@gmail.com> | 2023-09-10 11:31:05 +0100 |
---|---|---|
committer | Miguel Borges de Freitas <92enen@gmail.com> | 2023-09-10 17:45:31 +0100 |
commit | 4688f74bf79f7e8ddf0960e22ddbfc0579a48d87 (patch) | |
tree | 316614bd6b0c5cbeb7ffb7bb4506d67741cea690 | |
parent | dc5a21395db374af99366aa66aee39981e8f8072 (diff) |
[tests][gpuinfo] Add posix unit test for advanced setting
-rw-r--r-- | xbmc/utils/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | xbmc/utils/test/TestGPUInfo.cpp | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/xbmc/utils/test/CMakeLists.txt b/xbmc/utils/test/CMakeLists.txt index 5cff468669..0ce2a6fafe 100644 --- a/xbmc/utils/test/CMakeLists.txt +++ b/xbmc/utils/test/CMakeLists.txt @@ -14,6 +14,7 @@ set(SOURCES TestAlarmClock.cpp TestFileOperationJob.cpp TestFileUtils.cpp TestGlobalsHandling.cpp + TestGPUInfo.cpp TestHTMLUtil.cpp TestHttpHeader.cpp TestHttpParser.cpp diff --git a/xbmc/utils/test/TestGPUInfo.cpp b/xbmc/utils/test/TestGPUInfo.cpp new file mode 100644 index 0000000000..ce3d4a6d79 --- /dev/null +++ b/xbmc/utils/test/TestGPUInfo.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#include "ServiceBroker.h" +#include "settings/AdvancedSettings.h" +#include "settings/SettingsComponent.h" +#include "utils/GpuInfo.h" + +#include <memory> + +#include <gtest/gtest.h> + +class TestGPUInfo : public ::testing::Test +{ +protected: + TestGPUInfo() = default; +}; + +#if defined(TARGET_WINDOWS) +TEST_F(TestGPUInfo, DISABLED_GetTemperatureFromCmd) +#else +TEST_F(TestGPUInfo, GetTemperature) +#endif +{ + CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_gpuTempCmd = "echo '50 c'"; + std::unique_ptr<CGPUInfo> gpuInfo = CGPUInfo::GetGPUInfo(); + EXPECT_NE(gpuInfo, nullptr); + CTemperature t; + bool success = gpuInfo->GetTemperature(t); + EXPECT_TRUE(t.IsValid()); + EXPECT_EQ(t.ToCelsius(), 50); +} |