box_decoration_test.dart 1.19 KB
Newer Older
Hixie's avatar
Hixie committed
1 2 3 4
// 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.

Adam Barth's avatar
Adam Barth committed
5
import 'package:flutter_test/flutter_test.dart';
6 7
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
8 9

void main() {
10 11
  testWidgets('Circles can have uniform borders', (WidgetTester tester) async {
    await tester.pumpWidget(
12
      new Container(
13
        padding: const EdgeInsets.all(50.0),
14 15 16 17
        decoration: new BoxDecoration(
          shape: BoxShape.circle,
          border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)),
          backgroundColor: Colors.teal[600]
18
        )
19 20
      )
    );
21
  });
22

23
  testWidgets('Bordered Container insets its child', (WidgetTester tester) async {
24
    Key key = new Key('outerContainer');
25
    await tester.pumpWidget(
26 27 28 29
      new Center(
        child: new Container(
          key: key,
          decoration: new BoxDecoration(border: new Border.all(width: 10.0)),
30
          child: new Container(
31 32
            width: 25.0,
            height: 25.0
33 34
          )
        )
35 36 37
      )
    );
    expect(tester.getSize(find.byKey(key)), equals(const Size(45.0, 45.0)));
38
  });
39
}