mirror of
https://github.com/flutter/flutter
synced 2024-09-21 17:22:30 +00:00
* add simple test case for passing shadow color through physical layer * Update physical_model_test.dart add newline
This commit is contained in:
parent
464109c0e7
commit
69f0c839d2
28
packages/flutter/test/widgets/physical_model_test.dart
Normal file
28
packages/flutter/test/widgets/physical_model_test.dart
Normal file
|
@ -0,0 +1,28 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('PhysicalModel - creates a physical model layer when it needs compositing', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(new Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new PhysicalModel(
|
||||
shape: BoxShape.rectangle,
|
||||
color: Colors.grey,
|
||||
shadowColor: Colors.red,
|
||||
elevation: 1.0,
|
||||
child: new TextField(controller: new TextEditingController()),
|
||||
),
|
||||
));
|
||||
await tester.pump();
|
||||
|
||||
final RenderPhysicalModel renderPhysicalModel = tester.allRenderObjects.firstWhere((RenderObject object) => object is RenderPhysicalModel);
|
||||
expect(renderPhysicalModel.needsCompositing, true);
|
||||
|
||||
final PhysicalModelLayer physicalModelLayer = tester.layers.firstWhere((Layer layer) => layer is PhysicalModelLayer);
|
||||
expect(physicalModelLayer.shadowColor, Colors.red);
|
||||
expect(physicalModelLayer.color, Colors.grey);
|
||||
expect(physicalModelLayer.elevation, 1.0);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue