Merge pull request #26362 from ksooo/estuary-rework-pvr-info-dialog
[xbmc.git] / xbmc / utils / test / TestGPUInfo.cpp
blob495bc0cc2427ec2381a9405554a8cd6e39a111d1
1 /*
2 * Copyright (C) 2023 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "ServiceBroker.h"
10 #include "settings/AdvancedSettings.h"
11 #include "settings/SettingsComponent.h"
12 #include "utils/GpuInfo.h"
14 #include <memory>
16 #include <gtest/gtest.h>
18 class TestGPUInfo : public ::testing::Test
20 protected:
21 TestGPUInfo() = default;
24 #if defined(TARGET_WINDOWS)
25 TEST_F(TestGPUInfo, DISABLED_GetTemperatureFromCmd)
26 #else
27 TEST_F(TestGPUInfo, GetTemperatureFromCmd)
28 #endif
30 CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_gpuTempCmd = "echo '50 c'";
31 std::unique_ptr<CGPUInfo> gpuInfo = CGPUInfo::GetGPUInfo();
32 EXPECT_NE(gpuInfo, nullptr);
33 CTemperature t;
34 bool success = gpuInfo->GetTemperature(t);
35 EXPECT_TRUE(success);
36 EXPECT_TRUE(t.IsValid());
37 EXPECT_EQ(t.ToCelsius(), 50);