1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 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_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
void main() {
testWidgets('Align smoke test', (WidgetTester tester) async {
await tester.pumpWidget(
new Align(
child: new Container(),
alignment: const FractionalOffset(0.75, 0.75)
)
);
await tester.pumpWidget(
new Align(
child: new Container(),
alignment: const FractionalOffset(0.5, 0.5)
)
);
});
testWidgets('Shrink wraps in finite space', (WidgetTester tester) async {
final GlobalKey alignKey = new GlobalKey();
await tester.pumpWidget(
new SingleChildScrollView(
child: new Align(
key: alignKey,
child: new Container(
width: 10.0,
height: 10.0
),
alignment: const FractionalOffset(0.50, 0.50)
)
)
);
final Size size = alignKey.currentContext.size;
expect(size.width, equals(800.0));
expect(size.height, equals(10.0));
});
}