mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Fix layout exception when text is null (flutter/engine#23653)
This commit is contained in:
parent
8af69442c0
commit
a21b2be8bb
@ -71,6 +71,10 @@ class TextLayoutService {
|
||||
didExceedMaxLines = false;
|
||||
lines.clear();
|
||||
|
||||
if (spanCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Spanometer spanometer = Spanometer(paragraph, context);
|
||||
|
||||
int spanIndex = 0;
|
||||
|
||||
@ -42,6 +42,16 @@ void main() {
|
||||
void testMain() async {
|
||||
await ui.webOnlyInitializeTestDomRenderer();
|
||||
|
||||
test('no text', () {
|
||||
final CanvasParagraph paragraph = CanvasParagraphBuilder(ahemStyle).build();
|
||||
paragraph.layout(constrain(double.infinity));
|
||||
|
||||
expect(paragraph.maxIntrinsicWidth, 0);
|
||||
expect(paragraph.minIntrinsicWidth, 0);
|
||||
expect(paragraph.height, 0);
|
||||
expect(paragraph.computeLineMetrics(), isEmpty);
|
||||
});
|
||||
|
||||
test('preserves whitespace when measuring', () {
|
||||
CanvasParagraph paragraph;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user