Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9d943eb

Browse files
authored
Avoid using a private GTest macro to skip tests. (#53782)
I admit to using this private macro initially without realizing that the documented way to do this is to use the stream the other macro returns. The non-private variant is actually more powerful since it allows for easier customization of the reason for the skip. No change in functionality. Just removes the use of the private macros.
1 parent 04e4989 commit 9d943eb

File tree

10 files changed

+28
-26
lines changed

10 files changed

+28
-26
lines changed

impeller/aiks/aiks_blur_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,14 @@ TEST_P(AiksTest, GaussianBlurAtPeripheryHorizontal) {
502502

503503
TEST_P(AiksTest, GaussianBlurWithoutDecalSupport) {
504504
if (GetParam() != PlaygroundBackend::kMetal) {
505-
GTEST_SKIP_(
506-
"This backend doesn't yet support setting device capabilities.");
505+
GTEST_SKIP()
506+
<< "This backend doesn't yet support setting device capabilities.";
507507
}
508508
if (!WillRenderSomething()) {
509509
// Sometimes these tests are run without playgrounds enabled which is
510510
// pointless for this test since we are asserting that
511511
// `SupportsDecalSamplerAddressMode` is called.
512-
GTEST_SKIP_("This test requires playgrounds.");
512+
GTEST_SKIP() << "This test requires playgrounds.";
513513
}
514514

515515
std::shared_ptr<const Capabilities> old_capabilities =

impeller/compiler/compiler_unittests.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ TEST_P(CompilerTest, CanCompileHLSLWithMultipleStages) {
5555

5656
TEST_P(CompilerTest, CanCompileComputeShader) {
5757
if (!TargetPlatformIsMetal(GetParam())) {
58-
GTEST_SKIP_("Only enabled on Metal backends till ES 3.2 support is added.");
58+
GTEST_SKIP()
59+
<< "Only enabled on Metal backends till ES 3.2 support is added.";
5960
}
6061
ASSERT_TRUE(CanCompileAndReflect("sample.comp"));
6162
ASSERT_TRUE(CanCompileAndReflect("sample.comp", SourceType::kComputeShader));

impeller/entity/contents/tiled_texture_contents_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ TEST_P(EntityTest, TiledTextureContentsRendersWithCorrectPipeline) {
5656
#if !defined(FML_OS_MACOSX)
5757
TEST_P(EntityTest, TiledTextureContentsRendersWithCorrectPipelineExternalOES) {
5858
if (GetParam() != PlaygroundBackend::kOpenGLES) {
59-
GTEST_SKIP_(
60-
"External OES textures are only valid for the OpenGLES backend.");
59+
GTEST_SKIP()
60+
<< "External OES textures are only valid for the OpenGLES backend.";
6161
}
6262

6363
TextureDescriptor texture_desc;

impeller/entity/entity_unittests.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,8 @@ static std::vector<std::shared_ptr<Texture>> CreateTestYUVTextures(
19161916
TEST_P(EntityTest, YUVToRGBFilter) {
19171917
if (GetParam() == PlaygroundBackend::kOpenGLES) {
19181918
// TODO(114588) : Support YUV to RGB filter on OpenGLES backend.
1919-
GTEST_SKIP_("YUV to RGB filter is not supported on OpenGLES backend yet.");
1919+
GTEST_SKIP()
1920+
<< "YUV to RGB filter is not supported on OpenGLES backend yet.";
19201921
}
19211922

19221923
auto callback = [&](ContentContext& context, RenderPass& pass) -> bool {

impeller/golden_tests/golden_playground_test_mac.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ void GoldenPlaygroundTest::SetUp() {
210210
switch (GetParam()) {
211211
case PlaygroundBackend::kMetal:
212212
if (!DoesSupportWideGamutTests()) {
213-
GTEST_SKIP_(
214-
"This metal device doesn't support wide gamut golden tests.");
213+
GTEST_SKIP()
214+
<< "This metal device doesn't support wide gamut golden tests.";
215215
}
216216
pimpl_->screenshotter =
217217
std::make_unique<testing::MetalScreenshotter>(enable_wide_gamut);
218218
break;
219219
case PlaygroundBackend::kVulkan: {
220220
if (enable_wide_gamut) {
221-
GTEST_SKIP_("Vulkan doesn't support wide gamut golden tests.");
221+
GTEST_SKIP() << "Vulkan doesn't support wide gamut golden tests.";
222222
}
223223
const std::unique_ptr<PlaygroundImpl>& playground =
224224
GetSharedVulkanPlayground(/*enable_validations=*/true);
@@ -228,7 +228,7 @@ void GoldenPlaygroundTest::SetUp() {
228228
}
229229
case PlaygroundBackend::kOpenGLES: {
230230
if (enable_wide_gamut) {
231-
GTEST_SKIP_("OpenGLES doesn't support wide gamut golden tests.");
231+
GTEST_SKIP() << "OpenGLES doesn't support wide gamut golden tests.";
232232
}
233233
FML_CHECK(::glfwInit() == GLFW_TRUE);
234234
PlaygroundSwitches playground_switches;
@@ -243,9 +243,9 @@ void GoldenPlaygroundTest::SetUp() {
243243

244244
if (std::find(kSkipTests.begin(), kSkipTests.end(), test_name) !=
245245
kSkipTests.end()) {
246-
GTEST_SKIP_(
247-
"GoldenPlaygroundTest doesn't support interactive playground tests "
248-
"yet.");
246+
GTEST_SKIP()
247+
<< "GoldenPlaygroundTest doesn't support interactive playground tests "
248+
"yet.";
249249
}
250250

251251
testing::GoldenDigest::Instance()->AddDimension(

impeller/golden_tests/golden_playground_test_stub.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void GoldenPlaygroundTest::SetTypographerContext(
2020
void GoldenPlaygroundTest::TearDown() {}
2121

2222
void GoldenPlaygroundTest::SetUp() {
23-
GTEST_SKIP_("GoldenPlaygroundTest doesn't support this backend type.");
23+
GTEST_SKIP() << "GoldenPlaygroundTest doesn't support this backend type.";
2424
}
2525

2626
PlaygroundBackend GoldenPlaygroundTest::GetBackend() const {

impeller/playground/compute_playground_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ ComputePlaygroundTest::~ComputePlaygroundTest() = default;
1616

1717
void ComputePlaygroundTest::SetUp() {
1818
if (!Playground::SupportsBackend(GetParam())) {
19-
GTEST_SKIP_("Playground doesn't support this backend type.");
19+
GTEST_SKIP() << "Playground doesn't support this backend type.";
2020
return;
2121
}
2222

2323
if (!Playground::ShouldOpenNewPlaygrounds()) {
24-
GTEST_SKIP_("Skipping due to user action.");
24+
GTEST_SKIP() << "Skipping due to user action.";
2525
return;
2626
}
2727

impeller/playground/playground_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ bool DoesSupportWideGamutTests() {
2727

2828
void PlaygroundTest::SetUp() {
2929
if (!Playground::SupportsBackend(GetParam())) {
30-
GTEST_SKIP_("Playground doesn't support this backend type.");
30+
GTEST_SKIP() << "Playground doesn't support this backend type.";
3131
return;
3232
}
3333

3434
if (!Playground::ShouldOpenNewPlaygrounds()) {
35-
GTEST_SKIP_("Skipping due to user action.");
35+
GTEST_SKIP() << "Skipping due to user action.";
3636
return;
3737
}
3838

@@ -46,7 +46,7 @@ void PlaygroundTest::SetUp() {
4646

4747
if (switches.enable_wide_gamut && (GetParam() != PlaygroundBackend::kMetal ||
4848
!DoesSupportWideGamutTests())) {
49-
GTEST_SKIP_("This backend doesn't yet support wide gamut.");
49+
GTEST_SKIP() << "This backend doesn't yet support wide gamut.";
5050
return;
5151
}
5252

impeller/renderer/renderer_unittests.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ TEST_P(RendererTest, CanRenderToTexture) {
440440

441441
TEST_P(RendererTest, CanRenderInstanced) {
442442
if (GetParam() == PlaygroundBackend::kOpenGLES) {
443-
GTEST_SKIP_("Instancing is not supported on OpenGL.");
443+
GTEST_SKIP() << "Instancing is not supported on OpenGL.";
444444
}
445445
using VS = InstancedDrawVertexShader;
446446
using FS = InstancedDrawFragmentShader;
@@ -1403,8 +1403,8 @@ TEST_P(RendererTest, CanSepiaToneWithSubpasses) {
14031403
ASSERT_TRUE(context);
14041404

14051405
if (!context->GetCapabilities()->SupportsFramebufferFetch()) {
1406-
GTEST_SKIP_(
1407-
"This test uses framebuffer fetch and the backend doesn't support it.");
1406+
GTEST_SKIP() << "This test uses framebuffer fetch and the backend doesn't "
1407+
"support it.";
14081408
return;
14091409
}
14101410

@@ -1494,8 +1494,8 @@ TEST_P(RendererTest, CanSepiaToneThenSwizzleWithSubpasses) {
14941494
ASSERT_TRUE(context);
14951495

14961496
if (!context->GetCapabilities()->SupportsFramebufferFetch()) {
1497-
GTEST_SKIP_(
1498-
"This test uses framebuffer fetch and the backend doesn't support it.");
1497+
GTEST_SKIP() << "This test uses framebuffer fetch and the backend doesn't "
1498+
"support it.";
14991499
return;
15001500
}
15011501

impeller/scene/scene_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEST_P(SceneTest, FlutterLogo) {
112112

113113
TEST_P(SceneTest, TwoTriangles) {
114114
if (GetBackend() == PlaygroundBackend::kVulkan) {
115-
GTEST_SKIP_("Temporarily disabled.");
115+
GTEST_SKIP() << "Temporarily disabled.";
116116
}
117117
auto allocator = GetContext()->GetResourceAllocator();
118118

0 commit comments

Comments
 (0)