Flutter Engine
The Flutter Engine
embedder_frozen_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/platform/embedder/embedder.h"
6#include "flutter/shell/platform/embedder/tests/embedder_frozen.h"
7#include "flutter/testing/testing.h"
8
9namespace flutter {
10namespace testing {
11
12// Assert that both types have the same member with the same offset.
13// This prevents reordering of "frozen" embedder API struct members.
14#define ASSERT_EQ_OFFSET(type1, type2, member) \
15 ASSERT_EQ(offsetof(type1, member), offsetof(type2, member))
16
17// New members must not be added to `FlutterTransformation`
18// as it would break the ABI of `FlutterSemanticsNode`.
19// See: https://github.com/flutter/flutter/issues/121176
20TEST(EmbedderFrozen, FlutterTransformationIsFrozen) {
30}
31
32// New members must not be added to `FlutterRect` as it would
33// break the ABI of `FlutterSemanticsNode` and `FlutterDamage`.
34// See: https://github.com/flutter/flutter/issues/121176
35// See: https://github.com/flutter/flutter/issues/121347
36TEST(EmbedderFrozen, FlutterRectIsFrozen) {
41}
42
43// New members must not be added to `FlutterPoint` as it would
44// break the ABI of `FlutterLayer`.
45TEST(EmbedderFrozen, FlutterPointIsFrozen) {
48}
49
50// New members must not be added to `FlutterDamage` as it would
51// break the ABI of `FlutterPresentInfo`.
52TEST(EmbedderFrozen, FlutterDamageIsFrozen) {
56}
57
58// New members must not be added to `FlutterSemanticsNode`
59// as it would break the ABI of `FlutterSemanticsUpdate`.
60// See: https://github.com/flutter/flutter/issues/121176
61TEST(EmbedderFrozen, FlutterSemanticsNodeIsFrozen) {
62 ASSERT_EQ(sizeof(FlutterSemanticsNode), sizeof(FrozenFlutterSemanticsNode));
63
65 struct_size);
70 text_selection_base);
72 text_selection_extent);
74 scroll_child_count);
76 scroll_index);
78 scroll_position);
80 scroll_extent_max);
82 scroll_extent_min);
89 increased_value);
91 decreased_value);
93 text_direction);
97 child_count);
99 children_in_traversal_order);
101 children_in_hit_test_order);
103 custom_accessibility_actions_count);
105 custom_accessibility_actions);
107 platform_view_id);
109}
110
111// New members must not be added to `FlutterSemanticsCustomAction`
112// as it would break the ABI of `FlutterSemanticsUpdate`.
113// See: https://github.com/flutter/flutter/issues/121176
114TEST(EmbedderFrozen, FlutterSemanticsCustomActionIsFrozen) {
115 ASSERT_EQ(sizeof(FlutterSemanticsCustomAction),
117
123 FrozenFlutterSemanticsCustomAction, override_action);
128}
129
130} // namespace testing
131} // namespace flutter
#define ASSERT_EQ_OFFSET(type1, type2, member)
FlutterSemanticsFlag flags
uint8_t value
double y
double x
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
TEST(DisplayListComplexity, EmptyDisplayList)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
A structure to represent a damage region.
Definition: embedder.h:460
A structure to represent a 2D point.
Definition: embedder.h:445
A structure to represent a rectangle.
Definition: embedder.h:437