Test 1: Basic caption editing layout — textViewWrapper position and size
| 201 | |
| 202 | // Test 1: Basic caption editing layout — textViewWrapper position and size |
| 203 | TEST_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 |
| 236 | TEST_F(CaptionEditorLayoutTest, longTextWrapsWithCorrectBounds) { |
nothing calls this directly
no test coverage detected