5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_ASSERTIONS_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_ASSERTIONS_H_
10#include "flutter/fml/logging.h"
11#include "flutter/shell/platform/embedder/embedder.h"
12#include "flutter/shell/platform/embedder/embedder_engine.h"
13#include "flutter/testing/assertions.h"
14#include "gtest/gtest.h"
42 return a.rect ==
b.rect &&
43 a.upper_left_corner_radius ==
b.upper_left_corner_radius &&
44 a.upper_right_corner_radius ==
b.upper_right_corner_radius &&
45 a.lower_right_corner_radius ==
b.lower_right_corner_radius &&
46 a.lower_left_corner_radius ==
b.lower_left_corner_radius;
51 return a.scaleX ==
b.scaleX &&
a.skewX ==
b.skewX &&
a.transX ==
b.transX &&
52 a.skewY ==
b.skewY &&
a.scaleY ==
b.scaleY &&
a.transY ==
b.transY &&
53 a.pers0 ==
b.pers0 &&
a.pers1 ==
b.pers1 &&
a.pers2 ==
b.pers2;
58 return a.target ==
b.target &&
a.name ==
b.name &&
a.format ==
b.format &&
59 a.user_data ==
b.user_data &&
60 a.destruction_callback ==
b.destruction_callback;
65 return a.target ==
b.target &&
a.name ==
b.name &&
66 a.user_data ==
b.user_data &&
67 a.destruction_callback ==
b.destruction_callback;
72 return a.texture_id ==
b.texture_id &&
a.texture ==
b.texture;
77 return a.image ==
b.image &&
a.format ==
b.format;
82 return a.image ==
b.image;
87 return a.texture ==
b.texture;
92 if (!(
a.type ==
b.type)) {
98 return a.texture ==
b.texture;
100 return a.framebuffer ==
b.framebuffer;
108 return a.allocation ==
b.allocation &&
a.row_bytes ==
b.row_bytes &&
109 a.height ==
b.height &&
a.user_data ==
b.user_data &&
110 a.destruction_callback ==
b.destruction_callback;
115 return a.allocation ==
b.allocation &&
a.row_bytes ==
b.row_bytes &&
116 a.height ==
b.height &&
a.user_data ==
b.user_data &&
117 a.destruction_callback ==
b.destruction_callback &&
118 a.pixel_format ==
b.pixel_format;
122 if (
a.struct_size !=
b.struct_size ||
a.rects_count !=
b.rects_count) {
125 for (
size_t i = 0;
i <
a.rects_count;
i++) {
126 if (!(
a.rects[
i] ==
b.rects[
i])) {
135 return a.struct_size ==
b.struct_size && *
a.paint_region == *
b.paint_region;
140 if (!(
a.struct_size ==
b.struct_size &&
a.user_data ==
b.user_data &&
141 a.type ==
b.type &&
a.did_update ==
b.did_update)) {
147 return a.open_gl ==
b.open_gl;
149 return a.software ==
b.software;
151 return a.metal ==
b.metal;
153 return a.vulkan ==
b.vulkan;
155 return a.software2 ==
b.software2;
163 if (
a.type !=
b.type) {
171 return a.clip_rect ==
b.clip_rect;
173 return a.clip_rounded_rect ==
b.clip_rounded_rect;
175 return a.transformation ==
b.transformation;
183 if (!(
a.struct_size ==
b.struct_size &&
a.identifier ==
b.identifier &&
184 a.mutations_count ==
b.mutations_count)) {
188 for (
size_t i = 0;
i <
a.mutations_count; ++
i) {
189 if (!(*
a.mutations[
i] == *
b.mutations[
i])) {
198 if (!(
a.struct_size ==
b.struct_size &&
a.type ==
b.type &&
199 a.offset ==
b.offset &&
a.size ==
b.size)) {
205 return *
a.backing_store == *
b.backing_store &&
206 *
a.backing_store_present_info == *
b.backing_store_present_info;
208 return *
a.platform_view == *
b.platform_view;
219 return out <<
"(" << point.
x <<
", " << point.
y <<
")";
223 return out <<
"LTRB (" << r.
left <<
", " << r.
top <<
", " << r.
right <<
", "
228 return out <<
"(" <<
size.width <<
", " <<
size.height <<
")";
233 out <<
"Rect: " << r.
rect <<
", ";
244 out <<
"Skew X: " << t.
skewX <<
", ";
246 out <<
"Skew Y: " << t.
skewY <<
", ";
249 out <<
"Pers 0: " << t.
pers0 <<
", ";
250 out <<
"Pers 1: " << t.
pers1 <<
", ";
259 return "kFlutterLayerContentTypeBackingStore";
261 return "kFlutterLayerContentTypePlatformView";
270 return "kFlutterBackingStoreTypeOpenGL";
272 return "kFlutterBackingStoreTypeSoftware";
274 return "kFlutterBackingStoreTypeMetal";
276 return "kFlutterBackingStoreTypeVulkan";
278 return "kFlutterBackingStoreTypeSoftware2";
285 return out <<
"(FlutterOpenGLTexture) Target: 0x" << std::hex << item.
target
286 << std::dec <<
" Name: " << item.
name <<
" Format: " << item.
format
287 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
293 return out <<
"(FlutterOpenGLFramebuffer) Target: 0x" << std::hex
294 << item.
target << std::dec <<
" Name: " << item.
name
295 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
301 return out <<
"(FlutterMetalTexture) Texture ID: " << std::hex
302 << item.
texture_id << std::dec <<
" Handle: 0x" << std::hex
308 return out <<
"(FlutterVulkanTexture) Image Handle: " << std::hex
309 << item.
image << std::dec <<
" Format: " << item.
format;
316 return "kFlutterPlatformViewMutationTypeOpacity";
318 return "kFlutterPlatformViewMutationTypeClipRect";
320 return "kFlutterPlatformViewMutationTypeClipRoundedRect";
322 return "kFlutterPlatformViewMutationTypeTransformation";
329 out <<
"(FlutterPlatformViewMutation) Type: "
333 out <<
"Opacity: " <<
m.opacity;
335 out <<
"Clip Rect: " <<
m.clip_rect;
337 out <<
"Clip Rounded Rect: " <<
m.clip_rounded_rect;
339 out <<
"Transformation: " <<
m.transformation;
347 <<
"(FlutterPlatformView) Struct Size: " <<
platform_view.struct_size
368 return "kFlutterOpenGLTargetTypeTexture";
370 return "kFlutterOpenGLTargetTypeFramebuffer";
379 return "kFlutterSoftwarePixelFormatGray8";
381 return "kFlutterSoftwarePixelFormatRGB565";
383 return "kFlutterSoftwarePixelFormatRGBA4444";
385 return "kFlutterSoftwarePixelFormatRGBA8888";
387 return "kFlutterSoftwarePixelFormatRGBX8888";
389 return "kFlutterSoftwarePixelFormatBGRA8888";
391 return "kFlutterSoftwarePixelFormatNative32";
393 FML_LOG(
ERROR) <<
"Invalid software rendering pixel format";
400 out <<
"(FlutterOpenGLBackingStore) Type: "
415 return out <<
"(FlutterSoftwareBackingStore) Allocation: " << item.
allocation
417 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
423 return out <<
"(FlutterMetalBackingStore) Texture: " << item.
texture;
428 return out <<
"(FlutterVulkanBackingStore) Image: " << item.
image;
433 return out <<
"(FlutterSoftwareBackingStore2) Allocation: " << item.
allocation
435 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
443 out <<
"(FlutterBackingStore) Struct size: " << backing_store.
struct_size
444 <<
" User Data: " << backing_store.
user_data
448 switch (backing_store.
type) {
477 switch (layer.
type) {
486 return out <<
" Offset: " << layer.
offset <<
" Size: " << layer.
size;
509 size.width = vector.
x();
510 size.height = vector.
y();
525 return transformation;
static constexpr int kMScaleX
horizontal scale factor
static constexpr int kMTransY
vertical translation
static constexpr int kMPersp1
input y perspective factor
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
static constexpr int kMPersp0
input x perspective factor
static constexpr int kMPersp2
perspective bias
static constexpr int kMTransX
horizontal translation
static constexpr int kMSkewY
vertical skew factor
static constexpr int kMScaleY
vertical scale factor
static constexpr int kMSkewX
horizontal skew factor
@ kFlutterLayerContentTypePlatformView
Indicates that the contents of this layer are determined by the embedder.
@ kFlutterLayerContentTypeBackingStore
FlutterPlatformViewMutationType
@ kFlutterPlatformViewMutationTypeClipRoundedRect
@ kFlutterPlatformViewMutationTypeClipRect
@ kFlutterPlatformViewMutationTypeTransformation
@ kFlutterPlatformViewMutationTypeOpacity
FlutterSoftwarePixelFormat
@ kFlutterSoftwarePixelFormatRGBA4444
@ kFlutterSoftwarePixelFormatRGBA8888
@ kFlutterSoftwarePixelFormatBGRA8888
@ kFlutterSoftwarePixelFormatGray8
@ kFlutterSoftwarePixelFormatNative32
@ kFlutterSoftwarePixelFormatRGBX8888
@ kFlutterSoftwarePixelFormatRGB565
@ kFlutterOpenGLTargetTypeFramebuffer
@ kFlutterOpenGLTargetTypeTexture
@ kFlutterBackingStoreTypeSoftware2
@ kFlutterBackingStoreTypeMetal
Specifies a Metal backing store. This is backed by a Metal texture.
@ kFlutterBackingStoreTypeVulkan
Specifies a Vulkan backing store. This is backed by a Vulkan VkImage.
@ kFlutterBackingStoreTypeSoftware
Specified an software allocation for Flutter to render into using the CPU.
@ kFlutterBackingStoreTypeOpenGL
std::string FlutterSoftwarePixelFormatToString(FlutterSoftwarePixelFormat pixfmt)
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
FlutterSize FlutterSizeMake(double width, double height)
FlutterTransformation FlutterTransformationMake(const SkMatrix &matrix)
std::string FlutterOpenGLTargetTypeToString(FlutterOpenGLTargetType type)
std::ostream & operator<<(std::ostream &out, const FlutterPoint &point)
FlutterRect FlutterRectMake(const SkRect &rect)
SkMatrix SkMatrixMake(const FlutterTransformation &xformation)
std::string FlutterPlatformViewMutationTypeToString(FlutterPlatformViewMutationType type)
std::string FlutterBackingStoreTypeToString(FlutterBackingStoreType type)
FlutterRect FlutterRectMakeLTRB(double l, double t, double r, double b)
FlutterPoint FlutterPointMake(double x, double y)
SkRect SkRectMake(const FlutterRect &rect)
std::string FlutterLayerContentTypeToString(FlutterLayerContentType type)
flutter::EmbedderEngine * ToEmbedderEngine(const FlutterEngine &engine)
FlutterRoundedRect FlutterRoundedRectMake(const SkRRect &rect)
#define FML_LOG(severity)
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< SkBlender > blender SkRect rect
bool NumberNear(double a, double b)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
FlutterVulkanBackingStore vulkan
FlutterMetalBackingStore metal
FlutterBackingStoreType type
Specifies the type of backing store.
FlutterOpenGLBackingStore open_gl
The description of the OpenGL backing store.
FlutterSoftwareBackingStore software
The description of the software backing store.
FlutterSoftwareBackingStore2 software2
The description of the software backing store.
size_t struct_size
The size of this struct. Must be sizeof(FlutterBackingStore).
FlutterLayerContentType type
const FlutterBackingStore * backing_store
const FlutterPlatformView * platform_view
size_t struct_size
This size of this struct. Must be sizeof(FlutterLayer).
FlutterSize size
The size of the layer (in physical pixels).
FlutterMetalTextureHandle texture
FlutterOpenGLTexture texture
A texture for Flutter to render into.
FlutterOpenGLTargetType type
FlutterOpenGLFramebuffer framebuffer
uint32_t name
The name of the framebuffer.
VoidCallback destruction_callback
void * user_data
User data to be returned on the invocation of the destruction callback.
uint32_t name
The name of the texture.
VoidCallback destruction_callback
void * user_data
User data to be returned on the invocation of the destruction callback.
uint32_t format
The texture format (example GL_RGBA8).
A structure to represent a 2D point.
A structure to represent a rectangle.
A region represented by a collection of non-overlapping rectangles.
A structure to represent a rounded rectangle.
FlutterSize upper_left_corner_radius
FlutterSize lower_left_corner_radius
FlutterSize upper_right_corner_radius
FlutterSize lower_right_corner_radius
A structure to represent the width and height.
VoidCallback destruction_callback
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.
FlutterSoftwarePixelFormat pixel_format
VoidCallback destruction_callback
size_t row_bytes
The number of bytes in a single row of the allocation.
size_t height
The number of rows in the allocation.
const FlutterVulkanImage * image
FlutterVulkanImageHandle image
uint32_t format
The VkFormat of the image (for example: VK_FORMAT_R8G8B8A8_UNORM).
constexpr float y() const
constexpr float x() const
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)