Unverified Commit ba635a64 authored by liyuqian's avatar liyuqian Committed by GitHub

Add golden tests for Opacity with offset (#24253)

See https://github.com/flutter/flutter/issues/23890
parent 07c5c0ac
8c478bbaf27447f3d612959705b305e7d1293526 e07cc0cb4fdf912062e71a6fd97cc91478d6e3b9
...@@ -1142,6 +1142,7 @@ class OpacityLayer extends ContainerLayer { ...@@ -1142,6 +1142,7 @@ class OpacityLayer extends ContainerLayer {
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties); super.debugFillProperties(properties);
properties.add(IntProperty('alpha', alpha)); properties.add(IntProperty('alpha', alpha));
properties.add(DiagnosticsProperty<Offset>('offset', offset));
} }
} }
......
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:io';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import '../rendering/mock_canvas.dart'; import '../rendering/mock_canvas.dart';
import 'semantics_tester.dart'; import 'semantics_tester.dart';
...@@ -147,4 +150,37 @@ void main() { ...@@ -147,4 +150,37 @@ void main() {
semantics.dispose(); semantics.dispose();
}); });
testWidgets('offset is correctly handled in Opacity', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: RepaintBoundary(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: List<Widget>.generate(10, (int index) {
return Opacity(
opacity: 0.5,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Container(
color: Colors.blue,
height: 50
),
)
);
}),
),
)
)
)
)
);
await expectLater(
find.byType(RepaintBoundary).first,
matchesGoldenFile('opacity_test.offset.1.png'),
skip: !Platform.isLinux,
);
});
} }
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