Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::PlaygroundTest Class Reference

#include <playground_test.h>

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

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
 
absl::StatusOr< RuntimeStage::MapOpenAssetAsRuntimeStage (const char *asset_name) const
 
std::string GetWindowTitle () const override
 
- Public Member Functions inherited from impeller::Playground
 Playground (PlaygroundBackend backend, const PlaygroundSwitches &switches)
 
virtual ~Playground ()
 
bool IsPlaygroundEnabled () const
 
Point GetCursorPosition () const
 
ISize GetWindowSize () const
 
IRect GetWindowBounds () const
 
Point GetContentScale () const
 
Scalar GetSecondsElapsed () const
 Get the amount of time elapsed from the start of the playground's execution.
 
std::shared_ptr< ContextGetContext () const
 
std::shared_ptr< ContextMakeContext () const
 
ContentContextGetContentContext () const
 
std::shared_ptr< TypographerContextGetTypographerContext () const
 
bool OpenPlaygroundHere (const 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
 
fml::Status SetCapabilities (const std::shared_ptr< Capabilities > &capabilities)
 
bool WillRenderSomething () const
 Returns true if OpenPlaygroundHere will actually render anything.
 
GLProcAddressResolver CreateGLProcAddressResolver () const
 
VKProcAddressResolver CreateVKProcAddressResolver () const
 
void SetGPUDisabled (bool disabled) const
 Mark the GPU as unavilable.
 
RuntimeStageBackend GetRuntimeStageBackend () const
 

Additional Inherited Members

- Public Types inherited from impeller::Playground
using SinglePassCallback = std::function< bool(RenderPass &pass)>
 
using RenderCallback = std::function< bool(RenderTarget &render_target)>
 
using GLProcAddressResolver = std::function< void *(const char *proc_name)>
 
using VKProcAddressResolver = std::function< void *(void *instance, const char *proc_name)>
 
- 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
void TearDownContextData ()
 
virtual void EnsureContextIsUnique ()
 Make sure that when the context is later created that it will not be shared with any other playgrounds.
 
bool PlatformSupportsWideGamutTests () const
 Returns true if the platform can support wide gamuts.
 
virtual bool EnsureContextSupportsWideGamut ()
 Make sure that when the context is later created that it will support wide gamuts if the platform supports it. Returns whether the platform supports wide gamut.
 
virtual void EnsureContextSupportsAntialiasLines ()
 Make sure that when the context is later created that it will support the experimental AA lines flag.
 
const PlaygroundSwitchesGetSwitches () const
 Return an unmodifiable reference to the current switches. The switches might change at the start of a test as it has a brief opportunity to call any of the Ensure* methods that define the environment it expects, but should be stable by the time any subsequent methods that might perform work are called.
 
void SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context)
 
void SetWindowSize (ISize size)
 

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(GetParam(),
15 PlaygroundSwitches{flutter::testing::GetArgsForProcess()}) {
17 [](const char* message, const char* file, int line) -> bool {
18 // GTEST_MESSAGE_AT_ can only be used in a function that returns void.
19 // Hence the goofy lambda. The failure message and location will still
20 // be correct however.
21 //
22 // https://google.github.io/googletest/advanced.html#assertion-placement
23 [message, file, line]() -> void {
24 GTEST_MESSAGE_AT_(file, line, "Impeller Validation Error",
25 ::testing::TestPartResult::kFatalFailure)
26 << message;
27 }();
28 return true;
29 });
30}
Playground(PlaygroundBackend backend, const PlaygroundSwitches &switches)
Definition playground.cc:90
const char * message
const fml::CommandLine & GetArgsForProcess()
Definition test_args.cc:11
void ImpellerValidationErrorsSetCallback(ValidationFailureCallback callback)
Sets a callback that callers (usually tests) can set to intercept validation failures.
Definition validation.cc:21

References impeller::ImpellerValidationErrorsSetCallback(), and message.

◆ ~PlaygroundTest()

impeller::PlaygroundTest::~PlaygroundTest ( )
virtual

Member Function Documentation

◆ GetBackend()

◆ GetWindowTitle()

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

Implements impeller::Playground.

Definition at line 73 of file playground_test.cc.

73 {
74 std::stringstream stream;
75 stream << "Impeller Playground for '"
77 switch (GetBackend()) {
80 break;
83 if (GetSwitches().use_angle) {
84 stream << " (Angle) ";
85 }
86 break;
88 if (GetSwitches().use_swiftshader) {
89 stream << " (SwiftShader) ";
90 }
91 break;
92 }
93 stream << " (Press ESC to quit)";
94 return stream.str();
95}
const PlaygroundSwitches & GetSwitches() const
Return an unmodifiable reference to the current switches. The switches might change at the start of a...
Definition playground.h:167
PlaygroundBackend GetBackend() const
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:14

References GetBackend(), flutter::testing::GetCurrentTestName(), impeller::Playground::GetSwitches(), impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.

◆ OpenAssetAsMapping()

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

Implements impeller::Playground.

Definition at line 57 of file playground_test.cc.

58 {
60}
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:58

References flutter::testing::OpenFixtureAsMapping().

Referenced by impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPMapping(), and impeller::interop::testing::PlaygroundTest::OpenAssetAsHPPTexture().

◆ OpenAssetAsRuntimeStage()

absl::StatusOr< RuntimeStage::Map > impeller::PlaygroundTest::OpenAssetAsRuntimeStage ( const char *  asset_name) const

Definition at line 62 of file playground_test.cc.

63 {
64 const std::shared_ptr<fml::Mapping> fixture =
66 if (!fixture || fixture->GetSize() == 0) {
67 return absl::NotFoundError("Asset not found or empty.");
68 }
70}
static absl::StatusOr< Map > DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)

References impeller::RuntimeStage::DecodeRuntimeStages(), and flutter::testing::OpenFixtureAsMapping().

◆ SetUp()

void impeller::PlaygroundTest::SetUp ( )
override

Definition at line 36 of file playground_test.cc.

36 {
37 if (!Playground::SupportsBackend(GetParam())) {
38 GTEST_SKIP() << "Playground doesn't support this backend type.";
39 return;
40 }
41
43 GTEST_SKIP() << "Skipping due to user action.";
44 return;
45 }
46}
static bool ShouldOpenNewPlaygrounds()
static bool SupportsBackend(PlaygroundBackend backend)

References impeller::Playground::ShouldOpenNewPlaygrounds(), and impeller::Playground::SupportsBackend().

Referenced by impeller::interop::testing::PlaygroundTest::SetUp().

◆ TearDown()

void impeller::PlaygroundTest::TearDown ( )
override

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