Unverified Commit 59fc9216 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

add missing trailing commas (#81065)

parent 84bc2382
......@@ -114,13 +114,14 @@ void main() {
});
expect(errors, hasLength(2));
expect(errors.first.exception, isFlutterError);
expect((errors.first.exception as FlutterError).toStringDeep(),
expect(
(errors.first.exception as FlutterError).toStringDeep(),
'FlutterError\n'
' RenderAspectRatio has unbounded constraints.\n'
' This RenderAspectRatio was given an aspect ratio of 0.5 but was\n'
' given both unbounded width and unbounded height constraints.\n'
' Because both constraints were unbounded, this render object\n'
" doesn't know how much size to consume.\n"
" doesn't know how much size to consume.\n",
);
// The second error message is a generic message generated by the Dart VM. Not worth testing.
});
......
......@@ -69,7 +69,7 @@ void main() {
' MissingPerformLayoutRenderBox did not implement performLayout().\n'
' RenderBox subclasses need to either override performLayout() to\n'
' set a size and lay out any children, or, set sizedByParent to\n'
' true so that performResize() sizes the render object.\n'
' true so that performResize() sizes the render object.\n',
),
);
expect(
......@@ -123,7 +123,7 @@ void main() {
' use that ParentData class for its children, it must provide an\n'
' implementation of applyPaintTransform that supports the specific\n'
' ParentData subclass used by its children (which apparently is\n'
' ParentData).\n'
' ParentData).\n',
),
);
......@@ -165,7 +165,7 @@ void main() {
' performResize() nor performLayout() were being run for this\n'
' object).\n'
' Because this RenderBox has sizedByParent set to false, it must\n'
' set its size in performLayout().\n'
' set its size in performLayout().\n',
),
);
expect(result.diagnostics.where((DiagnosticsNode node) => node.level == DiagnosticLevel.hint), isEmpty);
......@@ -206,7 +206,7 @@ void main() {
' entirely different part of the render tree, then there is no way\n'
' to be notified when the size changes and therefore attempts to\n'
' read that size are almost certainly a source of bugs. A different\n'
' approach should be used.\n'
' approach should be used.\n',
),
);
expect(result.diagnostics.where((DiagnosticsNode node) => node.level == DiagnosticLevel.hint).length, 2);
......@@ -268,7 +268,8 @@ void main() {
' size: MISSING\n'
' decoration: BoxDecoration:\n'
' <no decorations specified>\n'
' configuration: ImageConfiguration()\n'),
' configuration: ImageConfiguration()\n',
),
);
final RenderBox paddingBox = RenderPadding(
......@@ -471,7 +472,7 @@ void main() {
' null.\n'
' If you perform computations on another height before passing it\n'
' to getMinIntrinsicWidth, consider using math.max() or\n'
' double.clamp() to force the value into the valid range.\n'
' double.clamp() to force the value into the valid range.\n',
),
);
expect(
......@@ -499,7 +500,7 @@ void main() {
' null.\n'
' If you perform computations on another width before passing it to\n'
' getMinIntrinsicHeight, consider using math.max() or\n'
' double.clamp() to force the value into the valid range.\n'
' double.clamp() to force the value into the valid range.\n',
),
);
expect(
......@@ -527,7 +528,7 @@ void main() {
' null.\n'
' If you perform computations on another height before passing it\n'
' to getMaxIntrinsicWidth, consider using math.max() or\n'
' double.clamp() to force the value into the valid range.\n'
' double.clamp() to force the value into the valid range.\n',
),
);
expect(
......@@ -555,7 +556,7 @@ void main() {
' null.\n'
' If you perform computations on another width before passing it to\n'
' getMaxIntrinsicHeight, consider using math.max() or\n'
' double.clamp() to force the value into the valid range.\n'
' double.clamp() to force the value into the valid range.\n',
),
);
expect(
......@@ -583,7 +584,8 @@ void main() {
' constraints: MISSING\n'
' size: MISSING\n'
' alignment: Alignment.center\n'
' textDirection: ltr\n'),
' textDirection: ltr\n',
),
);
});
......@@ -1021,7 +1023,7 @@ void main() {
' If you are trying to perform a hit test during the layout phase\n'
' itself, make sure you only hit test nodes that have completed\n'
" layout (e.g. the node's children, after their layout() method has\n"
' been called).\n'
' been called).\n',
),
);
expect(
......@@ -1058,7 +1060,7 @@ void main() {
' not set.\n'
' A RenderBox object must have an explicit size before it can be\n'
' hit-tested. Make sure that the RenderBox in question sets its\n'
' size during layout.\n'
' size during layout.\n',
),
);
expect(
......@@ -1105,7 +1107,7 @@ void main() {
'The following assertion was thrown during performLayout():\n'
'RenderBox did not set its size during layout.\n'
'Because this RenderBox has sizedByParent set to false, it must\n'
'set its size in performLayout().'
'set its size in performLayout().',
),
);
});
......
......@@ -17,7 +17,7 @@ void main() {
widthFactor: 2.0,
heightFactor: 0.5,
child: leaf = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand()
additionalConstraints: const BoxConstraints.expand(),
),
),
),
......@@ -44,7 +44,7 @@ void main() {
expect(result, equals(
'BoxConstraints has NaN values in minWidth, maxWidth, and maxHeight.\n'
'The offending constraints were:\n'
' BoxConstraints(NaN<=w<=NaN, 2.0<=h<=NaN; NOT NORMALIZED)'
' BoxConstraints(NaN<=w<=NaN, 2.0<=h<=NaN; NOT NORMALIZED)',
));
result = 'no exception';
......@@ -57,7 +57,7 @@ void main() {
expect(result, equals(
'BoxConstraints has a NaN value in minHeight.\n'
'The offending constraints were:\n'
' BoxConstraints(0.0<=w<=Infinity, NaN<=h<=Infinity; NOT NORMALIZED)'
' BoxConstraints(0.0<=w<=Infinity, NaN<=h<=Infinity; NOT NORMALIZED)',
));
result = 'no exception';
......@@ -70,7 +70,7 @@ void main() {
expect(result, equals(
'BoxConstraints has NaN values in maxWidth and minHeight.\n'
'The offending constraints were:\n'
' BoxConstraints(0.0<=w<=NaN, NaN<=h<=Infinity; NOT NORMALIZED)'
' BoxConstraints(0.0<=w<=NaN, NaN<=h<=Infinity; NOT NORMALIZED)',
));
});
}
......@@ -95,8 +95,16 @@ void main() {
layout(root);
expect(b.debugPaint, paints..rect(color: const Color(0xFF00FFFF))..rect(color: const Color(0x90909090)));
expect(b.debugPaint, isNot(paints..path()));
expect(s.debugPaint, paints..circle(hasMaskFilter: true)..line(hasMaskFilter: true)..path(hasMaskFilter: true)..path(hasMaskFilter: true)
..path(color: const Color(0x900090FF))..path(color: const Color(0xFF0090FF)));
expect(
s.debugPaint,
paints
..circle(hasMaskFilter: true)
..line(hasMaskFilter: true)
..path(hasMaskFilter: true)
..path(hasMaskFilter: true)
..path(color: const Color(0x900090FF))
..path(color: const Color(0xFF0090FF)),
);
expect(s.debugPaint, isNot(paints..rect()));
debugPaintSizeEnabled = false;
});
......@@ -118,8 +126,18 @@ void main() {
);
layout(b);
expect(s.debugPaint, paints..rect(color: const Color(0x90909090)));
expect(s.debugPaint, isNot(paints..circle(hasMaskFilter: true)..line(hasMaskFilter: true)..path(hasMaskFilter: true)..path(hasMaskFilter: true)
..path(color: const Color(0x900090FF))..path(color: const Color(0xFF0090FF))));
expect(
s.debugPaint,
isNot(
paints
..circle(hasMaskFilter: true)
..line(hasMaskFilter: true)
..path(hasMaskFilter: true)
..path(hasMaskFilter: true)
..path(color: const Color(0x900090FF))
..path(color: const Color(0xFF0090FF)),
),
);
expect(b.debugPaint, paints..rect(color: const Color(0xFF00FFFF))..path(color: const Color(0x900090FF))..path(color: const Color(0xFF0090FF)));
expect(b.debugPaint, isNot(paints..rect(color: const Color(0x90909090))));
debugPaintSizeEnabled = false;
......@@ -147,8 +165,7 @@ void main() {
dynamic error;
try {
s.debugPaint(
PaintingContext(
ContainerLayer(), const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0)),
PaintingContext(ContainerLayer(), const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0)),
const Offset(0.0, 500),
);
} catch (e) {
......@@ -180,8 +197,7 @@ void main() {
dynamic error;
try {
s.debugPaint(
PaintingContext(
ContainerLayer(), const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0)),
PaintingContext(ContainerLayer(), const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0)),
const Offset(0.0, 500),
);
} catch (e) {
......
......@@ -82,8 +82,8 @@ void main() {
layout(
root = RenderIntrinsicSize(
child: RenderParentSize(
child: inner = RenderFixedSize()
)
child: inner = RenderFixedSize(),
),
),
constraints: const BoxConstraints(
minWidth: 0.0,
......@@ -106,8 +106,8 @@ void main() {
layout(
RenderIntrinsicSize(
child: parent = RenderParentSize(
child: inner = RenderFixedSize()
)
child: inner = RenderFixedSize(),
),
),
constraints: const BoxConstraints(
minWidth: 0.0,
......@@ -127,15 +127,18 @@ void main() {
test('Intrinsic checks are turned on', () async {
final List<FlutterErrorDetails> errorDetails = <FlutterErrorDetails>[];
layout(RenderInvalidIntrinsics(),
layout(
RenderInvalidIntrinsics(),
constraints: const BoxConstraints(
minWidth: 0.0,
minHeight: 0.0,
maxWidth: 1000.0,
maxHeight: 1000.0,
), onErrors: () {
),
onErrors: () {
errorDetails.addAll(renderer.takeAllFlutterErrorDetails());
});
},
);
expect(errorDetails, isNotEmpty);
expect(
......
......@@ -111,7 +111,7 @@ void main() {
' ║ size: 10.0\n'
' ║ height: 1.0x\n'
' ║ "12345"\n'
' ╚═══════════\n'
' ╚═══════════\n',
),
);
});
......@@ -3015,7 +3015,8 @@ void main() {
);
editable.layout(BoxConstraints.loose(const Size(100, 100)));
final List<TextSelectionPoint> endpoints = editable.getEndpointsForSelection(
const TextSelection(baseOffset: 0, extentOffset: 1));
const TextSelection(baseOffset: 0, extentOffset: 1),
);
expect(endpoints[0].point.dx, 0);
});
......@@ -3095,7 +3096,8 @@ void main() {
expect(
editable.getRectForComposingRange(const TextRange(start: 0, end: 1)),
// On web this evaluates to a zero-width Rect.
anyOf(isNull, (Rect rect) => rect.width == 0));
anyOf(isNull, (Rect rect) => rect.width == 0),
);
});
test('more than 1 run on the same line', () {
......@@ -3105,7 +3107,7 @@ void main() {
children: <TextSpan>[
const TextSpan(text: 'A', style: tinyText),
TextSpan(text: 'A' * 20, style: normalText),
const TextSpan(text: 'A', style: tinyText)
const TextSpan(text: 'A', style: tinyText),
],
);
// Give it a width that forces the editable to wrap.
......@@ -3370,7 +3372,7 @@ void main() {
(Canvas canvas) => editable.paint(TestRecordingPaintingContext(canvas), Offset.zero),
paints
..rect(rect: const Rect.fromLTRB(1, 1, 1, 1), color: const Color(0x12345678))
..paragraph()
..paragraph(),
);
});
});
......
......@@ -14,45 +14,63 @@ void main() {
testWidgets('test draw error paragraph', (WidgetTester tester) async {
await tester.pumpWidget(ErrorWidget(Exception(errorMessage)));
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0))
..paragraph(offset: const Offset(64.0, 96.0)));
..paragraph(offset: const Offset(64.0, 96.0)),
);
final Widget _error = Builder(builder: (BuildContext context) => throw 'pillow');
await tester.pumpWidget(Center(child: SizedBox(width: 100.0, child: _error)));
expect(tester.takeException(), 'pillow');
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(rect: const Rect.fromLTWH(0.0, 0.0, 100.0, 600.0))
..paragraph(offset: const Offset(0.0, 96.0)));
..paragraph(offset: const Offset(0.0, 96.0)),
);
await tester.pumpWidget(Center(child: SizedBox(height: 100.0, child: _error)));
expect(tester.takeException(), null);
await tester.pumpWidget(Center(child: SizedBox(key: UniqueKey(), height: 100.0, child: _error)));
expect(tester.takeException(), 'pillow');
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 100.0))
..paragraph(offset: const Offset(64.0, 0.0)));
..paragraph(offset: const Offset(64.0, 0.0)),
);
RenderErrorBox.minimumWidth = 800.0;
await tester.pumpWidget(Center(child: _error));
expect(tester.takeException(), 'pillow');
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0))
..paragraph(offset: const Offset(0.0, 96.0)));
..paragraph(offset: const Offset(0.0, 96.0)),
);
await tester.pumpWidget(Center(child: _error));
expect(tester.takeException(), null);
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(color: const Color(0xF0900000))
..paragraph());
..paragraph(),
);
RenderErrorBox.backgroundColor = const Color(0xFF112233);
await tester.pumpWidget(Center(child: _error));
expect(tester.takeException(), null);
expect(find.byType(ErrorWidget), paints
expect(
find.byType(ErrorWidget),
paints
..rect(color: const Color(0xFF112233))
..paragraph());
..paragraph(),
);
});
}
......@@ -13,8 +13,11 @@ void main() {
final RenderDecoratedBox box = RenderDecoratedBox(decoration: const BoxDecoration());
final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, children: <RenderBox>[box]);
layout(flex, constraints: const BoxConstraints(
minWidth: 200.0, maxWidth: 200.0, minHeight: 200.0, maxHeight: 200.0),
);
minWidth: 200.0,
maxWidth: 200.0,
minHeight: 200.0,
maxHeight: 200.0,
));
expect(flex.size.width, equals(200.0), reason: 'flex width');
expect(flex.size.height, equals(200.0), reason: 'flex height');
......@@ -72,7 +75,7 @@ void main() {
test('Vertical Overflow', () {
final RenderConstrainedBox flexible = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand()
additionalConstraints: const BoxConstraints.expand(),
);
final RenderFlex flex = RenderFlex(
direction: Axis.vertical,
......@@ -95,7 +98,7 @@ void main() {
test('Horizontal Overflow', () {
final RenderConstrainedBox flexible = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.expand()
additionalConstraints: const BoxConstraints.expand(),
);
final RenderFlex flex = RenderFlex(
direction: Axis.horizontal,
......@@ -148,7 +151,7 @@ void main() {
' mainAxisAlignment: start\n'
' mainAxisSize: max\n'
' crossAxisAlignment: center\n'
' verticalDirection: down\n'
' verticalDirection: down\n',
),
);
});
......@@ -158,8 +161,11 @@ void main() {
final RenderDecoratedBox box2 = RenderDecoratedBox(decoration: const BoxDecoration());
final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, children: <RenderBox>[box1, box2]);
layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0),
);
minWidth: 0.0,
maxWidth: 100.0,
minHeight: 0.0,
maxHeight: 100.0,
));
expect(box1.size.width, equals(0.0));
expect(box1.size.height, equals(0.0));
expect(box2.size.width, equals(0.0));
......@@ -184,8 +190,11 @@ void main() {
box2ParentData.flex = 2;
flex.addAll(<RenderBox>[box1, box2]);
layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0),
);
minWidth: 0.0,
maxWidth: 100.0,
minHeight: 0.0,
maxHeight: 100.0,
));
expect(box1.size.width, equals(0.0));
expect(box1.size.height, equals(0.0));
expect(box2.size.width, equals(100.0));
......@@ -213,8 +222,11 @@ void main() {
final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, mainAxisAlignment: MainAxisAlignment.spaceEvenly);
flex.addAll(<RenderBox>[box1, box2, box3]);
layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
);
minWidth: 0.0,
maxWidth: 500.0,
minHeight: 0.0,
maxHeight: 400.0,
));
Offset getOffset(RenderBox box) {
final FlexParentData parentData = box.parentData! as FlexParentData;
return parentData.offset;
......@@ -243,8 +255,11 @@ void main() {
final RenderFlex flex = RenderFlex(textDirection: TextDirection.ltr, mainAxisAlignment: MainAxisAlignment.spaceBetween);
flex.addAll(<RenderBox>[box1, box2, box3]);
layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
);
minWidth: 0.0,
maxWidth: 500.0,
minHeight: 0.0,
maxHeight: 400.0,
));
Offset getOffset(RenderBox box) {
final FlexParentData parentData = box.parentData! as FlexParentData;
return parentData.offset;
......@@ -295,8 +310,11 @@ void main() {
);
flex.addAll(<RenderBox>[box1, box2, box3]);
layout(flex, constraints: const BoxConstraints(
minWidth: 0.0, maxWidth: 500.0, minHeight: 0.0, maxHeight: 400.0),
);
minWidth: 0.0,
maxWidth: 500.0,
minHeight: 0.0,
maxHeight: 400.0,
));
Offset getOffset(RenderBox box) {
final FlexParentData parentData = box.parentData! as FlexParentData;
return parentData.offset;
......
......@@ -18,12 +18,12 @@ Future<void> main() async {
RenderImage image;
image = RenderImage(image: squareImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 25.0,
minHeight: 25.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(25.0));
expect(image.size.height, equals(25.0));
......@@ -39,87 +39,87 @@ Future<void> main() async {
' image: $squareImage\n'
' alignment: Alignment.center\n'
' invertColors: false\n'
' filterQuality: low\n'
' filterQuality: low\n',
),
);
image = RenderImage(image: wideImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 30.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(60.0));
expect(image.size.height, equals(30.0));
image = RenderImage(image: tallImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 50.0,
minHeight: 5.0,
maxWidth: 75.0,
maxHeight: 75.0));
maxHeight: 75.0,
));
expect(image.size.width, equals(50.0));
expect(image.size.height, equals(75.0));
image = RenderImage(image: wideImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 5.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(20.0));
expect(image.size.height, equals(10.0));
image = RenderImage(image: wideImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 5.0,
maxWidth: 16.0,
maxHeight: 16.0));
maxHeight: 16.0,
));
expect(image.size.width, equals(16.0));
expect(image.size.height, equals(8.0));
image = RenderImage(image: tallImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 5.0,
maxWidth: 16.0,
maxHeight: 16.0));
maxHeight: 16.0,
));
expect(image.size.width, equals(8.0));
expect(image.size.height, equals(16.0));
image = RenderImage(image: squareImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 4.0,
minHeight: 4.0,
maxWidth: 8.0,
maxHeight: 8.0));
maxHeight: 8.0,
));
expect(image.size.width, equals(8.0));
expect(image.size.height, equals(8.0));
image = RenderImage(image: wideImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 20.0,
minHeight: 20.0,
maxWidth: 30.0,
maxHeight: 30.0));
maxHeight: 30.0,
));
expect(image.size.width, equals(30.0));
expect(image.size.height, equals(20.0));
image = RenderImage(image: tallImage);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 20.0,
minHeight: 20.0,
maxWidth: 30.0,
maxHeight: 30.0));
maxHeight: 30.0,
));
expect(image.size.width, equals(20.0));
expect(image.size.height, equals(30.0));
});
......@@ -128,42 +128,42 @@ Future<void> main() async {
RenderImage image;
image = RenderImage();
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 25.0,
minHeight: 25.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(25.0));
expect(image.size.height, equals(25.0));
image = RenderImage(width: 50.0);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 25.0,
minHeight: 25.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(50.0));
expect(image.size.height, equals(25.0));
image = RenderImage(height: 50.0);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 25.0,
minHeight: 25.0,
maxWidth: 100.0,
maxHeight: 100.0));
maxHeight: 100.0,
));
expect(image.size.width, equals(25.0));
expect(image.size.height, equals(50.0));
image = RenderImage(width: 100.0, height: 100.0);
layout(image,
constraints: const BoxConstraints(
layout(image, constraints: const BoxConstraints(
minWidth: 25.0,
minHeight: 25.0,
maxWidth: 75.0,
maxHeight: 75.0));
maxHeight: 75.0,
));
expect(image.size.width, equals(75.0));
expect(image.size.height, equals(75.0));
});
......
......@@ -17,7 +17,7 @@ class TestLayout {
additionalConstraints: const BoxConstraints.tightFor(width: 800.0),
child: RenderCustomPaint(
painter: TestCallbackPainter(
onPaint: () { painted = true; }
onPaint: () { painted = true; },
),
child: child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(height: 10.0, width: 10.0),
......
......@@ -38,16 +38,24 @@ class RenderTestBox extends RenderBox {
@override
void performResize() {
size = constraints.constrain(Size(_intrinsicDimensions.minWidth + (_intrinsicDimensions.maxWidth-_intrinsicDimensions.minWidth) / 2.0,
_intrinsicDimensions.minHeight + (_intrinsicDimensions.maxHeight-_intrinsicDimensions.minHeight) / 2.0));
size = constraints.constrain(Size(
_intrinsicDimensions.minWidth + (_intrinsicDimensions.maxWidth - _intrinsicDimensions.minWidth) / 2.0,
_intrinsicDimensions.minHeight + (_intrinsicDimensions.maxHeight - _intrinsicDimensions.minHeight) / 2.0,
));
}
}
void main() {
test('Shrink-wrapping width', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -83,7 +91,8 @@ void main() {
test('IntrinsicWidth without a child', () {
final RenderBox parent = RenderIntrinsicWidth();
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -116,9 +125,15 @@ void main() {
});
test('Shrink-wrapping width (stepped width)', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child, stepWidth: 47.0);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -153,9 +168,15 @@ void main() {
});
test('Shrink-wrapping width (stepped height)', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child, stepHeight: 47.0);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -188,9 +209,15 @@ void main() {
});
test('Shrink-wrapping width (stepped everything)', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child, stepHeight: 47.0, stepWidth: 37.0);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -223,9 +250,15 @@ void main() {
});
test('RenderIntrinsicWidth when parent is given loose constraints smaller than intrinsic width of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 50.0,
minHeight: 8.0,
......@@ -240,9 +273,11 @@ void main() {
});
test('RenderIntrinsicWidth when parent is given tight constraints larger than intrinsic width of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child =
RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox parent = RenderIntrinsicWidth(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 500.0,
minHeight: 8.0,
......@@ -257,9 +292,15 @@ void main() {
});
test('RenderIntrinsicWidth when parent is given tight constraints smaller than intrinsic width of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicWidth(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 50.0,
minHeight: 8.0,
......@@ -274,9 +315,15 @@ void main() {
});
test('Shrink-wrapping height', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicHeight(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -310,7 +357,8 @@ void main() {
test('IntrinsicHeight without a child', () {
final RenderBox parent = RenderIntrinsicHeight();
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -343,9 +391,15 @@ void main() {
});
test('RenderIntrinsicHeight when parent is given loose constraints smaller than intrinsic height of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicHeight(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 8.0,
......@@ -360,9 +414,15 @@ void main() {
});
test('RenderIntrinsicHeight when parent is given tight constraints larger than intrinsic height of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicHeight(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 400.0,
......@@ -377,9 +437,15 @@ void main() {
});
test('RenderIntrinsicHeight when parent is given tight constraints smaller than intrinsic height of child', () {
final RenderBox child = RenderTestBox(const BoxConstraints(minWidth: 10.0, maxWidth: 100.0, minHeight: 20.0, maxHeight: 200.0));
final RenderBox child = RenderTestBox(const BoxConstraints(
minWidth: 10.0,
maxWidth: 100.0,
minHeight: 20.0,
maxHeight: 200.0,
));
final RenderBox parent = RenderIntrinsicHeight(child: child);
layout(parent,
layout(
parent,
constraints: const BoxConstraints(
minWidth: 5.0,
minHeight: 80.0,
......
......@@ -16,7 +16,7 @@ void main() {
_TestAnnotatedLayer(1, opaque: false),
_TestAnnotatedLayer(2, opaque: false),
_TestAnnotatedLayer(3, opaque: false),
]
],
).build();
expect(
......@@ -36,7 +36,7 @@ void main() {
_TestAnnotatedLayer(1, opaque: false),
_TestAnnotatedLayer(2, opaque: false),
_TestAnnotatedLayer(3, opaque: false),
]
],
).build();
final int result = root.find<int>(Offset.zero)!;
......@@ -50,7 +50,7 @@ void main() {
_TestAnnotatedLayer(1, opaque: false),
_TestAnnotatedLayer(2, opaque: false),
_TestAnnotatedLayer(3, opaque: false),
]
],
).build();
expect(root.findAllAnnotations<double>(Offset.zero).entries.isEmpty, isTrue);
......@@ -63,7 +63,7 @@ void main() {
_TestAnnotatedLayer(1, opaque: false),
_TestAnnotatedLayer(2, opaque: false),
_TestAnnotatedLayer(3, opaque: false),
]
],
).build();
expect(root.find<double>(Offset.zero), isNull);
......@@ -76,7 +76,7 @@ void main() {
_TestAnnotatedLayer(1, opaque: false),
_TestAnnotatedLayer(2, opaque: true),
_TestAnnotatedLayer(3, opaque: false),
]
],
).build();
expect(
......@@ -89,12 +89,13 @@ void main() {
});
test("ContainerLayer.findAllAnnotations returns children's opacity (true)", () {
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ContainerLayer(),
children: <Object>[
_TestAnnotatedLayer(2, opaque: true),
]
],
).build(),
);
......@@ -107,7 +108,8 @@ void main() {
});
test("ContainerLayer.findAllAnnotations returns children's opacity (false)", () {
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ContainerLayer(),
children: <Object>[
......@@ -126,7 +128,8 @@ void main() {
});
test('ContainerLayer.findAllAnnotations returns false as opacity when finding nothing', () {
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ContainerLayer(),
children: <Object>[
......@@ -147,12 +150,13 @@ void main() {
const Offset insidePosition = Offset(-5, 5);
const Offset outsidePosition = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
OffsetLayer(offset: const Offset(-10, 0)),
children: <Object>[
_TestAnnotatedLayer(1, opaque: true, size: const Size(10, 10)),
]
],
).build(),
);
......@@ -174,7 +178,8 @@ void main() {
const Offset insidePosition = Offset(11, 11);
const Offset outsidePosition = Offset(19, 19);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ClipRectLayer(clipRect: const Offset(10, 10) & const Size(5, 5)),
children: <Object>[
......@@ -184,7 +189,7 @@ void main() {
size: const Size(10, 10),
offset: const Offset(10, 10),
),
]
],
).build(),
);
......@@ -213,7 +218,8 @@ void main() {
const Offset insidePosition = Offset(12, 12);
const Offset outsidePosition = Offset(11, 11);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ClipRRectLayer(clipRRect: rrect),
children: <Object>[
......@@ -223,7 +229,7 @@ void main() {
size: const Size(10, 10),
offset: const Offset(10, 10),
),
]
],
).build(),
);
......@@ -257,7 +263,8 @@ void main() {
const Offset insidePosition = Offset(11, 11);
const Offset outsidePosition = Offset(12, 12);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
ClipPathLayer(clipPath: path),
children: <Object>[
......@@ -267,7 +274,7 @@ void main() {
size: const Size(10, 10),
offset: const Offset(10, 10),
),
]
],
).build(),
);
......@@ -288,14 +295,14 @@ void main() {
test('TransformLayer.findAllAnnotations respects transform', () {
// Matrix `transform` enlarges the target by (2x, 4x), then shift it by
// (10, 20).
final Matrix4 transform = Matrix4.diagonal3Values(2, 4, 1)
..setTranslation(Vector3(10, 20, 0));
final Matrix4 transform = Matrix4.diagonal3Values(2, 4, 1)..setTranslation(Vector3(10, 20, 0));
// The original region is Offset(10, 10) & Size(10, 10)
// The transformed region is Offset(30, 60) & Size(20, 40)
const Offset insidePosition = Offset(40, 80);
const Offset outsidePosition = Offset(20, 40);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
TransformLayer(transform: transform),
children: <Object>[
......@@ -305,7 +312,7 @@ void main() {
size: const Size(10, 10),
offset: const Offset(10, 10),
),
]
],
).build(),
);
......@@ -330,7 +337,8 @@ void main() {
..rotateX(-0.2)
..rotateY(0.2);
final Layer root = _withBackgroundAnnotation(0,
final Layer root = _withBackgroundAnnotation(
0,
_Layers(
TransformLayer(transform: transform),
children: <Object>[
......@@ -340,7 +348,7 @@ void main() {
size: const Size(30, 40),
offset: const Offset(10, 20),
),
]
],
).build(),
);
......@@ -408,12 +416,13 @@ void main() {
test('TransformLayer.findAllAnnotations skips when transform is irreversible', () {
final Matrix4 transform = Matrix4.diagonal3Values(1, 0, 1);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
TransformLayer(transform: transform),
children: <Object>[
_TestAnnotatedLayer(1, opaque: true),
]
],
).build(),
);
......@@ -441,7 +450,8 @@ void main() {
const Offset insidePosition = Offset(11, 11);
const Offset outsidePosition = Offset(12, 12);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
PhysicalModelLayer(
clipPath: path,
......@@ -456,7 +466,7 @@ void main() {
size: const Size(10, 10),
offset: const Offset(10, 10),
),
]
],
).build(),
);
......@@ -474,12 +484,12 @@ void main() {
);
});
test('LeaderLayer.findAllAnnotations respects offset', () {
const Offset insidePosition = Offset(-5, 5);
const Offset outsidePosition = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
LeaderLayer(
link: LayerLink(),
......@@ -487,7 +497,7 @@ void main() {
),
children: <Object>[
_TestAnnotatedLayer(1, opaque: true, size: const Size(10, 10)),
]
],
).build(),
);
......@@ -505,16 +515,19 @@ void main() {
);
});
test('AnnotatedRegionLayer.findAllAnnotations should append to the list '
'and return the given opacity (false) during a successful hit', () {
test(
'AnnotatedRegionLayer.findAllAnnotations should append to the list '
'and return the given opacity (false) during a successful hit',
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: false),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
],
).build(),
);
......@@ -526,18 +539,22 @@ void main() {
const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]),
);
});
},
);
test('AnnotatedRegionLayer.findAllAnnotations should append to the list '
'and return the given opacity (true) during a successful hit', () {
test(
'AnnotatedRegionLayer.findAllAnnotations should append to the list '
'and return the given opacity (true) during a successful hit',
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: true),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
],
).build(),
);
......@@ -548,17 +565,19 @@ void main() {
const AnnotationEntry<int>(annotation: 1, localPosition: position),
]),
);
});
},
);
test('AnnotatedRegionLayer.findAllAnnotations has default opacity as false', () {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
],
).build(),
);
......@@ -572,16 +591,19 @@ void main() {
);
});
test('AnnotatedRegionLayer.findAllAnnotations should still check children and return '
"children's opacity (false) during a failed hit", () {
test(
'AnnotatedRegionLayer.findAllAnnotations should still check children and return '
"children's opacity (false) during a failed hit",
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: true, size: Size.zero),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
],
).build(),
);
......@@ -592,19 +614,23 @@ void main() {
const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]),
);
});
},
);
test('AnnotatedRegionLayer.findAllAnnotations should still check children and return '
"children's opacity (true) during a failed hit", () {
test(
'AnnotatedRegionLayer.findAllAnnotations should still check children and return '
"children's opacity (true) during a failed hit",
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: false, size: Size.zero),
children: <Object>[
_TestAnnotatedLayer(2, opaque: true),
]
).build()
],
).build(),
);
expect(
......@@ -613,19 +639,23 @@ void main() {
const AnnotationEntry<int>(annotation: 2, localPosition: position),
]),
);
});
},
);
test("AnnotatedRegionLayer.findAllAnnotations should not add to children's opacity "
'during a successful hit if it is not opaque', () {
test(
"AnnotatedRegionLayer.findAllAnnotations should not add to children's opacity "
'during a successful hit if it is not opaque',
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: false),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
).build()
],
).build(),
);
expect(
......@@ -636,19 +666,23 @@ void main() {
const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]),
);
});
},
);
test("AnnotatedRegionLayer.findAllAnnotations should add to children's opacity "
'during a successful hit if it is opaque', () {
test(
"AnnotatedRegionLayer.findAllAnnotations should add to children's opacity "
'during a successful hit if it is opaque',
() {
const Offset position = Offset(5, 5);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(1, opaque: true),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false),
]
).build()
],
).build(),
);
expect(
......@@ -658,14 +692,18 @@ void main() {
const AnnotationEntry<int>(annotation: 1, localPosition: position),
]),
);
});
},
);
test('AnnotatedRegionLayer.findAllAnnotations should clip its annotation '
'using size and offset (positive)', () {
test(
'AnnotatedRegionLayer.findAllAnnotations should clip its annotation '
'using size and offset (positive)',
() {
// The target position would have fallen outside if not for the offset.
const Offset position = Offset(100, 100);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(
1,
......@@ -681,8 +719,8 @@ void main() {
offset: const Offset(20, 20),
size: const Size(110, 110),
),
]
).build()
],
).build(),
);
expect(
......@@ -693,14 +731,18 @@ void main() {
const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]),
);
});
},
);
test('AnnotatedRegionLayer.findAllAnnotations should clip its annotation '
'using size and offset (negative)', () {
test(
'AnnotatedRegionLayer.findAllAnnotations should clip its annotation '
'using size and offset (negative)',
() {
// The target position would have fallen inside if not for the offset.
const Offset position = Offset(10, 10);
final Layer root = _withBackgroundAnnotation(1000,
final Layer root = _withBackgroundAnnotation(
1000,
_Layers(
AnnotatedRegionLayer<int>(
1,
......@@ -709,8 +751,8 @@ void main() {
),
children: <Object>[
_TestAnnotatedLayer(2, opaque: false, size: const Size(110, 110)),
]
).build()
],
).build(),
);
expect(
......@@ -720,7 +762,8 @@ void main() {
const AnnotationEntry<int>(annotation: 1000, localPosition: position),
]),
);
});
},
);
}
/// A [ContainerLayer] that contains a stack of layers: `layer` in the front,
......@@ -771,7 +814,8 @@ class _Layers {
// This layer's [findAnnotation] can be controlled by the given arguments.
class _TestAnnotatedLayer extends Layer {
_TestAnnotatedLayer(this.value, {
_TestAnnotatedLayer(
this.value, {
required this.opaque,
this.offset = Offset.zero,
this.size,
......
......@@ -294,8 +294,12 @@ void main() {
test('mutating PerformanceOverlayLayer fields triggers needsAddToScene', () {
final PerformanceOverlayLayer layer = PerformanceOverlayLayer(
overlayRect: Rect.zero, optionsMask: 0, rasterizerThreshold: 0,
checkerboardRasterCacheImages: false, checkerboardOffscreenLayers: false);
overlayRect: Rect.zero,
optionsMask: 0,
rasterizerThreshold: 0,
checkerboardRasterCacheImages: false,
checkerboardOffscreenLayers: false,
);
checkNeedsAddToScene(layer, () {
layer.overlayRect = unitRect;
});
......@@ -383,7 +387,11 @@ void main() {
test('mutating PhysicalModelLayer fields triggers needsAddToScene', () {
final PhysicalModelLayer layer = PhysicalModelLayer(
clipPath: Path(), elevation: 0, color: const Color(0x00000000), shadowColor: const Color(0x00000000));
clipPath: Path(),
elevation: 0,
color: const Color(0x00000000),
shadowColor: const Color(0x00000000),
);
checkNeedsAddToScene(layer, () {
final Path newPath = Path();
newPath.addRect(unitRect);
......
......@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void main() {
test('LimitedBox: parent max size is unconstrained', () {
final RenderBox child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0),
);
final RenderBox parent = RenderConstrainedOverflowBox(
minWidth: 0.0,
......@@ -59,7 +59,7 @@ void main() {
test('LimitedBox: parent maxWidth is unconstrained', () {
final RenderBox child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0),
);
final RenderBox parent = RenderConstrainedOverflowBox(
minWidth: 0.0,
......@@ -79,7 +79,7 @@ void main() {
test('LimitedBox: parent maxHeight is unconstrained', () {
final RenderBox child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0)
additionalConstraints: const BoxConstraints.tightFor(width: 300.0, height: 400.0),
);
final RenderBox parent = RenderConstrainedOverflowBox(
minWidth: 500.0,
......
......@@ -608,7 +608,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
return true;
description.write(
'painted something, the first call having the following stack:\n'
'${paintingCalls.first.stackToString(indent: " ")}\n'
'${paintingCalls.first.stackToString(indent: " ")}\n',
);
return false;
}
......@@ -621,7 +621,7 @@ class _TestRecordingCanvasPaintsNothingMatcher extends _TestRecordingCanvasMatch
// Filters out canvas calls that are not painting anything.
static Iterable<RecordedInvocation> _filterCanvasCalls(Iterable<RecordedInvocation> canvasCalls) {
return canvasCalls.where((RecordedInvocation canvasCall) =>
!_nonPaintingOperations.contains(canvasCall.invocation.memberName)
!_nonPaintingOperations.contains(canvasCall.invocation.memberName),
);
}
}
......@@ -813,7 +813,7 @@ class _TestRecordingCanvasPatternMatcher extends _TestRecordingCanvasMatcher imp
if (_predicates.isEmpty) {
description.writeln(
'It painted something, but you must now add a pattern to the paints matcher '
'in the test to verify that it matches the important parts of the following.'
'in the test to verify that it matches the important parts of the following.',
);
return false;
}
......@@ -950,7 +950,15 @@ class _OneParameterPaintPredicate<T> extends _DrawCommandPaintPredicate {
required bool? hasMaskFilter,
required PaintingStyle? style,
}) : super(
symbol, name, 2, 1, color: color, strokeWidth: strokeWidth, hasMaskFilter: hasMaskFilter, style: style);
symbol,
name,
2,
1,
color: color,
strokeWidth: strokeWidth,
hasMaskFilter: hasMaskFilter,
style: style,
);
final T? expected;
......@@ -986,7 +994,15 @@ class _TwoParameterPaintPredicate<T1, T2> extends _DrawCommandPaintPredicate {
required bool? hasMaskFilter,
required PaintingStyle? style,
}) : super(
symbol, name, 3, 2, color: color, strokeWidth: strokeWidth, hasMaskFilter: hasMaskFilter, style: style);
symbol,
name,
3,
2,
color: color,
strokeWidth: strokeWidth,
hasMaskFilter: hasMaskFilter,
style: style,
);
final T1? expected1;
......
......@@ -119,8 +119,7 @@ void main() {
_pointerData(PointerChange.hover, const Offset(10.0, 0.0)),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
logCursors.clear();
// Pointer moves out of the annotation
......@@ -139,8 +138,7 @@ void main() {
_pointerData(PointerChange.remove, Offset.zero),
]));
expect(logCursors, const <_CursorUpdateDetails>[
]);
expect(logCursors, const <_CursorUpdateDetails>[]);
});
test('pointer is added and removed in an annotation', () {
......@@ -179,8 +177,7 @@ void main() {
_pointerData(PointerChange.hover, const Offset(10.0, 0.0)),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
logCursors.clear();
// Pointer moves back into the annotation
......@@ -199,8 +196,7 @@ void main() {
_pointerData(PointerChange.remove, Offset.zero),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
});
test('pointer change caused by new frames', () {
......@@ -235,8 +231,7 @@ void main() {
annotation = const TestAnnotationTarget(cursor: SystemMouseCursors.grabbing);
_binding.scheduleMouseTrackerPostFrameCheck();
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
logCursors.clear();
// Pointer is removed outside of the annotation.
......@@ -244,8 +239,7 @@ void main() {
_pointerData(PointerChange.remove, Offset.zero),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
});
test('The first annotation with non-deferring cursor is used', () {
......@@ -328,8 +322,7 @@ void main() {
_pointerData(PointerChange.hover, const Offset(5.0, 0.0)),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
logCursors.clear();
// Pointer moved to no annotations
......@@ -338,8 +331,7 @@ void main() {
_pointerData(PointerChange.hover, Offset.zero),
]));
expect(logCursors, <_CursorUpdateDetails>[
]);
expect(logCursors, <_CursorUpdateDetails>[]);
logCursors.clear();
// Remove
......
......@@ -39,7 +39,7 @@ void main() {
// This annotation also contains a cursor with a value of `testCursor`.
// The mouse tracker records the cursor requests it receives to `logCursors`.
TestAnnotationTarget _setUpWithOneAnnotation({
required List<PointerEvent> logEvents
required List<PointerEvent> logEvents,
}) {
final TestAnnotationTarget oneAnnotation = TestAnnotationTarget(
onEnter: (PointerEnterEvent event) {
......@@ -233,15 +233,13 @@ void main() {
ui.window.onPointerDataPacket!(ui.PointerDataPacket(data: <ui.PointerData>[
_pointerData(PointerChange.move, const Offset(0.0, 201.0)),
]));
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[
]));
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[]));
events.clear();
ui.window.onPointerDataPacket!(ui.PointerDataPacket(data: <ui.PointerData>[
_pointerData(PointerChange.up, const Offset(0.0, 301.0)),
]));
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[
]));
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[]));
events.clear();
});
......@@ -266,8 +264,7 @@ void main() {
_pointerData(PointerChange.add, const Offset(0.0, 100.0)),
]));
addTearDown(() => dispatchRemoveDevice());
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[
]));
expect(events, _equalToEventsOnCriticalFields(<BaseEventMatcher>[]));
expect(_mouseTracker.mouseIsConnected, isTrue);
events.clear();
......@@ -445,10 +442,10 @@ void main() {
bool isInHitRegionOne = true;
bool isInHitRegionTwo = false;
final TestAnnotationTarget annotation1 = TestAnnotationTarget(
onEnter: (PointerEnterEvent event) {}
onEnter: (PointerEnterEvent event) {},
);
final TestAnnotationTarget annotation2 = TestAnnotationTarget(
onExit: (PointerExitEvent event) {}
onExit: (PointerExitEvent event) {},
);
_setUpMouseAnnotationFinder((Offset position) sync* {
if (isInHitRegionOne)
......@@ -602,8 +599,7 @@ class BaseEventMatcher extends Matcher {
final PointerEvent expected;
bool _matchesField(Map<dynamic, dynamic> matchState, String field,
dynamic actual, dynamic expected) {
bool _matchesField(Map<dynamic, dynamic> matchState, String field, dynamic actual, dynamic expected) {
if (actual != expected) {
addStateInfo(matchState, <dynamic, dynamic>{
'field': field,
......@@ -746,8 +742,12 @@ class _EventListCriticalFieldsMatcher extends Matcher {
.add('\nsince it ');
final Description subDescription = StringDescription();
final Matcher matcher = matchState['matcher'] as Matcher;
matcher.describeMismatch(matchState['actual'], subDescription,
matchState['state'] as Map<dynamic, dynamic>, verbose);
matcher.describeMismatch(
matchState['actual'],
subDescription,
matchState['state'] as Map<dynamic, dynamic>,
verbose,
);
mismatchDescription.add(subDescription.toString());
return mismatchDescription;
}
......
......@@ -65,7 +65,7 @@ void main() {
equalsIgnoringHashCodes(
'══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞══════════════════════\n'
'The following assertion was thrown during performLayout():\n'
'TestThrowingRenderObject does not support performLayout.\n'
'TestThrowingRenderObject does not support performLayout.\n',
),
);
......@@ -78,7 +78,7 @@ void main() {
' parentData: MISSING\n'
' constraints: BoxConstraints(unconstrained)\n'
'This RenderObject has no descendants.\n'
'═════════════════════════════════════════════════════════════════\n'
'═════════════════════════════════════════════════════════════════\n',
),
);
});
......
......@@ -41,7 +41,7 @@ void main() {
'Since this typically indicates an infinite recursion, it is\n'
'disallowed.\n'
'\n'
'When the exception was thrown, this was the stack:'
'When the exception was thrown, this was the stack:',
),
);
......@@ -54,7 +54,7 @@ void main() {
' constraints: BoxConstraints(w=800.0, h=600.0)\n'
' size: Size(100.0, 100.0)\n'
'This RenderObject has no descendants.\n'
'═════════════════════════════════════════════════════════════════\n'
'═════════════════════════════════════════════════════════════════\n',
),
);
});
......@@ -91,7 +91,7 @@ void main() {
' A RenderObject that still has dirty compositing bits cannot be\n'
' painted because this indicates that the tree has not yet been\n'
' properly configured for creating the layer tree.\n'
' This usually indicates an error in the Flutter framework itself.\n'
' This usually indicates an error in the Flutter framework itself.\n',
),
);
expect(
......
......@@ -112,13 +112,13 @@ void main() {
layout(paragraph);
List<ui.TextBox> boxes = paragraph.getBoxesForSelection(
const TextSelection(baseOffset: 5, extentOffset: 25)
const TextSelection(baseOffset: 5, extentOffset: 25),
);
expect(boxes.length, equals(1));
boxes = paragraph.getBoxesForSelection(
const TextSelection(baseOffset: 25, extentOffset: 50)
const TextSelection(baseOffset: 25, extentOffset: 50),
);
expect(boxes.any((ui.TextBox box) => box.left == 250 && box.top == 0), isTrue);
......@@ -320,7 +320,7 @@ void main() {
final List<ui.TextBox> boxes = <ui.TextBox>[
for (int i = 0; i < text.length; ++i)
...paragraph.getBoxesForSelection(
TextSelection(baseOffset: i, extentOffset: i + 1)
TextSelection(baseOffset: i, extentOffset: i + 1),
),
];
expect(boxes.length, equals(4));
......@@ -362,7 +362,7 @@ void main() {
' ║ TextSpan:\n'
' ║ "I polished up that handle so carefullee\n'
' ║ That now I am the Ruler of the Queen\'s Navee!"\n'
' ╚═══════════\n'
' ╚═══════════\n',
),
);
});
......@@ -408,7 +408,7 @@ void main() {
layout(paragraph, constraints: const BoxConstraints(maxWidth: 100.0));
final List<ui.TextBox> boxes = paragraph.getBoxesForSelection(
const TextSelection(baseOffset: 0, extentOffset: 8)
const TextSelection(baseOffset: 0, extentOffset: 8),
);
expect(boxes.length, equals(5));
......@@ -429,8 +429,8 @@ void main() {
RenderParagraph paragraph = RenderParagraph(
const TextSpan(
children: <InlineSpan> [
WidgetSpan(child: Text(sentence))
]
WidgetSpan(child: Text(sentence)),
],
),
textScaleFactor: 1.0,
children: renderBoxes,
......@@ -447,8 +447,8 @@ void main() {
paragraph = RenderParagraph(
const TextSpan(
children: <InlineSpan> [
WidgetSpan(child: Text(sentence))
]
WidgetSpan(child: Text(sentence)),
],
),
textScaleFactor: 2.0,
children: renderBoxes,
......@@ -474,8 +474,8 @@ void main() {
RenderParagraph paragraph = RenderParagraph(
const TextSpan(
children: <InlineSpan> [
WidgetSpan(child: Text(sentence))
]
WidgetSpan(child: Text(sentence)),
],
),
textScaleFactor: 1.0,
children: renderBoxes,
......@@ -492,8 +492,8 @@ void main() {
paragraph = RenderParagraph(
const TextSpan(
children: <InlineSpan> [
WidgetSpan(child: Text(sentence))
]
WidgetSpan(child: Text(sentence)),
],
),
textScaleFactor: 2.0,
children: renderBoxes,
......@@ -541,7 +541,7 @@ void main() {
layout(paragraph, constraints: const BoxConstraints(maxWidth: 50.0));
final List<ui.TextBox> boxes = paragraph.getBoxesForSelection(
const TextSelection(baseOffset: 0, extentOffset: 12)
const TextSelection(baseOffset: 0, extentOffset: 12),
);
expect(boxes.length, equals(9));
......
......@@ -47,7 +47,7 @@ void main() {
final SemanticsHandle semanticsHandle = renderer.pipelineOwner.ensureSemantics(
listener: () {
++semanticsUpdateCount;
}
},
);
layout(tree, phase: EnginePhase.flushSemantics);
// Initial semantics update
......
......@@ -199,15 +199,19 @@ void main() {
decoration: const BoxDecoration(color: Color(0xff000000)),
child: RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size.square(20.0)),
));
stack.add(RenderOpacity()
),
);
stack.add(
RenderOpacity()
..opacity = 0.5
..child = blackBox);
..child = blackBox,
);
final RenderDecoratedBox whiteBox = RenderDecoratedBox(
decoration: const BoxDecoration(color: Color(0xffffffff)),
child: RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size.square(10.0)),
));
),
);
final RenderPositionedBox positioned = RenderPositionedBox(
widthFactor: 2.0,
heightFactor: 2.0,
......
......@@ -14,7 +14,7 @@ void main() {
opacity: 0.0,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -34,7 +34,7 @@ void main() {
opacity: 1.0,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -53,7 +53,7 @@ void main() {
opacity: 0.5,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -61,7 +61,7 @@ void main() {
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
cacheExtent: 250.0,
children: <RenderSliver>[renderSliverOpacity]
children: <RenderSliver>[renderSliverOpacity],
);
expect(renderSliverOpacity.debugLayer, null);
......@@ -87,7 +87,7 @@ void main() {
opacity: opacityAnimation,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -112,7 +112,7 @@ void main() {
opacity: opacityAnimation,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -136,7 +136,7 @@ void main() {
opacity: opacityAnimation,
sliver: RenderSliverToBoxAdapter(
child: RenderSizedBox(const Size(1.0, 1.0)), // size doesn't matter
)
),
);
final RenderViewport root = RenderViewport(
......@@ -144,7 +144,7 @@ void main() {
crossAxisDirection: AxisDirection.right,
offset: ViewportOffset.zero(),
cacheExtent: 250.0,
children: <RenderSliver>[renderSliverAnimatedOpacity]
children: <RenderSliver>[renderSliverAnimatedOpacity],
);
expect(renderSliverAnimatedOpacity.debugLayer, null);
......
......@@ -66,7 +66,7 @@ class TestCompositingBitsTree {
onPaint: () { painted = true; },
),
child: child = RenderConstrainedBox(
additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0)
additionalConstraints: const BoxConstraints.tightFor(height: 20.0, width: 20.0),
),
),
),
......@@ -133,7 +133,7 @@ void main() {
final SemanticsHandle semanticsHandle = renderer.pipelineOwner.ensureSemantics(
listener: () {
++semanticsUpdateCount;
}
},
);
// Lay out, composite, paint, and update semantics
layout(testTree.root, phase: EnginePhase.flushSemantics);
......@@ -156,7 +156,7 @@ void main() {
final SemanticsHandle semanticsHandle = renderer.pipelineOwner.ensureSemantics(
listener: () {
++semanticsUpdateCount;
}
},
);
// Lay out, composite, paint, and update semantics
layout(testTree.root, phase: EnginePhase.flushSemantics);
......
......@@ -30,7 +30,7 @@ class RecordedInvocation {
String stackToString({ String indent = '' }) {
assert(indent != null);
return indent + FlutterError.defaultStackFilter(
stack.toString().trimRight().split('\n')
stack.toString().trimRight().split('\n'),
).join('\n$indent');
}
}
......
......@@ -105,8 +105,7 @@ class TestRenderingFlutterBinding extends BindingBase with SchedulerBinding, Ser
pipelineOwner.flushSemantics();
if (phase == EnginePhase.flushSemantics)
return;
assert(phase == EnginePhase.flushSemantics ||
phase == EnginePhase.sendSemanticsUpdate);
assert(phase == EnginePhase.flushSemantics || phase == EnginePhase.sendSemanticsUpdate);
} finally {
FlutterError.onError = oldErrorHandler;
if (_errors.isNotEmpty) {
......
......@@ -17,8 +17,8 @@ void main() {
opacity: 1.0,
child: RenderRepaintBoundary(
child: c = RenderOpacity(
opacity: 1.0
)
opacity: 1.0,
),
),
),
),
......
......@@ -22,7 +22,7 @@ void main() {
final SemanticsHandle semanticsHandle = renderer.pipelineOwner.ensureSemantics(
listener: () {
++semanticsUpdateCount;
}
},
);
layout(tree, phase: EnginePhase.flushSemantics);
......
......@@ -10,7 +10,8 @@ import 'rendering_tester.dart';
void main() {
test('Stack can layout with top, right, bottom, left 0.0', () {
final RenderBox box = RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)));
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)),
);
layout(box, constraints: const BoxConstraints());
......
......@@ -66,27 +66,29 @@ void main() {
});
test('should be 1 when offset is greater than item extent', () {
final int actual = testGetMaxChildIndexForScrollOffset(
genericItemExtent + 1, genericItemExtent);
final int actual = testGetMaxChildIndexForScrollOffset(genericItemExtent + 1, genericItemExtent);
expect(actual, 1);
});
test('should be 1 when offset is slightly greater than item extent', () {
final int actual = testGetMaxChildIndexForScrollOffset(
genericItemExtent + extraValueToNotHaveRoundingIssues, genericItemExtent);
genericItemExtent + extraValueToNotHaveRoundingIssues,
genericItemExtent,
);
expect(actual, 1);
});
test('should be 4 when offset is four times and a half greater than item extent', () {
final int actual = testGetMaxChildIndexForScrollOffset(
genericItemExtent * 4.5, genericItemExtent);
final int actual = testGetMaxChildIndexForScrollOffset(genericItemExtent * 4.5, genericItemExtent);
expect(actual, 4);
});
test('should be 5 when offset is 6 times greater than item extent', () {
const double anotherGenericItemExtent = 414.0;
final int actual = testGetMaxChildIndexForScrollOffset(
anotherGenericItemExtent * 6, anotherGenericItemExtent);
anotherGenericItemExtent * 6,
anotherGenericItemExtent,
);
expect(actual, 5);
});
......@@ -94,13 +96,16 @@ void main() {
const double itemExtentSpecificForAProblematicSreenSize = 411.42857142857144;
final int actual = testGetMaxChildIndexForScrollOffset(
itemExtentSpecificForAProblematicSreenSize * 6 + extraValueToHaveRoundingIssues,
itemExtentSpecificForAProblematicSreenSize);
itemExtentSpecificForAProblematicSreenSize,
);
expect(actual, 5);
});
test('should be 0 when offset is 0.00000001 times greater than item extent where the division will return more than 13 zero decimals', () {
final int actual = testGetMaxChildIndexForScrollOffset(
genericItemExtent + extraValueToHaveRoundingIssues, genericItemExtent);
genericItemExtent + extraValueToHaveRoundingIssues,
genericItemExtent,
);
expect(actual, 0);
});
});
......
......@@ -27,8 +27,8 @@ void main() {
test('RenderSliverFloatingPinnedPersistentHeader maxScrollObstructionExtent is minExtent', () {
final TestRenderSliverFloatingPinnedPersistentHeader header = TestRenderSliverFloatingPinnedPersistentHeader(
child: RenderSizedBox(const Size(400.0, 100.0)
));
child: RenderSizedBox(const Size(400.0, 100.0)),
);
final RenderViewport root = RenderViewport(
axisDirection: AxisDirection.down,
crossAxisDirection: AxisDirection.right,
......
......@@ -27,7 +27,7 @@ void main() {
' axisDirection: down\n'
' crossAxisDirection: right\n'
' offset: _FixedViewportOffset#00000(offset: 0.0)\n'
' anchor: 0.0\n'
' anchor: 0.0\n',
),
);
layout(root);
......@@ -164,7 +164,7 @@ void main() {
' └─child: RenderSizedBox#00000 NEEDS-PAINT\n'
' parentData: paintOffset=Offset(0.0, -0.0) (can use size)\n'
' constraints: BoxConstraints(w=800.0, 0.0<=h<=Infinity)\n'
' size: Size(800.0, 400.0)\n'
' size: Size(800.0, 400.0)\n',
),
);
expect(a.localToGlobal(Offset.zero), Offset.zero);
......
......@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
void main() {
test('Stack can layout with top, right, bottom, left 0.0', () {
final RenderBox size = RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0))
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)),
);
final RenderBox red = RenderDecoratedBox(
......@@ -91,13 +91,13 @@ void main() {
group('RenderIndexedStack', () {
test('visitChildrenForSemantics only visits displayed child', () {
final RenderBox child1 = RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0))
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)),
);
final RenderBox child2 = RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0))
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)),
);
final RenderBox child3 = RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0))
additionalConstraints: BoxConstraints.tight(const Size(100.0, 100.0)),
);
final RenderBox stack = RenderIndexedStack(
index: 1,
......
......@@ -103,8 +103,10 @@ void main() {
expect(TableBorder.lerp(tableA, tableB, 2.0), tableC);
expect(TableBorder.lerp(tableB, tableC, -1.0), tableA);
expect(TableBorder.lerp(tableA, tableC, 0.9195)!.isUniform, isFalse);
expect(TableBorder.lerp(tableA, tableC, 0.9195)!.dimensions,
EdgeInsets.lerp(tableA.dimensions, tableC.dimensions, 0.9195));
expect(
TableBorder.lerp(tableA, tableC, 0.9195)!.dimensions,
EdgeInsets.lerp(tableA.dimensions, tableC.dimensions, 0.9195),
);
});
test('TableBorder.lerp with nulls', () {
......
......@@ -10,7 +10,7 @@ import 'rendering_tester.dart';
RenderBox sizedBox(double width, double height) {
return RenderConstrainedBox(
additionalConstraints: BoxConstraints.tight(Size(width, height))
additionalConstraints: BoxConstraints.tight(Size(width, height)),
);
}
......
......@@ -145,8 +145,10 @@ void main() {
expect(inner.globalToLocal(const Offset(25.0, 17.0)).dy, lessThan(10.0));
expect(inner.globalToLocal(const Offset(25.0, 83.0)).dy, greaterThan(90.0));
expect(inner.globalToLocal(const Offset(25.0, 83.0)).dy, lessThan(100.0));
expect(round(inner.globalToLocal(const Offset(25.0, 17.0))).dy,
equals(100 - round(inner.globalToLocal(const Offset(25.0, 83.0))).dy));
expect(
round(inner.globalToLocal(const Offset(25.0, 17.0))).dy,
equals(100 - round(inner.globalToLocal(const Offset(25.0, 83.0))).dy),
);
});
test('RenderTransform - perspective - localToGlobal', () {
......
......@@ -62,14 +62,15 @@ void main() {
});
test('Cache extent - nullx viewport', () async {
await expectLater(() => RenderViewport(
await expectLater(
() => RenderViewport(
crossAxisDirection: AxisDirection.left,
offset: ViewportOffset.zero(),
cacheExtent: null,
cacheExtentStyle: CacheExtentStyle.viewport,
children: children,
),
throwsAssertionError
throwsAssertionError,
);
});
......
......@@ -1115,14 +1115,15 @@ void main() {
controller.jumpTo(
11 * 300.0 // Preceding headers
+ 200.0 // Shrinks the pinned header to minExtent
+ 100.0 // Obstructs the leading 100 pixels of the 11th header
+ 100.0, // Obstructs the leading 100 pixels of the 11th header
);
await tester.pumpAndSettle();
tester.renderObject(find.byWidget(children[11], skipOffstage: false)).showOnScreen();
await tester.pumpAndSettle();
expect(controller.offset, lessThan(11 * 300.0 + 200.0 + 100.0));
});
},
);
void testFloatingHeaderShowOnScreen({ bool animated = true, Axis axis = Axis.vertical }) {
final TickerProvider? vsync = animated ? const TestVSync() : null;
......@@ -1185,7 +1186,7 @@ void main() {
floating: true,
delegate: _TestSliverPersistentHeaderDelegate(minExtent: 100, maxExtent: 300, key: headerKey, vsync: vsync),
),
)
),
);
final Finder pinnedHeaderContent = find.byKey(headerKey, skipOffstage: false);
......@@ -1217,7 +1218,8 @@ void main() {
await tester.pumpAndSettle();
expect(controller.offset, 300.0 * 15);
expect(mainAxisExtent(tester, pinnedHeaderContent), 300);
});
},
);
testWidgets(
'RenderViewportBase.showOnScreen but no child',
......@@ -1230,7 +1232,7 @@ void main() {
floating: true,
delegate: _TestSliverPersistentHeaderDelegate(minExtent: 100, maxExtent: 300, child: null, vsync: vsync),
),
)
),
);
final Finder pinnedHeaderContent = find.byKey(headerKey, skipOffstage: false);
......@@ -1260,7 +1262,8 @@ void main() {
await tester.pumpAndSettle();
expect(controller.offset, 300.0 * 15);
expect(mainAxisExtent(tester, pinnedHeaderContent), 300);
});
},
);
testWidgets(
'RenderViewportBase.showOnScreen with maxShowOnScreenExtent ',
......@@ -1278,7 +1281,7 @@ void main() {
showOnScreenConfiguration: const PersistentHeaderShowOnScreenConfiguration(maxShowOnScreenExtent: 200),
),
),
)
),
);
final Finder pinnedHeaderContent = find.byKey(headerKey, skipOffstage: false);
......@@ -1320,7 +1323,8 @@ void main() {
await tester.pumpAndSettle();
expect(controller.offset, 300.0 * 10 + 50.0);
expect(mainAxisExtent(tester, pinnedHeaderContent), 250);
});
},
);
testWidgets(
'RenderViewportBase.showOnScreen with minShowOnScreenExtent ',
......@@ -1338,7 +1342,7 @@ void main() {
showOnScreenConfiguration: const PersistentHeaderShowOnScreenConfiguration(minShowOnScreenExtent: 200),
),
),
)
),
);
final Finder pinnedHeaderContent = find.byKey(headerKey, skipOffstage: false);
......@@ -1380,7 +1384,8 @@ void main() {
await tester.pumpAndSettle();
expect(controller.offset, 300.0 * 10 + 50.0);
expect(mainAxisExtent(tester, pinnedHeaderContent), 250);
});
},
);
testWidgets(
'RenderViewportBase.showOnScreen should not scroll if the rect is already visible, '
......@@ -1394,7 +1399,7 @@ void main() {
delegate: _TestSliverPersistentHeaderDelegate(minExtent: 100, maxExtent: 300, key: headerKey, vsync: vsync),
),
reversed: true,
)
),
);
controller.jumpTo(-300.0 * 15);
......@@ -1414,14 +1419,15 @@ void main() {
- 8 * 300.0 // Preceding headers 11 - 18, children[11]'s top edge is aligned to the leading edge.
- 400.0 // Viewport height. children[10] (the pinned header) becomes pinned at the bottom of the screen.
- 200.0 // Shrinks the pinned header to minExtent (100).
- 100.0 // Obstructs the leading 100 pixels of the 11th header
- 100.0, // Obstructs the leading 100 pixels of the 11th header
);
await tester.pumpAndSettle();
tester.renderObject(find.byWidget(children[9], skipOffstage: false)).showOnScreen();
await tester.pumpAndSettle();
expect(controller.offset, -8 * 300.0 - 400.0 - 200.0);
});
},
);
});
}
......@@ -1653,7 +1659,7 @@ void main() {
' horizontal space for the children. In this case, consider using a\n'
' Row instead. Otherwise, consider using the "shrinkWrap" property\n'
' (or a ShrinkWrappingViewport) to size the width of the viewport\n'
' to the sum of the widths of its children.\n'
' to the sum of the widths of its children.\n',
);
});
......@@ -1667,7 +1673,7 @@ void main() {
' Viewports expand in the cross axis to fill their container and\n'
' constrain their children to match their extent in the cross axis.\n'
' In this case, a vertical viewport was given an unlimited amount\n'
' of horizontal space in which to expand.\n'
' of horizontal space in which to expand.\n',
);
});
......@@ -1688,14 +1694,14 @@ void main() {
' vertical space for the children. In this case, consider using a\n'
' Column instead. Otherwise, consider using the "shrinkWrap"\n'
' property (or a ShrinkWrappingViewport) to size the height of the\n'
' viewport to the sum of the heights of its children.\n'
' viewport to the sum of the heights of its children.\n',
);
});
});
test('Viewport debugThrowIfNotCheckingIntrinsics() control test', () {
final RenderViewport renderViewport = RenderViewport(
crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero()
crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(),
);
late FlutterError error;
try {
......@@ -1717,7 +1723,7 @@ void main() {
);
final RenderShrinkWrappingViewport renderShrinkWrappingViewport = RenderShrinkWrappingViewport(
crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero()
crossAxisDirection: AxisDirection.right, offset: ViewportOffset.zero(),
);
try {
renderShrinkWrappingViewport.computeMinIntrinsicHeight(0);
......@@ -1757,8 +1763,10 @@ void main() {
// Children should be painted in reverse order to the list given
expect(renderViewport.childrenInPaintOrder, equals(children.reversed));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect(renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed));
expect(
renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed),
);
});
test('RenderShrinkWrappingViewport', () async {
......@@ -1778,8 +1786,10 @@ void main() {
// Children should be painted in reverse order to the list given
expect(renderViewport.childrenInPaintOrder, equals(children.reversed));
// childrenInPaintOrder should be reverse of childrenInHitTestOrder
expect(renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed));
expect(
renderViewport.childrenInPaintOrder,
equals(renderViewport.childrenInHitTestOrder.toList().reversed),
);
});
});
......@@ -1800,7 +1810,8 @@ void main() {
crossAxisCount: 3,
childAspectRatio: 3,
mainAxisSpacing: 3,
crossAxisSpacing: 3),
crossAxisSpacing: 3,
),
children: const <Widget>[
Text('a'),
Text('b'),
......
......@@ -23,7 +23,7 @@ void main() {
' spacing: 0.0\n'
' runAlignment: start\n'
' runSpacing: 0.0\n'
' crossAxisAlignment: 0.0\n'
' crossAxisAlignment: 0.0\n',
),
);
});
......@@ -103,7 +103,7 @@ void main() {
style: TextStyle(fontSize: lineHeight),
),
textDirection: TextDirection.ltr,
)
),
),
);
......
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