Flutter Impeller
playground_test.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_PLAYGROUND_PLAYGROUND_TEST_H_
6 #define FLUTTER_IMPELLER_PLAYGROUND_PLAYGROUND_TEST_H_
7 
8 #include <memory>
9 
10 #include "flutter/fml/macros.h"
11 #include "flutter/testing/test_args.h"
12 #include "flutter/testing/testing.h"
16 
17 #if FML_OS_MACOSX
18 #include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
19 #endif
20 
21 namespace impeller {
22 
23 class PlaygroundTest : public Playground,
24  public ::testing::TestWithParam<PlaygroundBackend> {
25  public:
27 
28  virtual ~PlaygroundTest();
29 
30  void SetUp() override;
31 
32  void TearDown() override;
33 
35 
36  // |Playground|
37  std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
38  std::string asset_name) const override;
39 
40  RuntimeStage::Map OpenAssetAsRuntimeStage(const char* asset_name) const;
41 
42  // |Playground|
43  std::string GetWindowTitle() const override;
44 
45  // TODO(dnfield): Delete this once
46  // https://github.com/flutter/flutter/issues/122823 is fixed.
49  }
50 
51  private:
52  // |Playground|
53  bool ShouldKeepRendering() const;
54 
55 #if FML_OS_MACOSX
56  fml::ScopedNSAutoreleasePool autorelease_pool_;
57 #endif
58 
59  PlaygroundTest(const PlaygroundTest&) = delete;
60 
61  PlaygroundTest& operator=(const PlaygroundTest&) = delete;
62 };
63 
64 #define INSTANTIATE_PLAYGROUND_SUITE(playground) \
65  [[maybe_unused]] const char* kYouInstantiated##playground##MultipleTimes = \
66  ""; \
67  INSTANTIATE_TEST_SUITE_P( \
68  Play, playground, \
69  ::testing::Values(PlaygroundBackend::kMetal, \
70  PlaygroundBackend::kOpenGLES, \
71  PlaygroundBackend::kVulkan), \
72  [](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
73  return PlaygroundBackendToString(info.param); \
74  });
75 
76 } // namespace impeller
77 
78 #endif // FLUTTER_IMPELLER_PLAYGROUND_PLAYGROUND_TEST_H_
impeller::PlaygroundBackend::kVulkan
@ kVulkan
playground.h
impeller::PlaygroundBackend
PlaygroundBackend
Definition: playground.h:29
impeller::PlaygroundTest::BackendSupportsFragmentProgram
bool BackendSupportsFragmentProgram() const
Definition: playground_test.h:47
impeller::PlaygroundTest::PlaygroundTest
PlaygroundTest()
Definition: playground_test.cc:13
impeller::PlaygroundTest::OpenAssetAsMapping
std::unique_ptr< fml::Mapping > OpenAssetAsMapping(std::string asset_name) const override
Definition: playground_test.cc:44
impeller::PlaygroundTest::SetUp
void SetUp() override
Definition: playground_test.cc:18
impeller::PlaygroundTest::OpenAssetAsRuntimeStage
RuntimeStage::Map OpenAssetAsRuntimeStage(const char *asset_name) const
Definition: playground_test.cc:49
impeller::Playground
Definition: playground.h:50
impeller::PlaygroundTest::TearDown
void TearDown() override
Definition: playground_test.cc:39
switches.h
scalar.h
impeller::PlaygroundTest::GetWindowTitle
std::string GetWindowTitle() const override
Definition: playground_test.cc:66
impeller::PlaygroundTest
Definition: playground_test.h:23
impeller::PlaygroundTest::~PlaygroundTest
virtual ~PlaygroundTest()
impeller
Definition: aiks_context.cc:10
impeller::PlaygroundTest::GetBackend
PlaygroundBackend GetBackend() const
Definition: playground_test.cc:35
impeller::RuntimeStage::Map
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
Definition: runtime_stage.h:22