flex_overflow_test.dart 1.28 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6 7 8 9 10 11 12
// 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/widgets.dart';

import 'mock_canvas.dart';

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

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

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

    expect(tester.takeException(), isNotNull);

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

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

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