error_test.dart 757 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
// Copyright 2017 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.

import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';

import '../rendering/mock_canvas.dart';

/// Unit tests error.dart's usage via ErrorWidget.
void main() {
13
  const String errorMessage = 'Some error message';
14 15

  testWidgets('test draw error paragraph', (WidgetTester tester) async {
16
    await tester.pumpWidget(ErrorWidget(Exception(errorMessage)));
17 18

    expect(find.byType(ErrorWidget), paints
Dan Field's avatar
Dan Field committed
19
        ..rect(rect: const Rect.fromLTWH(0.0, 0.0, 800.0, 600.0))
20 21 22
        ..paragraph(offset: Offset.zero));
  });
}