Commit c1bd6f87 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Fix paintBounds/semanticBounds of RenderSliver (#11781)

* Fix paintBounds/semanticsBounds of RenderSliver

* another test
parent 631eaa45
......@@ -951,14 +951,14 @@ abstract class RenderSliver extends RenderObject {
case Axis.horizontal:
return new Rect.fromLTWH(
0.0, 0.0,
geometry.paintExtent,
constraints.crossAxisExtent,
geometry.paintExtent
);
case Axis.vertical:
return new Rect.fromLTWH(
0.0, 0.0,
constraints.crossAxisExtent,
geometry.paintExtent,
constraints.crossAxisExtent
);
}
return null;
......
......@@ -678,4 +678,46 @@ void main() {
),
);
});
test('Sliver paintBounds and semanticBounds - vertical', () {
const double height = 150.0;
final RenderSliver sliver = new RenderSliverToBoxAdapter(
child: new RenderSizedBox(const Size(400.0, height)),
);
final RenderViewport root = new RenderViewport(
axisDirection: AxisDirection.down,
offset: new ViewportOffset.zero(),
children: <RenderSliver>[
sliver,
],
);
layout(root);
final Rect expectedRect = new Rect.fromLTWH(0.0, 0.0, root.size.width, height);
expect(sliver.paintBounds, expectedRect);
expect(sliver.semanticBounds, expectedRect);
});
test('Sliver paintBounds and semanticBounds - horizontal', () {
const double width = 150.0;
final RenderSliver sliver = new RenderSliverToBoxAdapter(
child: new RenderSizedBox(const Size(width, 400.0)),
);
final RenderViewport root = new RenderViewport(
axisDirection: AxisDirection.right,
offset: new ViewportOffset.zero(),
children: <RenderSliver>[
sliver,
],
);
layout(root);
final Rect expectedRect = new Rect.fromLTWH(0.0, 0.0, width, root.size.height);
expect(sliver.paintBounds, expectedRect);
expect(sliver.semanticBounds, expectedRect);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment