Commit ba9d5e92 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Add tests for Baseline. (#8021)

parent f68343ee
// Copyright 2016 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/widgets.dart';
void main() {
testWidgets('Baseline - control test', (WidgetTester tester) async {
await tester.pumpWidget(
new Center(
child: new DefaultTextStyle(
style: new TextStyle(
fontFamily: 'Ahem',
fontSize: 100.0,
),
child: new Text('X'),
),
),
);
expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0));
});
testWidgets('Baseline - position test', (WidgetTester tester) async {
await tester.pumpWidget(
new Center(
child: new Baseline(
baseline: 180.0,
baselineType: TextBaseline.alphabetic,
child: new DefaultTextStyle(
style: new TextStyle(
fontFamily: 'Ahem',
fontSize: 100.0,
),
child: new Text('X'),
),
),
),
);
expect(tester.renderObject<RenderBox>(find.text('X')).size, const Size(100.0, 100.0));
expect(tester.renderObject<RenderBox>(find.byType(Baseline)).size, const Size(100.0, 200.0));
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment