Skip to content

Commit d4e9bbc

Browse files
author
Jonah Williams
authored
Address comments from flutter#5714 (flutter#15886)
* add simple test case for passing shadow color through physical layer * Update physical_model_test.dart add newline
1 parent 769ffb8 commit d4e9bbc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter/rendering.dart';
3+
import 'package:flutter/widgets.dart';
4+
import 'package:flutter_test/flutter_test.dart';
5+
6+
void main() {
7+
testWidgets('PhysicalModel - creates a physical model layer when it needs compositing', (WidgetTester tester) async {
8+
await tester.pumpWidget(new Directionality(
9+
textDirection: TextDirection.ltr,
10+
child: new PhysicalModel(
11+
shape: BoxShape.rectangle,
12+
color: Colors.grey,
13+
shadowColor: Colors.red,
14+
elevation: 1.0,
15+
child: new TextField(controller: new TextEditingController()),
16+
),
17+
));
18+
await tester.pump();
19+
20+
final RenderPhysicalModel renderPhysicalModel = tester.allRenderObjects.firstWhere((RenderObject object) => object is RenderPhysicalModel);
21+
expect(renderPhysicalModel.needsCompositing, true);
22+
23+
final PhysicalModelLayer physicalModelLayer = tester.layers.firstWhere((Layer layer) => layer is PhysicalModelLayer);
24+
expect(physicalModelLayer.shadowColor, Colors.red);
25+
expect(physicalModelLayer.color, Colors.grey);
26+
expect(physicalModelLayer.elevation, 1.0);
27+
});
28+
}

0 commit comments

Comments
 (0)