"
+ + "
"
+ + "
this line of text should wrap before it reaches the floated box on the right
");
+
+ var (root, _) = LayoutHarness.Layout(html);
+ var floatBox = LayoutHarness.FindById(root, "f")!;
+ var text = LayoutHarness.FindById(root, "text")!;
+ var floatLeftEdge = floatBox.Location.X - floatBox.ActualMarginLeft;
+
+ var wordsOverlappingFloat = WordsOverlappingVerticalSpan(text, floatBox.Location.Y, floatBox.ActualBottom);
+
+ Assert.AreNotEqual(0, wordsOverlappingFloat.Count);
+
+ foreach (var word in wordsOverlappingFloat)
+ {
+ Assert.IsTrue(word.Left + word.Width <= floatLeftEdge + 1,
+ $"word '{word.Text}' at right={word.Left + word.Width} overlaps the float:right box, "
+ + $"whose left edge (including margin) is at {floatLeftEdge}");
+ }
+ }
+
+ [TestMethod]
+ public void FloatRight_WithMarginLeft_StillReachesContainingBlockRightEdge()
+ {
+ var html = LayoutHarness.Wrap(
+ "