strut_style_test.dart 1.49 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 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/painting.dart';
import '../flutter_test_alternative.dart';

void main() {
  test('StrutStyle diagnostics test', () {
    const StrutStyle s0 = StrutStyle(
      fontFamily: 'Serif',
      fontSize: 14,
    );
    expect(
      s0.toString(),
      equals('StrutStyle(family: Serif, size: 14.0)'),
    );

    const StrutStyle s1 = StrutStyle(
      fontFamily: 'Serif',
      fontSize: 14,
      forceStrutHeight: true,
    );
    expect(s1.fontFamily, 'Serif');
    expect(s1.fontSize, 14.0);
    expect(s1, equals(s1));
    expect(
      s1.toString(),
      equals('StrutStyle(family: Serif, size: 14.0, <strut height forced>)'),
    );

    const StrutStyle s2 = StrutStyle(
      fontFamily: 'Serif',
      fontSize: 14,
      forceStrutHeight: false,
    );
    expect(
      s2.toString(),
      equals('StrutStyle(family: Serif, size: 14.0, <strut height normal>)'),
    );

    const StrutStyle s3 = StrutStyle();
    expect(
      s3.toString(),
      equals('StrutStyle'),
    );

    const StrutStyle s4 = StrutStyle(
      forceStrutHeight: false,
    );
    expect(
      s4.toString(),
      equals('StrutStyle(<strut height normal>)'),
    );

    const StrutStyle s5 = StrutStyle(
      forceStrutHeight: true,
    );
    expect(
      s5.toString(),
      equals('StrutStyle(<strut height forced>)'),
    );
  });
}