Bug 1826040 - Add ", or similar" to sanitized RENDERER strings. r=gfx-reviewers,lsalzman
[gecko.git] / dom / canvas / gtest / TestSanitizeRenderer.cpp
blob9a6aba565f5be220058f481f203c6a2a597c35a7
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "gtest/gtest.h"
8 namespace mozilla::webgl {
9 std::string SanitizeRenderer(const std::string&);
10 } // namespace mozilla::webgl
12 TEST(SanitizeRenderer, TestLinuxRadeon)
14 const std::string renderer(
15 "AMD Radeon RX 5700 (NAVI10, DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0)");
16 const std::string expectation("Radeon R9 200 Series, or similar");
17 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
18 EXPECT_EQ(sanitized, expectation);
21 TEST(SanitizeRenderer, TestLinuxRadeonTM)
23 const std::string renderer(
24 "AMD Radeon (TM) RX 460 Graphics (POLARIS11, DRM 3.35.0, "
25 "5.4.0-65-generic, LLVM 11.0.0)");
26 const std::string expectation("Radeon R9 200 Series, or similar");
27 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
28 EXPECT_EQ(sanitized, expectation);
31 TEST(SanitizeRenderer, TestLinuxRadeonWithoutGeneration)
33 const std::string renderer(
34 "AMD Radeon RX 5700 (DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0)");
35 const std::string expectation("Radeon R9 200 Series, or similar");
36 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
37 EXPECT_EQ(sanitized, expectation);
40 TEST(SanitizeRenderer, TestLinuxRenoir)
42 const std::string renderer(
43 "AMD RENOIR (DRM 3.41.0, 5.13.4-1-default, LLVM 11.1.0)");
44 const std::string expectation("Radeon R9 200 Series, or similar");
45 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
46 EXPECT_EQ(sanitized, expectation);
49 TEST(SanitizeRenderer, TestWindowsVega)
51 const std::string renderer("Radeon RX Vega");
52 const std::string expectation("Radeon R9 200 Series, or similar");
53 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
54 EXPECT_EQ(sanitized, expectation);
57 TEST(SanitizeRenderer, TestMacAmd)
59 const std::string renderer("AMD Radeon Pro 5300M OpenGL Engine");
60 const std::string expectation("Radeon R9 200 Series, or similar");
61 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
62 EXPECT_EQ(sanitized, expectation);
65 TEST(SanitizeRenderer, TestLinuxAruba)
67 const std::string renderer(
68 "AMD ARUBA (DRM 2.50.0 / 5.10.42-calculate, LLVM 12.0.1)");
69 const std::string expectation("Radeon HD 5850, or similar");
70 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
71 EXPECT_EQ(sanitized, expectation);
74 TEST(SanitizeRenderer, TestLinuxIntel620)
76 const std::string renderer("Mesa Intel(R) UHD Graphics 620 (KBL GT2)");
77 const std::string expectation("Intel(R) HD Graphics 400, or similar");
78 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
79 EXPECT_EQ(sanitized, expectation);
81 TEST(SanitizeRenderer, TestLinuxIntel4000)
83 const std::string renderer("Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)");
84 const std::string expectation("Intel(R) HD Graphics, or similar");
85 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
86 EXPECT_EQ(sanitized, expectation);
89 TEST(SanitizeRenderer, TestMacIntel)
91 const std::string renderer("Intel(R) HD Graphics 530");
92 const std::string expectation("Intel(R) HD Graphics 400, or similar");
93 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
94 EXPECT_EQ(sanitized, expectation);
97 TEST(SanitizeRenderer, TestMacApple)
99 const std::string renderer("Apple M1");
100 const std::string expectation("Apple M1, or similar");
101 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
102 EXPECT_EQ(sanitized, expectation);
105 TEST(SanitizeRenderer, TestPipe)
107 const std::string renderer("llvmpipe (LLVM 11.0.0, 128 bits)");
108 const std::string expectation("llvmpipe, or similar");
109 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
110 EXPECT_EQ(sanitized, expectation);
113 // -
115 TEST(SanitizeRenderer, TestAngleVega)
117 const std::string renderer(
118 "ANGLE (AMD, Radeon RX Vega Direct3D11 vs_5_0 ps_5_0, "
119 "D3D11-27.20.22025.1006)");
120 const std::string expectation(
121 "ANGLE (AMD, Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0), or similar");
122 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
123 EXPECT_EQ(sanitized, expectation);
126 TEST(SanitizeRenderer, TestAngleRadeon)
128 const std::string renderer(
129 "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3D11 vs_5_0 ps_5_0, "
130 "D3D11-27.20.1020.2002)");
131 const std::string expectation(
132 "ANGLE (AMD, Radeon HD 3200 Graphics Direct3D11 vs_5_0 ps_5_0), or similar");
133 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
134 EXPECT_EQ(sanitized, expectation);
137 TEST(SanitizeRenderer, TestAngleWarp)
139 const std::string renderer(
140 "ANGLE (Unknown, Microsoft Basic Render Driver Direct3D11 vs_5_0 ps_5_0, "
141 "D3D11-10.0.22000.1)");
142 const std::string expectation =
143 "ANGLE (Unknown, Microsoft Basic Render Driver Direct3D11 vs_5_0 ps_5_0), or similar";
144 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
145 EXPECT_EQ(sanitized, expectation);
148 TEST(SanitizeRenderer, TestAngle3070)
150 const std::string renderer(
151 "ANGLE (NVIDIA, NVIDIA GeForce RTX 3070 Direct3D11 vs_5_0 ps_5_0, "
152 "D3D11-10.0.22000.1)");
153 const std::string expectation(
154 "ANGLE (NVIDIA, NVIDIA GeForce GTX 980 Direct3D11 vs_5_0 ps_5_0), or similar");
155 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
156 EXPECT_EQ(sanitized, expectation);
159 TEST(SanitizeRenderer, TestWindows3070)
161 const std::string renderer("GeForce RTX 3070/PCIe/SSE2");
162 const std::string expectation("GeForce GTX 980/PCIe/SSE2, or similar");
163 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
164 EXPECT_EQ(sanitized, expectation);
167 TEST(SanitizeRenderer, TestAngleK600)
169 const std::string renderer(
170 "ANGLE (NVIDIA, NVIDIA Quadro K600 Direct3D11 vs_5_0 ps_5_0, somethig "
171 "like D3D11-10.0.22000.1)");
172 const std::string expectation(
173 "ANGLE (NVIDIA, NVIDIA GeForce GTX 480 Direct3D11 vs_5_0 ps_5_0), or similar");
174 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
175 EXPECT_EQ(sanitized, expectation);
178 TEST(SanitizeRenderer, TestLinuxK600)
180 const std::string renderer("NVE7");
181 const std::string expectation("GeForce GTX 480, or similar");
182 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
183 EXPECT_EQ(sanitized, expectation);
186 TEST(SanitizeRenderer, TestLinux980)
188 const std::string renderer("NV124");
189 const std::string expectation("GeForce GTX 980, or similar");
190 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
191 EXPECT_EQ(sanitized, expectation);
194 TEST(SanitizeRenderer, TestAdreno512)
196 const std::string renderer("Adreno (TM) 512");
197 const std::string expectation("Adreno (TM) 540, or similar");
198 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
199 EXPECT_EQ(sanitized, expectation);
202 // -
203 // Keep gtests for our known CI RENDERER strings (see
204 // test_renderer_strings.html) otherwise the first time we know we messed up is
205 // in CI results after an hour, instead of after running gtests locally.
207 TEST(SanitizeRenderer, TestCiAndroid)
209 const std::string renderer("Adreno (TM) 540");
210 const std::string expectation("Adreno (TM) 540, or similar");
211 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
212 EXPECT_EQ(sanitized, expectation);
215 TEST(SanitizeRenderer, TestCiLinux)
217 const std::string renderer("llvmpipe (LLVM 10.0.0, 256 bits)");
218 const std::string expectation("llvmpipe, or similar");
219 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
220 EXPECT_EQ(sanitized, expectation);
223 TEST(SanitizeRenderer, TestCiMac)
225 const std::string renderer("Intel(R) UHD Graphics 630");
226 const std::string expectation("Intel(R) HD Graphics 400, or similar");
227 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
228 EXPECT_EQ(sanitized, expectation);
231 TEST(SanitizeRenderer, TestCiMac2)
233 const std::string renderer("Apple M1");
234 const std::string expectation("Apple M1, or similar");
235 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
236 EXPECT_EQ(sanitized, expectation);
239 TEST(SanitizeRenderer, TestCiWindows)
241 const std::string renderer(
242 "ANGLE (NVIDIA, NVIDIA Tesla M60 Direct3D11 vs_5_0 ps_5_0, "
243 "D3D11-23.21.13.9181)");
244 const std::string expectation(
245 "ANGLE (NVIDIA, NVIDIA GeForce 8800 GTX Direct3D11 vs_5_0 ps_5_0), or similar");
246 const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer);
247 EXPECT_EQ(sanitized, expectation);