diagnostics_test.dart 1010 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
// Copyright 2014 The Flutter 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/foundation.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  test('TextTreeRenderer returns an empty string in release mode', () {
    final TextTreeRenderer renderer = TextTreeRenderer();
    final TestDiagnosticsNode node = TestDiagnosticsNode();

    expect(renderer.render(node), '');
  });
}

class TestDiagnosticsNode extends DiagnosticsNode {
  TestDiagnosticsNode() : super(
    name: 'test',
    style: DiagnosticsTreeStyle.singleLine,
  );

  @override
  List<DiagnosticsNode> getChildren() {
    return <DiagnosticsNode>[];
  }

  @override
  List<DiagnosticsNode> getProperties() {
    return <DiagnosticsNode>[];
  }

  @override
Ian Hickson's avatar
Ian Hickson committed
34
  String toDescription({TextTreeConfiguration? parentConfiguration}) {
35 36 37 38 39 40
    return 'Test Description';
  }

  @override
  final Object? value = Object();
}