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

Function TEST_F

third-party/yoga/test/SegmentedProgressBarLayout_test.cpp:127–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125};
126
127TEST_F(SegmentedProgressBarLayoutTest, ReproducesCompressedProgressBar) {
128 auto l = buildFullHierarchy();
129 YGNodeCalculateLayout(l.root, SCREEN_WIDTH, SCREEN_HEIGHT, YGDirectionLTR);
130
131 float toolbarWidth = YGNodeLayoutGetWidth(l.toolbar);
132 float containerWidth = YGNodeLayoutGetWidth(l.thumbnailContainer);
133 float scrollWidth = YGNodeLayoutGetWidth(l.scroll);
134 float progressBarWidth = YGNodeLayoutGetWidth(l.progressBar);
135
136 printf("Yoga 2.x (no errata):\n");
137 printf(" toolbar width: %.1f\n", toolbarWidth);
138 printf(" container width: %.1f\n", containerWidth);
139 printf(" scroll width: %.1f\n", scrollWidth);
140 printf(" progressBar width: %.1f\n", progressBarWidth);
141
142 for (int i = 0; i < NUM_SEGMENTS; i++) {
143 float w = YGNodeLayoutGetWidth(l.segments[i]);
144 printf(" segment[%d] width: %.1f\n", i, w);
145 }
146
147 // The bug: container collapses to content width instead of full toolbar width
148 // because alignItems: flex-start doesn't stretch children
149 bool isCompressed = containerWidth < SCREEN_WIDTH * 0.5f;
150 EXPECT_TRUE(isCompressed) << "Expected container to be compressed to < 50% screen width to confirm the bug exists";
151 if (isCompressed) {
152 printf("\n ** BUG CONFIRMED: container is compressed to %.1f (< half screen)\n",
153 containerWidth);
154 }
155
156 YGNodeFreeRecursive(l.root);
157}
158
159TEST_F(SegmentedProgressBarLayoutTest, ClassicErrataComparison) {
160 YGConfigSetErrata(config, YGErrataClassic);

Callers

nothing calls this directly

Calls 6

YGNodeCalculateLayoutFunction · 0.85
YGNodeLayoutGetWidthFunction · 0.85
YGNodeFreeRecursiveFunction · 0.85
YGConfigSetErrataFunction · 0.85
YGNodeStyleSetAlignSelfFunction · 0.85

Tested by

no test coverage detected