mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Add support for shadows in text. * Use dart:ui Shadow as base class for Shadows * Update lerp definition * Roll engine 3ffa3629523..84fe4a9f7e24e4 - Text Shadows and update goldens for skia roll. git log 50c2e69daff4e207c54e463d2304139985c7511c..32f417db0d566d354605305cb29c251276fa65ee --oneline --no-merges 32f417db0 Roll tonic to 077be256142ede39a271385907faadf4fcc62a4d. (#6541) 4ee77256c Revert "Roll Dart to 1f4dfce179c8f05c9e48759300a15e671b88cc10 (#6515)" (#6537) 964acafeb Roll src/third_party/skia 646d917d3c71..c6a17104ad68 (1 commits) (#6536) d4bae4ca4 Roll src/third_party/skia 2b2c00f6ec36..646d917d3c71 (1 commits) (#6535) ff93ccf47 Roll src/third_party/skia 681692726fc0..2b2c00f6ec36 (1 commits) (#6534) a4161c895 Roll src/third_party/skia 23775a2e9736..681692726fc0 (1 commits) (#6532) 116072e46 Roll src/third_party/skia 7435f2553f53..23775a2e9736 (1 commits) (#6531) ef0b0f6e9 Roll src/third_party/skia bc7a51e79c5b..7435f2553f53 (1 commits) (#6530) f46b7b971 Roll src/third_party/skia b28db529c866..bc7a51e79c5b (1 commits) (#6529) 9033c3902 Roll src/third_party/skia 7e67041a1428..b28db529c866 (1 commits) (#6528) e6887a412 Add missing imports for unicode/utf16.h (#6524) 1242f6dfe Roll src/third_party/skia d38382d060ca..7e67041a1428 (2 commits) (#6527) a1bbea77c Add a no-op platform view layer. (#6505) 2bb3afad8 Roll src/third_party/skia 21bd60daa3f3..d38382d060ca (10 commits) (#6526) 75e875240 Fix the Mac embedder build (#6525) 436f9707b Add version check for dismissable (#6522) 7767c785b Provide a default GL function resolver in the embedder (#6523) 32841dd89 Case-insensitive matching of family names for custom fonts (#6519) a9076c7e6 Roll src/third_party/skia 419709dbb167..21bd60daa3f3 (11 commits) (#6520) f2e7441b5 An API for loading fonts from a buffer provided by the application (#6508) 05aac0f27 fix ResourceExtractor npe. (#6461) cf5a2a145 Roll src/third_party/skia b27a9cf2f4a8..419709dbb167 (16 commits) (#6517) 84fe4a9f7 Re-revert invalid line height tests (#6516) 5f529566c Add support for text shadows (#6385) e44c10c96 Reland "Share engine layers with the framework" (#6412) (#6468) ba0449971 Roll Dart to 1f4dfce179c8f05c9e48759300a15e671b88cc10 (#6515)
69 lines
2.4 KiB
Dart
69 lines
2.4 KiB
Dart
// Copyright 2018 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 'dart:ui' as ui;
|
||
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
ui.Image createTestImage(int width, int height, ui.Color color) {
|
||
final ui.Paint paint = ui.Paint()
|
||
..style = ui.PaintingStyle.stroke
|
||
..strokeWidth = 1.0
|
||
..color = color;
|
||
final ui.PictureRecorder recorder = ui.PictureRecorder();
|
||
final ui.Canvas pictureCanvas = ui.Canvas(recorder);
|
||
pictureCanvas.drawCircle(Offset.zero, 20.0, paint);
|
||
final ui.Picture picture = recorder.endRecording();
|
||
return picture.toImage(width, height);
|
||
}
|
||
|
||
void main() {
|
||
const ui.Color red = ui.Color.fromARGB(255, 255, 0, 0);
|
||
const ui.Color green = ui.Color.fromARGB(255, 0, 255, 0);
|
||
const ui.Color transparentRed = ui.Color.fromARGB(128, 255, 0, 0);
|
||
|
||
group('succeeds', () {
|
||
testWidgets('when images have the same content', (WidgetTester tester) async {
|
||
await expectLater(
|
||
createTestImage(100, 100, red),
|
||
matchesReferenceImage(createTestImage(100, 100, red)),
|
||
);
|
||
await expectLater(
|
||
createTestImage(100, 100, green),
|
||
matchesReferenceImage(createTestImage(100, 100, green)),
|
||
);
|
||
|
||
await expectLater(
|
||
createTestImage(100, 100, transparentRed),
|
||
matchesReferenceImage(createTestImage(100, 100, transparentRed)),
|
||
);
|
||
});
|
||
|
||
testWidgets('when images are identical', (WidgetTester tester) async {
|
||
final ui.Image image = createTestImage(100, 100, red);
|
||
await expectLater(image, matchesReferenceImage(image));
|
||
});
|
||
});
|
||
|
||
group('fails', () {
|
||
testWidgets('when image sizes do not match', (WidgetTester tester) async {
|
||
expect(
|
||
await matchesReferenceImage(createTestImage(50, 50, red)).matchAsync(createTestImage(100, 100, red)),
|
||
equals('does not match as width or height do not match. [100×100] != [50×50]'),
|
||
);
|
||
});
|
||
|
||
testWidgets('when image pixels do not match', (WidgetTester tester) async {
|
||
expect(
|
||
await matchesReferenceImage(createTestImage(100, 100, red)).matchAsync(createTestImage(100, 100, transparentRed)),
|
||
equals('does not match on 57 pixels'),
|
||
);
|
||
expect(
|
||
await matchesReferenceImage(createTestImage(100, 100, red)).matchAsync(createTestImage(100, 100, green)),
|
||
equals('does not match on 57 pixels'),
|
||
);
|
||
});
|
||
});
|
||
}
|