5#ifndef FLUTTER_FLOW_TESTING_MOCK_LAYER_H_
6#define FLUTTER_FLOW_TESTING_MOCK_LAYER_H_
11#include "flutter/flow/diff_context.h"
12#include "flutter/flow/layers/cacheable_layer.h"
13#include "flutter/flow/layers/container_layer.h"
14#include "flutter/flow/layers/layer.h"
15#include "flutter/flow/layers/layer_raster_cache_item.h"
16#include "flutter/flow/raster_cache.h"
17#include "flutter/flow/raster_cache_item.h"
32 return std::make_shared<MockLayer>(
path, std::move(
paint));
36 auto mock_layer = std::make_shared<MockLayer>(
path,
DlPaint());
37 mock_layer->set_fake_opacity_compatible(
true);
53 return mock_flags_ & kParentHasPlatformView;
57 return mock_flags_ & kParentHasTextureLayer;
65 return mock_flags_ & kFakeOpacityCompatible;
71 flag ? (mock_flags_ |= kParentHasPlatformView)
72 : (mock_flags_ &= ~(kParentHasPlatformView));
77 flag ? (mock_flags_ |= kParentHasTextureLayer)
78 : (mock_flags_ &= ~(kParentHasTextureLayer));
83 flag ? (mock_flags_ |= kFakeHasPlatformView)
84 : (mock_flags_ &= ~(kFakeHasPlatformView));
89 flag ? (mock_flags_ |= kFakeReadsSurface)
90 : (mock_flags_ &= ~(kFakeReadsSurface));
95 flag ? (mock_flags_ |= kFakeOpacityCompatible)
96 : (mock_flags_ &= ~(kFakeOpacityCompatible));
101 flag ? (mock_flags_ |= kFakeHasTextureLayer)
102 : (mock_flags_ &= ~(kFakeHasTextureLayer));
107 expected_paint_matrix_ =
matrix;
116 std::optional<SkMatrix> expected_paint_matrix_;
118 static constexpr int kParentHasPlatformView = 1 << 0;
119 static constexpr int kParentHasTextureLayer = 1 << 1;
120 static constexpr int kFakeHasPlatformView = 1 << 2;
121 static constexpr int kFakeReadsSurface = 1 << 3;
122 static constexpr int kFakeOpacityCompatible = 1 << 4;
123 static constexpr int kFakeHasTextureLayer = 1 << 5;
135 return std::make_shared<MockCacheableContainerLayer>(
true);
141 return std::make_shared<MockCacheableContainerLayer>();
158 int render_limit = 3)
161 std::make_unique<MockLayerCacheableItem>(
this, render_limit);
165 return raster_cache_item_.get();
171 std::unique_ptr<LayerRasterCacheItem> raster_cache_item_;
LayerRasterCacheItem(Layer *layer, int layer_cached_threshold=1, bool can_cache_children=false)
static std::shared_ptr< MockCacheableContainerLayer > CacheLayerOnly()
MockCacheableContainerLayer(bool cache_children=false)
void Preroll(PrerollContext *context) override
static std::shared_ptr< MockCacheableContainerLayer > CacheLayerOrChildren()
const LayerRasterCacheItem * raster_cache_item() const
MockCacheableLayer(const SkPath &path, DlPaint paint=DlPaint(), int render_limit=3)
void Preroll(PrerollContext *context) override
bool IsReplacing(DiffContext *context, const Layer *layer) const override
bool parent_has_platform_view()
bool fake_reads_surface()
const MockLayer * as_mock_layer() const override
bool fake_has_platform_view()
MockLayer & set_parent_has_platform_view(bool flag)
void set_expected_paint_matrix(const SkMatrix &matrix)
static std::shared_ptr< MockLayer > MakeOpacityCompatible(const SkPath &path)
static std::shared_ptr< MockLayer > Make(const SkPath &path, DlPaint paint=DlPaint())
const SkRect & parent_cull_rect()
MockLayer & set_parent_has_texture_layer(bool flag)
MockLayer & set_fake_has_texture_layer(bool flag)
MockLayer & set_fake_has_platform_view(bool flag)
void Diff(DiffContext *context, const Layer *old_layer) override
void Preroll(PrerollContext *context) override
MockLayer & set_fake_reads_surface(bool flag)
bool parent_has_texture_layer()
bool fake_opacity_compatible()
bool fake_has_texture_layer()
MockLayer(const SkPath &path, DlPaint paint=DlPaint())
const SkMatrix & parent_matrix()
MockLayer & set_fake_opacity_compatible(bool flag)
void Paint(PaintContext &context) const override
const MutatorsStack & parent_mutators()
FlutterSemanticsFlag flag
unsigned useCenter Optional< SkMatrix > matrix
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static constexpr SkRect MakeEmpty()