#include <golden_playground_test.h>
Classes | |
| struct | GoldenPlaygroundTestImpl |
Public Types | |
| using | AiksPlaygroundCallback = std::function< std::optional< Picture >(AiksContext &renderer)> |
| using | AiksDlPlaygroundCallback = std::function< sk_sp< flutter::DisplayList >()> |
Public Member Functions | |
| GoldenPlaygroundTest () | |
| ~GoldenPlaygroundTest () override | |
| void | SetUp () |
| void | TearDown () |
| PlaygroundBackend | GetBackend () const |
| void | SetTypographerContext (std::shared_ptr< TypographerContext > typographer_context) |
| bool | OpenPlaygroundHere (Picture picture) |
| bool | OpenPlaygroundHere (AiksPlaygroundCallback callback) |
| bool | OpenPlaygroundHere (const AiksDlPlaygroundCallback &callback) |
| bool | OpenPlaygroundHere (const sk_sp< flutter::DisplayList > &list) |
| bool | OpenPlaygroundHere (const Playground::SinglePassCallback &callback) |
| std::unique_ptr< testing::Screenshot > | MakeScreenshot (const sk_sp< flutter::DisplayList > &list) |
| std::shared_ptr< Texture > | CreateTextureForFixture (const char *fixture_name, bool enable_mipmapping=false) const |
| sk_sp< flutter::DlImage > | CreateDlImageForFixture (const char *fixture_name, bool enable_mipmapping=false) const |
| absl::StatusOr< RuntimeStage::Map > | OpenAssetAsRuntimeStage (const char *asset_name) const |
| std::shared_ptr< Context > | GetContext () const |
| std::shared_ptr< Context > | MakeContext () const |
| Point | GetContentScale () const |
| Scalar | GetSecondsElapsed () const |
| ISize | GetWindowSize () const |
| IRect | GetWindowBounds () const |
| fml::Status | SetCapabilities (const std::shared_ptr< Capabilities > &capabilities) |
| RuntimeStageBackend | GetRuntimeStageBackend () const |
| void | SetEnableWriteGolden (bool write_golden) |
| Sets a particular test to either write a golden or not. | |
| bool | IsPlaygroundEnabled () const |
| bool | InitializePipelineDescriptorForRendering (PipelineDescriptor &desc) const |
| Initializes the provided |PipelineDescriptor| with appropriate default values to match the conditions under which a pipeline will be rendered. | |
Static Public Member Functions | |
| static bool | SaveScreenshot (std::unique_ptr< testing::Screenshot > screenshot, const std::string &postfix="") |
Protected Member Functions | |
| void | SetWindowSize (ISize size) |
| bool | RenderingSupportsMSAA () const |
| Returns true if the rendering path supports MSAA rendering. | |
| SampleCount | GetDefaultSampleCount () const |
| Returns the default sample count of the rendering path. | |
| void | EnsureContextIsUnique () |
| bool | EnsureContextSupportsWideGamut () |
Definition at line 27 of file golden_playground_test.h.
| using impeller::GoldenPlaygroundTest::AiksDlPlaygroundCallback = std::function<sk_sp<flutter::DisplayList>()> |
Definition at line 33 of file golden_playground_test.h.
| using impeller::GoldenPlaygroundTest::AiksPlaygroundCallback = std::function<std::optional<Picture>(AiksContext& renderer)> |
Definition at line 30 of file golden_playground_test.h.
|
default |
Definition at line 159 of file golden_playground_test_mac.cc.
|
overridedefault |
| sk_sp< flutter::DlImage > impeller::GoldenPlaygroundTest::CreateDlImageForFixture | ( | const char * | fixture_name, |
| bool | enable_mipmapping = false |
||
| ) | const |
Definition at line 342 of file golden_playground_test_mac.cc.
References CreateTextureForFixture(), impeller::DlImageImpeller::Make(), and texture.
| std::shared_ptr< Texture > impeller::GoldenPlaygroundTest::CreateTextureForFixture | ( | const char * | fixture_name, |
| bool | enable_mipmapping = false |
||
| ) | const |
Definition at line 329 of file golden_playground_test_mac.cc.
References impeller::Playground::CreateTextureForMapping(), GetContext(), and flutter::testing::OpenFixtureAsMapping().
Referenced by CreateDlImageForFixture().
|
inlineprotected |
Definition at line 130 of file golden_playground_test.h.
|
inlineprotected |
Definition at line 136 of file golden_playground_test.h.
| PlaygroundBackend impeller::GoldenPlaygroundTest::GetBackend | ( | ) | const |
Definition at line 253 of file golden_playground_test_mac.cc.
| Point impeller::GoldenPlaygroundTest::GetContentScale | ( | ) | const |
Definition at line 398 of file golden_playground_test_mac.cc.
| std::shared_ptr< Context > impeller::GoldenPlaygroundTest::GetContext | ( | ) | const |
Definition at line 360 of file golden_playground_test_mac.cc.
Referenced by CreateTextureForFixture(), MakeContext(), MakeScreenshot(), OpenPlaygroundHere(), OpenPlaygroundHere(), SetUp(), and TearDown().
|
inlineprotected |
Returns the default sample count of the rendering path.
In the case of goldens, all tests are rendered to a non-MSAA backend.
Definition at line 126 of file golden_playground_test.h.
References impeller::kCount1.
| RuntimeStageBackend impeller::GoldenPlaygroundTest::GetRuntimeStageBackend | ( | ) | const |
Definition at line 436 of file golden_playground_test_mac.cc.
| Scalar impeller::GoldenPlaygroundTest::GetSecondsElapsed | ( | ) | const |
Definition at line 402 of file golden_playground_test_mac.cc.
| IRect impeller::GoldenPlaygroundTest::GetWindowBounds | ( | ) | const |
Definition at line 410 of file golden_playground_test_mac.cc.
References impeller::TRect< T >::MakeSize().
| ISize impeller::GoldenPlaygroundTest::GetWindowSize | ( | ) | const |
Definition at line 406 of file golden_playground_test_mac.cc.
| bool impeller::GoldenPlaygroundTest::InitializePipelineDescriptorForRendering | ( | PipelineDescriptor & | desc | ) | const |
Initializes the provided |PipelineDescriptor| with appropriate default values to match the conditions under which a pipeline will be rendered.
Definition at line 447 of file golden_playground_test_mac.cc.
References impeller::PipelineDescriptor::ClearDepthAttachment(), impeller::PipelineDescriptor::ClearStencilAttachments(), impeller::kCount1, and impeller::PipelineDescriptor::SetSampleCount().
|
inline |
Definition at line 108 of file golden_playground_test.h.
| std::shared_ptr< Context > impeller::GoldenPlaygroundTest::MakeContext | ( | ) | const |
On Metal we create a context for each test.
Definition at line 367 of file golden_playground_test_mac.cc.
References FML_CHECK, GetContext(), impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, and impeller::kVulkan.
| std::unique_ptr< testing::Screenshot > impeller::GoldenPlaygroundTest::MakeScreenshot | ( | const sk_sp< flutter::DisplayList > & | list | ) |
Definition at line 423 of file golden_playground_test_mac.cc.
References impeller::DisplayListToTexture(), GetContext(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
| absl::StatusOr< RuntimeStage::Map > impeller::GoldenPlaygroundTest::OpenAssetAsRuntimeStage | ( | const char * | asset_name | ) | const |
Definition at line 350 of file golden_playground_test_mac.cc.
References impeller::RuntimeStage::DecodeRuntimeStages(), and flutter::testing::OpenFixtureAsMapping().
| bool impeller::GoldenPlaygroundTest::OpenPlaygroundHere | ( | AiksPlaygroundCallback | callback | ) |
| bool impeller::GoldenPlaygroundTest::OpenPlaygroundHere | ( | const AiksDlPlaygroundCallback & | callback | ) |
Definition at line 257 of file golden_playground_test_mac.cc.
References callback, impeller::DisplayListToTexture(), GetContext(), i, SaveScreenshot(), texture, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
| bool impeller::GoldenPlaygroundTest::OpenPlaygroundHere | ( | const Playground::SinglePassCallback & | callback | ) |
Renders callback into an offscreen render pass and saves the result as a golden image. The render target is single-sampled, uses the context's default color format, and has no depth or stencil attachment, so a pipeline built from PipelineBuilder<>::MakeDefaultPipelineDescriptor must be reduced to match by calling SetSampleCount(kCount1), ClearStencilAttachments(), and ClearDepthAttachment() on it. Calling only SetStencilAttachmentDescriptors(nullopt) leaves the stencil pixel format set and trips Metal's render pipeline validation.
Definition at line 282 of file golden_playground_test_mac.cc.
References callback, command_buffer, context, impeller::RenderTargetAllocator::CreateOffscreen(), GetContext(), impeller::RenderTarget::GetRenderTargetTexture(), i, impeller::RenderTarget::IsValid(), impeller::RenderTarget::kDefaultColorAttachmentConfig, render_pass, SaveScreenshot(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.
| bool impeller::GoldenPlaygroundTest::OpenPlaygroundHere | ( | const sk_sp< flutter::DisplayList > & | list | ) |
Definition at line 277 of file golden_playground_test_mac.cc.
References OpenPlaygroundHere().
| bool impeller::GoldenPlaygroundTest::OpenPlaygroundHere | ( | Picture | picture | ) |
Referenced by OpenPlaygroundHere().
|
inlineprotected |
Returns true if the rendering path supports MSAA rendering.
In the case of goldens, all tests are rendered to a non-MSAA backend.
Definition at line 121 of file golden_playground_test.h.
|
static |
Definition at line 133 of file golden_playground_test_mac.cc.
References impeller::testing::GoldenDigest::AddImage(), FML_LOG, impeller::testing::WorkingDirectory::GetFilenamePath(), impeller::testing::GoldenDigest::Instance(), and impeller::testing::WorkingDirectory::Instance().
Referenced by OpenPlaygroundHere(), and OpenPlaygroundHere().
| fml::Status impeller::GoldenPlaygroundTest::SetCapabilities | ( | const std::shared_ptr< Capabilities > & | capabilities | ) |
Definition at line 418 of file golden_playground_test_mac.cc.
| void impeller::GoldenPlaygroundTest::SetEnableWriteGolden | ( | bool | write_golden | ) |
Sets a particular test to either write a golden or not.
For purposes of the GoldenPlayground test harness, we don't maintain a flag for this status, all tests are assumed to be golden tests and passing false here means we should just skip this test entirely (enforced in the implementation with a GTEST_SKIP).
Definition at line 440 of file golden_playground_test_mac.cc.
| void impeller::GoldenPlaygroundTest::SetTypographerContext | ( | std::shared_ptr< TypographerContext > | typographer_context | ) |
Definition at line 165 of file golden_playground_test_mac.cc.
| void impeller::GoldenPlaygroundTest::SetUp | ( | ) |
Definition at line 189 of file golden_playground_test_mac.cc.
References impeller::testing::GoldenDigest::AddDimension(), impeller::PlaygroundSwitches::enable_wide_gamut, impeller::PlaygroundSwitches::flags, GetContext(), flutter::testing::GetTestingAssetsPath(), impeller::testing::GoldenDigest::Instance(), impeller::kMetal, impeller::kMetalSDF, impeller::kOpenGLES, impeller::kOpenGLESSDF, impeller::kSkipTests, impeller::kVulkan, and impeller::Flags::use_sdfs.
|
protected |
Definition at line 80 of file golden_playground_test_stub.cc.
| void impeller::GoldenPlaygroundTest::TearDown | ( | ) |
Definition at line 170 of file golden_playground_test_mac.cc.
References context, and GetContext().