flex_overflow_test.dart 1.25 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/widgets.dart';
6
import 'package:flutter_test/flutter_test.dart';
7 8

void main() {
9
  testWidgets('Flex overflow indicator', (WidgetTester tester) async {
10
    await tester.pumpWidget(
11
      const Center(
12
        child: Column(
13
          children: <Widget>[
14
            SizedBox(width: 200.0, height: 200.0),
15 16 17 18 19 20 21 22
          ],
        ),
      ),
    );

    expect(find.byType(Column), isNot(paints..rect()));

    await tester.pumpWidget(
23
      const Center(
24
        child: SizedBox(
25
          height: 100.0,
26
          child: Column(
27
            children: <Widget>[
28
              SizedBox(width: 200.0, height: 200.0),
29 30 31 32 33 34 35 36 37 38 39
            ],
          ),
        ),
      ),
    );

    expect(tester.takeException(), isNotNull);

    expect(find.byType(Column), paints..rect());

    await tester.pumpWidget(
40
      const Center(
41
        child: SizedBox(
42
          height: 0.0,
43
          child: Column(
44
            children: <Widget>[
45
              SizedBox(width: 200.0, height: 200.0),
46 47 48 49 50 51 52 53 54
            ],
          ),
        ),
      ),
    );

    expect(find.byType(Column), isNot(paints..rect()));
  });
}