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

5 6
// @dart = 2.8

7 8 9 10 11 12 13 14
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(
15 16
      Center(
        child: Column(
17
          children: const <Widget>[
18
            SizedBox(width: 200.0, height: 200.0),
19 20 21 22 23 24 25 26
          ],
        ),
      ),
    );

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

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

    expect(tester.takeException(), isNotNull);

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

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

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