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

#include <playground_test.h>

Inheritance diagram for impeller::PlaygroundTest:
impeller::Playground impeller::AiksPlayground impeller::DlPlayground impeller::EntityPlayground impeller::RuntimeStagePlayground impeller::testing::RendererDartTest impeller::testing::BlendFilterContentsTest impeller::testing::GaussianBlurFilterContentsTest impeller::testing::MatrixFilterContentsTest

Public Member Functions

 PlaygroundTest ()
 
virtual ~PlaygroundTest ()
 
void SetUp () override
 
void TearDown () override
 
PlaygroundBackend GetBackend () const
 
std::unique_ptr< fml::MappingOpenAssetAsMapping (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, const PlaygroundSwitches &switches)
 
void SetupWindow ()
 
void TeardownWindow ()
 
bool IsPlaygroundEnabled () const
 
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< ContextGetContext () const
 
std::shared_ptr< ContextMakeContext () const
 
bool OpenPlaygroundHere (const Renderer::RenderCallback &render_callback)
 
bool OpenPlaygroundHere (SinglePassCallback pass_callback)
 
std::shared_ptr< TextureCreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const
 
std::shared_ptr< TextureCreateTextureCubeForFixture (std::array< const char *, 6 > fixture_names) const
 
virtual std::unique_ptr< fml::MappingOpenAssetAsMapping (std::string asset_name) const =0
 
virtual std::string GetWindowTitle () const =0
 
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< CompressedImageLoadFixtureImageCompressed (std::shared_ptr< fml::Mapping > mapping)
 
static std::optional< DecompressedImageDecodeImageRGBA (const std::shared_ptr< CompressedImage > &compressed)
 
static std::shared_ptr< TextureCreateTextureForMapping (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
virtual bool ShouldKeepRendering () const
 
void SetWindowSize (ISize size)
 
- Protected Attributes inherited from impeller::Playground
const PlaygroundSwitches switches_
 

Detailed Description

Definition at line 21 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()}) {}
Playground(PlaygroundSwitches switches)
Definition: playground.cc:83
const fml::CommandLine & GetArgsForProcess()
Definition: test_args.cc:12

◆ ~PlaygroundTest()

impeller::PlaygroundTest::~PlaygroundTest ( )
virtualdefault

Member Function Documentation

◆ GetBackend()

PlaygroundBackend impeller::PlaygroundTest::GetBackend ( ) const

Definition at line 57 of file playground_test.cc.

57 {
58 return GetParam();
59}

◆ GetWindowTitle()

std::string impeller::PlaygroundTest::GetWindowTitle ( ) const
overridevirtual

Implements impeller::Playground.

Definition at line 82 of file playground_test.cc.

82 {
83 std::stringstream stream;
84 stream << "Impeller Playground for '"
86 switch (GetBackend()) {
88 break;
90 if (switches_.use_angle) {
91 stream << " (Angle) ";
92 }
93 break;
96 stream << " (SwiftShader) ";
97 }
98 break;
99 }
100 stream << " (Press ESC to quit)";
101 return stream.str();
102}
PlaygroundBackend GetBackend() const
const PlaygroundSwitches switches_
Definition: playground.h:118
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...
Definition: testing.cc:15

◆ OpenAssetAsMapping()

std::unique_ptr< fml::Mapping > impeller::PlaygroundTest::OpenAssetAsMapping ( std::string  asset_name) const
overridevirtual

Implements impeller::Playground.

Definition at line 66 of file playground_test.cc.

67 {
69}
std::unique_ptr< fml::Mapping > OpenFixtureAsMapping(const std::string &fixture_name)
Opens a fixture of the given file name and returns a mapping to its contents.
Definition: testing.cc:59

◆ OpenAssetAsRuntimeStage()

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

Definition at line 71 of file playground_test.cc.

72 {
73 const std::shared_ptr<fml::Mapping> fixture =
75 if (!fixture || fixture->GetSize() == 0) {
76 return {};
77 }
79}
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)

◆ SetUp()

void impeller::PlaygroundTest::SetUp ( )
override

Definition at line 28 of file playground_test.cc.

28 {
29 if (!Playground::SupportsBackend(GetParam())) {
30 GTEST_SKIP_("Playground doesn't support this backend type.");
31 return;
32 }
33
35 GTEST_SKIP_("Skipping due to user action.");
36 return;
37 }
38
40
41 // Test names that end with "WideGamut" will render with wide gamut support.
42 std::string test_name = flutter::testing::GetCurrentTestName();
43 PlaygroundSwitches switches = switches_;
44 switches.enable_wide_gamut =
45 test_name.find("WideGamut/") != std::string::npos;
46
47 if (switches.enable_wide_gamut && (GetParam() != PlaygroundBackend::kMetal ||
48 !DoesSupportWideGamutTests())) {
49 GTEST_SKIP_("This backend doesn't yet support wide gamut.");
50 return;
51 }
52
53 SetupContext(GetParam(), switches);
55}
static bool ShouldOpenNewPlaygrounds()
Definition: playground.cc:167
void SetupContext(PlaygroundBackend backend, const PlaygroundSwitches &switches)
Definition: playground.cc:124
static bool SupportsBackend(PlaygroundBackend backend)
Definition: playground.cc:100
void ImpellerValidationErrorsSetFatal(bool fatal)
Definition: validation.cc:16

◆ TearDown()

void impeller::PlaygroundTest::TearDown ( )
override

Definition at line 61 of file playground_test.cc.

61 {
63}

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