shader_mask_test.dart 803 Bytes
Newer Older
Hixie's avatar
Hixie committed
1 2 3 4
// 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.

5
import 'dart:ui' show Shader;
Hans Muller's avatar
Hans Muller committed
6

Adam Barth's avatar
Adam Barth committed
7
import 'package:flutter_test/flutter_test.dart';
8
import 'package:flutter/widgets.dart';
Hans Muller's avatar
Hans Muller committed
9

10
Shader createShader(Rect bounds) {
Hans Muller's avatar
Hans Muller committed
11
  return new LinearGradient(
12 13 14 15 16
    begin: FractionalOffset.topLeft,
    end: FractionalOffset.bottomLeft,
    colors: <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
    stops: <double>[0.1, 0.35]
  ).createShader(bounds);
Hans Muller's avatar
Hans Muller committed
17 18 19 20
}


void main() {
21
  testWidgets('Can be constructed', (WidgetTester tester) async {
22
    final Widget child = new Container(width: 100.0, height: 100.0);
23
    await tester.pumpWidget(new ShaderMask(child: child, shaderCallback: createShader));
Hans Muller's avatar
Hans Muller committed
24 25
  });
}