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 #pragma once
6 
7 #include <memory>
8 
9 #include "flutter/fml/macros.h"
10 #include "flutter/testing/test_args.h"
11 #include "flutter/testing/testing.h"
15 
16 #if FML_OS_MACOSX
17 #include "flutter/fml/platform/darwin/scoped_nsautorelease_pool.h"
18 #endif
19 
20 namespace impeller {
21 
22 class PlaygroundTest : public Playground,
23  public ::testing::TestWithParam<PlaygroundBackend> {
24  public:
26 
27  virtual ~PlaygroundTest();
28 
29  void SetUp() override;
30 
31  void TearDown() override;
32 
34 
35  // |Playground|
36  std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
37  std::string asset_name) const override;
38 
39  std::shared_ptr<RuntimeStage> OpenAssetAsRuntimeStage(
40  const char* asset_name) const;
41 
42  // |Playground|
43  std::string GetWindowTitle() const override;
44 
45  private:
46  // |Playground|
47  bool ShouldKeepRendering() const;
48 
49 #if FML_OS_MACOSX
50  fml::ScopedNSAutoreleasePool autorelease_pool_;
51 #endif
52 
53  FML_DISALLOW_COPY_AND_ASSIGN(PlaygroundTest);
54 };
55 
56 #define INSTANTIATE_PLAYGROUND_SUITE(playground) \
57  INSTANTIATE_TEST_SUITE_P( \
58  Play, playground, \
59  ::testing::Values(PlaygroundBackend::kMetal, \
60  PlaygroundBackend::kOpenGLES, \
61  PlaygroundBackend::kVulkan), \
62  [](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
63  return PlaygroundBackendToString(info.param); \
64  });
65 
66 } // namespace impeller
playground.h
impeller::PlaygroundBackend
PlaygroundBackend
Definition: playground.h:25
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::Playground
Definition: playground.h:33
impeller::PlaygroundTest::TearDown
void TearDown() override
Definition: playground_test.cc:39
impeller::PlaygroundTest::OpenAssetAsRuntimeStage
std::shared_ptr< RuntimeStage > OpenAssetAsRuntimeStage(const char *asset_name) const
Definition: playground_test.cc:49
switches.h
scalar.h
impeller::PlaygroundTest::GetWindowTitle
std::string GetWindowTitle() const override
Definition: playground_test.cc:69
impeller::PlaygroundTest
Definition: playground_test.h:22
impeller::PlaygroundTest::~PlaygroundTest
virtual ~PlaygroundTest()
impeller
Definition: aiks_context.cc:10
impeller::PlaygroundTest::GetBackend
PlaygroundBackend GetBackend() const
Definition: playground_test.cc:35