| Flutter Impeller |

Public Member Functions | List of all members
impeller::PlaygroundTest Class Reference

`#include <playground_test.h>`

Inheritance diagram for impeller::PlaygroundTest:

## Public Member Functions
| PlaygroundTest ()
virtual | ~PlaygroundTest ()
void | SetUp () override
void | TearDown () override
PlaygroundBackend | GetBackend () const
std::unique_ptr< fml::Mapping > | OpenAssetAsMapping (std::string asset_name) const override
RuntimeStage::Map | OpenAssetAsRuntimeStage (const char *asset_name) const
std::string | GetWindowTitle () const override
Public Member Functions inherited from impeller::Playground
| Playground (PlaygroundSwitches switches)
virtual | ~Playground ()
void | SetupContext (PlaygroundBackend backend)
void | SetupWindow ()
void | TeardownWindow ()
Point | GetCursorPosition () const
ISize | GetWindowSize () const
Point | GetContentScale () const
Scalar | GetSecondsElapsed () const
| Get the amount of time elapsed from the start of the playground's execution. More...
std::shared_ptr< Context > | GetContext () const
std::shared_ptr< Context > | MakeContext () const
bool | OpenPlaygroundHere (const Renderer::RenderCallback &render_callback)
bool | OpenPlaygroundHere (SinglePassCallback pass_callback)
std::shared_ptr< Texture > | CreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
std::shared_ptr< Texture > | CreateTextureCubeForFixture (std::array< const char *, 6 > fixture_names) const
fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities)
bool | WillRenderSomething () const

## Additional Inherited Members
Public Types inherited from impeller::Playground
using | SinglePassCallback = std::function< bool(RenderPass &pass)>
Static Public Member Functions inherited from impeller::Playground
static bool | ShouldOpenNewPlaygrounds ()
static std::shared_ptr< CompressedImage > | LoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
static std::optional< DecompressedImage > | DecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
static std::shared_ptr< Texture > | CreateTextureForMapping (const std::shared_ptr< Context > &context, std::shared_ptr< fml::Mapping > mapping, bool enable_mipmapping=false)
static bool | SupportsBackend (PlaygroundBackend backend)
Protected Member Functions inherited from impeller::Playground
void | SetWindowSize (ISize size)
Protected Attributes inherited from impeller::Playground
const PlaygroundSwitches | switches_

## Detailed Description

Definition at line 23 of file playground_test.h.

## Constructor & Destructor Documentation

## ◆ PlaygroundTest()

impeller::PlaygroundTest::PlaygroundTest | ( |  | ) |

Definition at line 13 of file playground_test.cc.

14 : Playground(PlaygroundSwitches{flutter::testing::GetArgsForProcess()}) {}

## ◆ ~PlaygroundTest()

impeller::PlaygroundTest::~PlaygroundTest | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ GetBackend()

PlaygroundBackend impeller::PlaygroundTest::GetBackend | ( |  | ) | const

Definition at line 35 of file playground_test.cc.

35 {
36 return GetParam();
37 }

Referenced by GetWindowTitle().

## ◆ GetWindowTitle()

std::string impeller::PlaygroundTest::GetWindowTitle | ( |  | ) | const
| override virtual

Implements impeller::Playground.

Definition at line 60 of file playground_test.cc.

60 {
61 std::stringstream stream;
62 stream << "Impeller Playground for '"
63 << flutter::testing::GetCurrentTestName() << "' ";
64 switch (GetBackend()) {
65 case PlaygroundBackend::kMetal:
66 break;
67 case PlaygroundBackend::kOpenGLES:
68 if (switches_.use_angle) {
69 stream << " (Angle) ";
70 }
71 break;
72 case PlaygroundBackend::kVulkan:
73 if (switches_.use_swiftshader) {
74 stream << " (SwiftShader) ";
75 }
76 break;
77 }
78 stream << " (Press ESC to quit)";
79 return stream.str();
80 }

References GetBackend(), impeller::kMetal, impeller::kOpenGLES, impeller::kVulkan, impeller::Playground::switches_, impeller::PlaygroundSwitches::use_angle, and impeller::PlaygroundSwitches::use_swiftshader.

## ◆ OpenAssetAsMapping()

std::unique_ptr< fml::Mapping > impeller::PlaygroundTest::OpenAssetAsMapping | ( | std::string | asset_name | ) | const
| override virtual

Implements impeller::Playground.

Definition at line 44 of file playground_test.cc.

45 {
46 return flutter::testing::OpenFixtureAsMapping(asset_name);
47 }

## ◆ OpenAssetAsRuntimeStage()

RuntimeStage::Map impeller::PlaygroundTest::OpenAssetAsRuntimeStage | ( | const char * | asset_name | ) | const

Definition at line 49 of file playground_test.cc.

50 {
51 const std::shared_ptr<fml::Mapping> fixture =
52 flutter::testing::OpenFixtureAsMapping(asset_name);
53 if (!fixture || fixture->GetSize() == 0) {
54 return {};
55 }
56 return RuntimeStage::DecodeRuntimeStages(fixture);
57 }

References impeller::RuntimeStage::DecodeRuntimeStages().

## ◆ SetUp()

void impeller::PlaygroundTest::SetUp | ( |  | ) |
| override

Definition at line 18 of file playground_test.cc.

18 {
19 if (!Playground::SupportsBackend(GetParam())) {
20 GTEST_SKIP_("Playground doesn't support this backend type.");
21 return;
22 }
23
24 if (!Playground::ShouldOpenNewPlaygrounds()) {
25 GTEST_SKIP_("Skipping due to user action.");
26 return;
27 }
28
29 ImpellerValidationErrorsSetFatal(true);
30
31 SetupContext(GetParam());
32 SetupWindow();
33 }

References impeller::ImpellerValidationErrorsSetFatal(), impeller::Playground::SetupContext(), impeller::Playground::SetupWindow(), impeller::Playground::ShouldOpenNewPlaygrounds(), and impeller::Playground::SupportsBackend().

## ◆ TearDown()

void impeller::PlaygroundTest::TearDown | ( |  | ) |
| override

Definition at line 39 of file playground_test.cc.

39 {
40 TeardownWindow();
41 }

References impeller::Playground::TeardownWindow().

Referenced by impeller::AiksPlayground::TearDown().

The documentation for this class was generated from the following files:

- impeller/playground/playground_test.h
- impeller/playground/playground_test.cc

impeller::Playground::ShouldOpenNewPlaygrounds
static bool ShouldOpenNewPlaygrounds()
Definition: playground.cc:161
impeller::PlaygroundBackend::kVulkan
@ kVulkan
impeller::RuntimeStage::DecodeRuntimeStages
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:60
impeller::PlaygroundBackend::kMetal
@ kMetal
impeller::PlaygroundSwitches::use_swiftshader
bool use_swiftshader
Definition: switches.h:28
impeller::Playground::SetupWindow
void SetupWindow()
Definition: playground.cc:135
impeller::Playground::switches_
const PlaygroundSwitches switches_
Definition: playground.h:117
impeller::PlaygroundSwitches::use_angle
bool use_angle
Definition: switches.h:34
impeller::ImpellerValidationErrorsSetFatal
void ImpellerValidationErrorsSetFatal(bool fatal)
Definition: validation.cc:16
impeller::PlaygroundBackend::kOpenGLES
@ kOpenGLES
impeller::Playground::SetupContext
void SetupContext(PlaygroundBackend backend)
Definition: playground.cc:123
impeller::Playground::SupportsBackend
static bool SupportsBackend(PlaygroundBackend backend)
Definition: playground.cc:99
impeller::Playground::TeardownWindow
void TeardownWindow()
Definition: playground.cc:150
impeller::Playground::Playground
Playground(PlaygroundSwitches switches)
Definition: playground.cc:82
impeller::PlaygroundTest::GetBackend
PlaygroundBackend GetBackend() const
Definition: playground_test.cc:35