Core test: labels inside percentage-width flex children should have non-zero width after layout. If they don't, the tab labels are invisible.
| 135 | // Core test: labels inside percentage-width flex children should have |
| 136 | // non-zero width after layout. If they don't, the tab labels are invisible. |
| 137 | TEST_F(TabBarLayoutTest, tabLabelsGetNonZeroWidth) { |
| 138 | auto l = buildTabBar(2); |
| 139 | g_measureRecords.clear(); |
| 140 | |
| 141 | // Parent container size: iPhone 14 Pro (393×44 for tab bar area) |
| 142 | YGNodeCalculateLayout(l.root, 393, 44, YGDirectionLTR); |
| 143 | |
| 144 | float label0Width = YGNodeLayoutGetWidth(l.label0); |
| 145 | float label1Width = YGNodeLayoutGetWidth(l.label1); |
| 146 | |
| 147 | // Dump measure constraints for debugging |
| 148 | for (size_t i = 0; i < g_measureRecords.size(); i++) { |
| 149 | const auto& r = g_measureRecords[i]; |
| 150 | const char* wMode = r.widthMode == YGMeasureModeExactly ? "Exactly" : |
| 151 | r.widthMode == YGMeasureModeAtMost ? "AtMost" : "Undefined"; |
| 152 | const char* hMode = r.heightMode == YGMeasureModeExactly ? "Exactly" : |
| 153 | r.heightMode == YGMeasureModeAtMost ? "AtMost" : "Undefined"; |
| 154 | fprintf(stderr, "Measure[%zu]: w=%.1f(%s) h=%.1f(%s)\n", |
| 155 | i, r.width, wMode, r.height, hMode); |
| 156 | } |
| 157 | |
| 158 | fprintf(stderr, "label0: %.1f x %.1f\n", label0Width, YGNodeLayoutGetHeight(l.label0)); |
| 159 | fprintf(stderr, "label1: %.1f x %.1f\n", label1Width, YGNodeLayoutGetHeight(l.label1)); |
| 160 | fprintf(stderr, "item0: %.1f x %.1f\n", |
| 161 | YGNodeLayoutGetWidth(l.item0), YGNodeLayoutGetHeight(l.item0)); |
| 162 | fprintf(stderr, "itemContainer: %.1f x %.1f\n", |
| 163 | YGNodeLayoutGetWidth(l.itemContainer), YGNodeLayoutGetHeight(l.itemContainer)); |
| 164 | fprintf(stderr, "scrollView: %.1f x %.1f\n", |
| 165 | YGNodeLayoutGetWidth(l.scrollView), YGNodeLayoutGetHeight(l.scrollView)); |
| 166 | |
| 167 | EXPECT_GT(label0Width, 0) |
| 168 | << "Label 0 has zero width — tab name invisible."; |
| 169 | EXPECT_GT(label1Width, 0) |
| 170 | << "Label 1 has zero width — tab name invisible."; |
| 171 | } |
| 172 | |
| 173 | // Verify measure function is NOT called with zero-width constraints |
| 174 | TEST_F(TabBarLayoutTest, measureFunctionNeverGetsZeroWidthConstraint) { |
nothing calls this directly
no test coverage detected