5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_ASSERTIONS_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_ASSERTIONS_H_
14#include "gtest/gtest.h"
15#include "third_party/skia/include/core/SkPoint.h"
16#include "third_party/skia/include/core/SkSize.h"
42 return a.
rect == b.rect &&
65 return a.
target == b.target && a.
name == b.name &&
89 return a.
image == b.image;
99 if (!(a.
type == b.type)) {
135 if (!(a.
rects[
i] == b.rects[
i])) {
160 return a.
metal == b.metal;
162 return a.
vulkan == b.vulkan;
172 if (a.
type != b.type) {
228 return out <<
"(" << point.
x <<
", " << point.
y <<
")";
232 return out <<
"LTRB (" << r.
left <<
", " << r.
top <<
", " << r.
right <<
", "
237 return out <<
"(" << size.width <<
", " << size.height <<
")";
242 out <<
"Rect: " << r.
rect <<
", ";
252 out <<
"Scale X: " << t.
scaleX <<
", ";
253 out <<
"Skew X: " << t.
skewX <<
", ";
254 out <<
"Trans X: " << t.
transX <<
", ";
255 out <<
"Skew Y: " << t.
skewY <<
", ";
256 out <<
"Scale Y: " << t.
scaleY <<
", ";
257 out <<
"Trans Y: " << t.
transY <<
", ";
258 out <<
"Pers 0: " << t.
pers0 <<
", ";
259 out <<
"Pers 1: " << t.
pers1 <<
", ";
260 out <<
"Pers 2: " << t.
pers2;
268 return "kFlutterLayerContentTypeBackingStore";
270 return "kFlutterLayerContentTypePlatformView";
279 return "kFlutterBackingStoreTypeOpenGL";
281 return "kFlutterBackingStoreTypeSoftware";
283 return "kFlutterBackingStoreTypeMetal";
285 return "kFlutterBackingStoreTypeVulkan";
287 return "kFlutterBackingStoreTypeSoftware2";
294 return out <<
"(FlutterOpenGLTexture) Target: 0x" << std::hex << item.
target
295 << std::dec <<
" Name: " << item.
name <<
" Format: " << item.
format
296 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
302 return out <<
"(FlutterOpenGLFramebuffer) Target: 0x" << std::hex
303 << item.
target << std::dec <<
" Name: " << item.
name
304 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
310 return out <<
"(FlutterOpenGLSurface) Make Current Callback: "
313 <<
" Destruction Callback: "
319 return out <<
"(FlutterMetalTexture) Texture ID: " << std::hex
320 << item.
texture_id << std::dec <<
" Handle: 0x" << std::hex
326 return out <<
"(FlutterVulkanTexture) Image Handle: " << std::hex
327 << item.
image << std::dec <<
" Format: " << item.
format;
334 return "kFlutterPlatformViewMutationTypeOpacity";
336 return "kFlutterPlatformViewMutationTypeClipRect";
338 return "kFlutterPlatformViewMutationTypeClipRoundedRect";
340 return "kFlutterPlatformViewMutationTypeTransformation";
347 out <<
"(FlutterPlatformViewMutation) Type: "
351 out <<
"Opacity: " << m.
opacity;
365 <<
"(FlutterPlatformView) Struct Size: " <<
platform_view.struct_size
386 return "kFlutterOpenGLTargetTypeTexture";
388 return "kFlutterOpenGLTargetTypeFramebuffer";
390 return "kFlutterOpenGLTargetTypeSurface";
399 return "kFlutterSoftwarePixelFormatGray8";
401 return "kFlutterSoftwarePixelFormatRGB565";
403 return "kFlutterSoftwarePixelFormatRGBA4444";
405 return "kFlutterSoftwarePixelFormatRGBA8888";
407 return "kFlutterSoftwarePixelFormatRGBX8888";
409 return "kFlutterSoftwarePixelFormatBGRA8888";
411 return "kFlutterSoftwarePixelFormatNative32";
413 FML_LOG(ERROR) <<
"Invalid software rendering pixel format";
420 out <<
"(FlutterOpenGLBackingStore) Type: "
438 return out <<
"(FlutterSoftwareBackingStore) Allocation: " << item.
allocation
440 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
446 return out <<
"(FlutterMetalBackingStore) Texture: " << item.
texture;
451 return out <<
"(FlutterVulkanBackingStore) Image: " << item.
image;
456 return out <<
"(FlutterSoftwareBackingStore2) Allocation: " << item.
allocation
458 <<
" User Data: " << item.
user_data <<
" Destruction Callback: "
466 out <<
"(FlutterBackingStore) Struct size: " << backing_store.
struct_size
467 <<
" User Data: " << backing_store.
user_data
471 switch (backing_store.
type) {
481 out << backing_store.
metal;
485 out << backing_store.
vulkan;
497 out <<
"(Flutter Layer) Struct size: " << layer.
struct_size
500 switch (layer.
type) {
509 return out <<
" Offset: " << layer.
offset <<
" Size: " << layer.
size;
532 size.width = vector.x();
533 size.height = vector.y();
540 transformation.
scaleX = matrix.
m[0];
541 transformation.
skewX = matrix.
m[4];
542 transformation.
transX = matrix.
m[12];
543 transformation.
skewY = matrix.
m[1];
544 transformation.
scaleY = matrix.
m[5];
545 transformation.
transY = matrix.
m[13];
546 transformation.
pers0 = matrix.
m[3];
547 transformation.
pers1 = matrix.
m[7];
548 transformation.
pers2 = matrix.
m[15];
549 return transformation;
557 0.0f, 0.0f, 1.0f, 0.0f,
569 r.
left = rect.left();
571 r.
right = rect.right();
@ 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
@ kFlutterOpenGLTargetTypeSurface
@ 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
flutter::DlMatrix DlMatrixMake(const FlutterTransformation &xformation)
std::string FlutterSoftwarePixelFormatToString(FlutterSoftwarePixelFormat pixfmt)
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
FlutterSize FlutterSizeMake(double width, double height)
std::string FlutterOpenGLTargetTypeToString(FlutterOpenGLTargetType type)
std::ostream & operator<<(std::ostream &out, const FlutterPoint &point)
FlutterRect FlutterRectMake(const SkRect &rect)
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)
FlutterTransformation FlutterTransformationMake(const flutter::DlMatrix &matrix)
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)
bool NumberNear(double a, double b)
impeller::Matrix DlMatrix
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).
FlutterRegion * paint_region
size_t struct_size
The size of this struct. Must be sizeof(FlutterBackingStorePresentInfo).
FlutterLayerContentType type
const FlutterBackingStore * backing_store
FlutterBackingStorePresentInfo * backing_store_present_info
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
FlutterOpenGLSurface surface
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.
VoidCallback destruction_callback
FlutterOpenGLSurfaceCallback make_current_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.
size_t rects_count
Number of rectangles in the region.
FlutterRect * rects
The rectangles that make up the region.
size_t struct_size
The size of this struct. Must be sizeof(FlutterRegion).
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).
A 4x4 matrix using column-major storage.
constexpr auto GetBottom() const
constexpr auto GetTop() const
constexpr auto GetLeft() const
constexpr auto GetRight() const