icon_test.dart 680 Bytes
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2015 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/material.dart';

void main() {
9 10
  testWidgets('Can set opacity for an Icon', (WidgetTester tester) async {
    await tester.pumpWidget(
11 12 13 14 15
      new IconTheme(
        data: new IconThemeData(
          color: Colors.green[500],
          opacity: 0.5
        ),
Ian Hickson's avatar
Ian Hickson committed
16
        child: new Icon(Icons.add)
17 18 19 20
      )
    );
    Text text = tester.widget(find.byType(Text));
    expect(text.style.color, equals(Colors.green[500].withOpacity(0.5)));
21 22
  });
}