@@ -47,28 +47,39 @@ TEST(ScrollContentViewShadowNodeTest, leavesStyleWithoutInsets) {
4747 EXPECT_FALSE (style.padding (Edge::Start).isDefined ());
4848}
4949
50- TEST (ScrollContentViewShadowNodeTest, padsRowOnTopOfResolvedPadding ) {
50+ TEST (ScrollContentViewShadowNodeTest, raisesRowPaddingToTheInset ) {
5151 yoga::Style style;
5252 style.setPadding (Edge::Horizontal, StyleLength::points (16 ));
5353
5454 ScrollContentViewShadowNode::padForSafeArea (
5555 style, stateWith ({.left = 0 , .top = 0 , .right = 84 , .bottom = 0 }), kLTR );
5656
5757 EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (16 ));
58- EXPECT_EQ (style.padding (Edge::End), StyleLength::points (100 ));
58+ EXPECT_EQ (style.padding (Edge::End), StyleLength::points (84 ));
5959 EXPECT_FALSE (style.padding (Edge::Left).isDefined ());
6060 EXPECT_FALSE (style.padding (Edge::Right).isDefined ());
6161}
6262
63+ TEST (ScrollContentViewShadowNodeTest, keepsPaddingLargerThanTheInset) {
64+ yoga::Style style;
65+ style.setPadding (Edge::Horizontal, StyleLength::points (100 ));
66+
67+ ScrollContentViewShadowNode::padForSafeArea (
68+ style, stateWith ({.left = 0 , .top = 0 , .right = 84 , .bottom = 0 }), kLTR );
69+
70+ EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (100 ));
71+ EXPECT_EQ (style.padding (Edge::End), StyleLength::points (100 ));
72+ }
73+
6374TEST (ScrollContentViewShadowNodeTest, prefersLogicalOverPhysicalEdge) {
6475 yoga::Style style;
6576 style.setPadding (Edge::Left, StyleLength::points (4 ));
66- style.setPadding (Edge::Start, StyleLength::points (12 ));
77+ style.setPadding (Edge::Start, StyleLength::points (40 ));
6778
6879 ScrollContentViewShadowNode::padForSafeArea (
6980 style, stateWith ({.left = 20 , .top = 0 , .right = 0 , .bottom = 0 }), kLTR );
7081
71- EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (32 ));
82+ EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (40 ));
7283}
7384
7485TEST (ScrollContentViewShadowNodeTest, keepsPercentageAndSkipsInsetOnThatEdge) {
@@ -92,7 +103,7 @@ TEST(ScrollContentViewShadowNodeTest, padsPointsEdgeBesideAPercentageEdge) {
92103 style, stateWith ({.left = 20 , .top = 0 , .right = 84 , .bottom = 0 }), kLTR );
93104
94105 EXPECT_EQ (style.padding (Edge::Start), StyleLength::percent (10 ));
95- EXPECT_EQ (style.padding (Edge::End), StyleLength::points (88 ));
106+ EXPECT_EQ (style.padding (Edge::End), StyleLength::points (84 ));
96107}
97108
98109TEST (ScrollContentViewShadowNodeTest, padsPhysicalEdgesInRTL) {
@@ -103,7 +114,7 @@ TEST(ScrollContentViewShadowNodeTest, padsPhysicalEdgesInRTL) {
103114 style, stateWith ({.left = 0 , .top = 0 , .right = 84 , .bottom = 0 }), kRTL );
104115
105116 // In RTL the start edge is on the right, where the inset is.
106- EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (96 ));
117+ EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (84 ));
107118 EXPECT_FALSE (style.padding (Edge::End).isDefined ());
108119}
109120
@@ -118,15 +129,15 @@ TEST(ScrollContentViewShadowNodeTest, readsSwappedPhysicalEdgesInRTL) {
118129 kRTL );
119130
120131 // Left is copied over start at layout, so it lands on the right, and the
121- // inset on the left adds to the end edge.
132+ // inset on the left raises the end edge.
122133 EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (8 ));
123- EXPECT_EQ (style.padding (Edge::End), StyleLength::points (86 ));
134+ EXPECT_EQ (style.padding (Edge::End), StyleLength::points (84 ));
124135 EXPECT_FALSE (style.padding (Edge::Left).isDefined ());
125136}
126137
127138TEST (ScrollContentViewShadowNodeTest, readsSwappedPhysicalEdgesInLTRSubtree) {
128139 yoga::Style style;
129- style.setPadding (Edge::Left, StyleLength::points (8 ));
140+ style.setPadding (Edge::Left, StyleLength::points (100 ));
130141 style.setPadding (Edge::Start, StyleLength::points (2 ));
131142
132143 ScrollContentViewShadowNode::padForSafeArea (
@@ -136,7 +147,7 @@ TEST(ScrollContentViewShadowNodeTest, readsSwappedPhysicalEdgesInLTRSubtree) {
136147
137148 // The swap applies to the whole tree, so left is still copied over start,
138149 // which a node laid out left to right keeps on the left.
139- EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (92 ));
150+ EXPECT_EQ (style.padding (Edge::Start), StyleLength::points (100 ));
140151 EXPECT_FALSE (style.padding (Edge::End).isDefined ());
141152}
142153
@@ -147,8 +158,8 @@ TEST(ScrollContentViewShadowNodeTest, padsColumnForHorizontalScrollView) {
147158 ScrollContentViewShadowNode::padForSafeArea (
148159 style, stateWith ({.left = 0 , .top = 20 , .right = 0 , .bottom = 34 }), kLTR );
149160
150- EXPECT_EQ (style.padding (Edge::Top), StyleLength::points (24 ));
151- EXPECT_EQ (style.padding (Edge::Bottom), StyleLength::points (38 ));
161+ EXPECT_EQ (style.padding (Edge::Top), StyleLength::points (20 ));
162+ EXPECT_EQ (style.padding (Edge::Bottom), StyleLength::points (34 ));
152163 EXPECT_EQ (style.padding (Edge::Vertical), StyleLength::points (4 ));
153164}
154165
0 commit comments