MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST_F

Function TEST_F

third-party/yoga/test/CaptionEditorLayout_test.cpp:203–233  ·  view source on GitHub ↗

Test 1: Basic caption editing layout — textViewWrapper position and size

Source from the content-addressed store, hash-verified

201
202// Test 1: Basic caption editing layout — textViewWrapper position and size
203TEST_F(CaptionEditorLayoutTest, textViewWrapperPositionedCorrectly) {
204 auto l = buildAboveKeyboard(captionTextMeasure);
205 g_captionMeasures.clear();
206
207 YGNodeCalculateLayout(l.root, kScreenWidth, kScreenHeight, YGDirectionLTR);
208 dumpLayout(l);
209
210 // The textViewWrapper should be at x=8 (marginLeft) within the textViewContainer
211 float wrapperLeft = YGNodeLayoutGetLeft(l.textViewWrapper);
212 float wrapperWidth = YGNodeLayoutGetWidth(l.textViewWrapper);
213 float containerWidth = YGNodeLayoutGetWidth(l.textViewContainer);
214
215 EXPECT_FLOAT_EQ(kCaptionMargin, wrapperLeft)
216 << "TextViewWrapper left should be 8 (marginLeft). "
217 "Left-edge clipping means it's positioned incorrectly.";
218
219 EXPECT_FLOAT_EQ(kScreenWidth - 2 * kCaptionMargin, wrapperWidth)
220 << "TextViewWrapper width should be 390 - 16 = 374. "
221 "Wrong width causes text to render outside bounds.";
222
223 EXPECT_FLOAT_EQ(kScreenWidth, containerWidth)
224 << "TextViewContainer should be full width (390).";
225
226 // The textViewContainer should be at x=0 within the captionContainer
227 // (both are 390px wide, centering a 390px child in 390px parent = 0 offset)
228 float containerLeft = YGNodeLayoutGetLeft(l.textViewContainer);
229 EXPECT_FLOAT_EQ(0.0f, containerLeft)
230 << "TextViewContainer should be at x=0 (same width as parent, centering is no-op).";
231
232 YGNodeFreeRecursive(l.root);
233}
234
235// Test 2: Long text that wraps to multiple lines
236TEST_F(CaptionEditorLayoutTest, longTextWrapsWithCorrectBounds) {

Callers

nothing calls this directly

Calls 8

YGNodeCalculateLayoutFunction · 0.85
YGNodeLayoutGetLeftFunction · 0.85
YGNodeLayoutGetWidthFunction · 0.85
YGNodeFreeRecursiveFunction · 0.85
YGNodeLayoutGetHeightFunction · 0.85
YGNodeLayoutGetTopFunction · 0.85
YGNodeStyleSetWidthFunction · 0.85
clearMethod · 0.65

Tested by

no test coverage detected