flex_overflow_test.dart 1.34 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
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
8 9

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

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

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

    expect(tester.takeException(), isNotNull);

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

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

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