[Impeller] Remove duplicate entity test suite instantiations. (flutter/engine#48654)

And make it illegal to do so in the future. Now, making such a mistake will lead to a linker error complaining about duplicate definitions of `kYouInstantiatedEntityTestMultipleTimes`.

Fixes https://github.com/flutter/flutter/issues/139090
This commit is contained in:
Chinmay Garde
2023-12-04 20:07:23 -08:00
committed by GitHub
parent c4eb1a2128
commit da21ebcd29
4 changed files with 10 additions and 11 deletions

View File

@@ -17,7 +17,6 @@ namespace impeller {
namespace testing {
using EntityTest = EntityPlayground;
INSTANTIATE_PLAYGROUND_SUITE(EntityTest);
#ifdef IMPELLER_DEBUG
TEST(EntityTest, HasNulloptCoverage) {

View File

@@ -15,7 +15,6 @@ namespace impeller {
namespace testing {
using EntityTest = EntityPlayground;
INSTANTIATE_PLAYGROUND_SUITE(EntityTest);
TEST_P(EntityTest, TiledTextureContentsRendersWithCorrectPipeline) {
TextureDescriptor texture_desc;

View File

@@ -21,7 +21,6 @@ namespace impeller {
namespace testing {
using EntityTest = EntityPlayground;
INSTANTIATE_PLAYGROUND_SUITE(EntityTest);
std::shared_ptr<VerticesGeometry> CreateColorVertices(
const std::vector<Point>& vertices,

View File

@@ -55,14 +55,16 @@ class PlaygroundTest : public Playground,
PlaygroundTest& operator=(const PlaygroundTest&) = delete;
};
#define INSTANTIATE_PLAYGROUND_SUITE(playground) \
INSTANTIATE_TEST_SUITE_P( \
Play, playground, \
::testing::Values(PlaygroundBackend::kMetal, \
PlaygroundBackend::kOpenGLES, \
PlaygroundBackend::kVulkan), \
[](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
return PlaygroundBackendToString(info.param); \
#define INSTANTIATE_PLAYGROUND_SUITE(playground) \
[[maybe_unused]] const char* kYouInstantiated##playground##MultipleTimes = \
""; \
INSTANTIATE_TEST_SUITE_P( \
Play, playground, \
::testing::Values(PlaygroundBackend::kMetal, \
PlaygroundBackend::kOpenGLES, \
PlaygroundBackend::kVulkan), \
[](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
return PlaygroundBackendToString(info.param); \
});
} // namespace impeller