mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
Add:创建 flutter go web 版
This commit is contained in:
61
packages/flutter_web/test/widgets/animated_align_test.dart
Normal file
61
packages/flutter_web/test/widgets/animated_align_test.dart
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_web_test/flutter_web_test.dart';
|
||||
import 'package:flutter_web/rendering.dart';
|
||||
import 'package:flutter_web/widgets.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('AnimatedAlign.debugFillProperties', (WidgetTester tester) async {
|
||||
const AnimatedAlign box = const AnimatedAlign(
|
||||
alignment: Alignment.topCenter,
|
||||
curve: Curves.ease,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
);
|
||||
expect(box, hasOneLineDescription);
|
||||
});
|
||||
|
||||
testWidgets('AnimatedAlign alignment visual-to-directional animation',
|
||||
(WidgetTester tester) async {
|
||||
final Key target = new UniqueKey();
|
||||
|
||||
await tester.pumpWidget(
|
||||
new Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: new AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
alignment: Alignment.topRight,
|
||||
child: new SizedBox(key: target, width: 100.0, height: 200.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(tester.getSize(find.byKey(target)), const Size(100.0, 200.0));
|
||||
expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 0.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
new Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: new AnimatedAlign(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
child: new SizedBox(key: target, width: 100.0, height: 200.0),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(tester.getSize(find.byKey(target)), const Size(100.0, 200.0));
|
||||
expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 0.0));
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
expect(tester.getSize(find.byKey(target)), const Size(100.0, 200.0));
|
||||
expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 200.0));
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
|
||||
expect(tester.getSize(find.byKey(target)), const Size(100.0, 200.0));
|
||||
expect(tester.getTopRight(find.byKey(target)), const Offset(800.0, 400.0));
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user