box_decoration_test.dart 1.3 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 10 11
import 'package:test/test.dart';

void main() {
  test('Circles can have uniform borders', () {
12 13 14
    testWidgets((WidgetTester tester) {
      tester.pumpWidget(
        new Container(
15
          padding: new EdgeInsets.all(50.0),
16
          decoration: new BoxDecoration(
17
            shape: BoxShape.circle,
18 19 20
            border: new Border.all(width: 10.0, color: const Color(0x80FF00FF)),
            backgroundColor: Colors.teal[600]
          )
21
        )
22 23
      );
    });
24
  });
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

  test('Bordered Container insets its child', () {
    testWidgets((WidgetTester tester) {
      Key key = new Key('outerContainer');
      tester.pumpWidget(
        new Center(
          child: new Container(
            key: key,
            decoration: new BoxDecoration(border: new Border.all(width: 10.0)),
            child: new Container(
              width: 25.0,
              height: 25.0
            )
          )
        )
      );
      expect(tester.getSize(tester.findElementByKey(key)), equals(const Size(45.0, 45.0)));
    });
  });
44
}