canvas_test_disabled.dart 1.04 KB
Newer Older
Ian Hickson's avatar
Ian Hickson 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' as ui;
6
import 'dart:ui' show Rect, Color, Paint;
7 8

import 'package:test/test.dart';
9
import 'package:vector_math/vector_math_64.dart';
10 11 12

void main() {

13 14
  ui.PictureRecorder recorder = new ui.PictureRecorder();
  ui.Canvas canvas = new ui.Canvas(recorder, new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0));
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

  test("matrix access should work", () {
    // Matrix equality doesn't work!
    // https://github.com/google/vector_math.dart/issues/147
    expect(canvas.getTotalMatrix(), equals(new Matrix4.identity().storage));
    Matrix4 matrix = new Matrix4.identity();
    // Round-tripping through getTotalMatrix will lose the z value
    // So only scale to 1x in the z direction.
    matrix.scale(2.0, 2.0, 1.0);
    canvas.setMatrix(matrix.storage);
    canvas.drawPaint(new Paint()..color = const Color(0xFF00FF00));
    expect(canvas.getTotalMatrix(), equals(matrix.storage));
  });

}