Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3fd8777

Browse files
authored
[web] Add basic color per vertex drawVertices API support (#13066)
* Implement basic drawVertices for BlendMode.srcOver and hairline rendering * Implement maxDiffRate parameter for screenshot tests
1 parent c643366 commit 3fd8777

File tree

12 files changed

+750
-29
lines changed

12 files changed

+750
-29
lines changed

lib/web_ui/dev/goldens_lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
repository: https://github.com/flutter/goldens.git
2-
revision: 7efcec3e8b0bbb6748a992b23a0a89300aa323c7
2+
revision: 686dd320f6cce6da9a7a43e3ec9c0147f39eb19d

lib/web_ui/dev/test_platform.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,13 @@ class BrowserPlatform extends PlatformPlugin {
146146
final Map<String, dynamic> requestData = json.decode(payload);
147147
final String filename = requestData['filename'];
148148
final bool write = requestData['write'];
149+
final double maxDiffRate = requestData['maxdiffrate'];
149150
final Map<String, dynamic> region = requestData['region'];
150-
final String result = await _diffScreenshot(filename, write, region);
151+
final String result = await _diffScreenshot(filename, write, maxDiffRate ?? _kMaxDiffRateFailure, region);
151152
return shelf.Response.ok(json.encode(result));
152153
}
153154

154-
Future<String> _diffScreenshot(String filename, bool write, [ Map<String, dynamic> region ]) async {
155+
Future<String> _diffScreenshot(String filename, bool write, double maxDiffRateFailure, [ Map<String, dynamic> region ]) async {
155156
if (doUpdateScreenshotGoldens) {
156157
write = true;
157158
}
@@ -282,7 +283,7 @@ Golden file $filename did not match the image generated by the test.
282283

283284
final StringBuffer message = StringBuffer();
284285
message.writeln('Golden file $filename did not match the image generated by the test.');
285-
message.writeln(getPrintableDiffFilesInfo(diff.rate, _kMaxDiffRateFailure));
286+
message.writeln(getPrintableDiffFilesInfo(diff.rate, maxDiffRateFailure));
286287
message.writeln('You can view the test report in your browser by opening:');
287288

288289
// Cirrus cannot serve HTML pages generated by build jobs, so we
@@ -314,7 +315,7 @@ Golden file $filename did not match the image generated by the test.
314315
message.writeln('Golden file: ${expectedFile.path}');
315316
message.writeln('Actual file: ${actualFile.path}');
316317

317-
if (diff.rate < _kMaxDiffRateFailure) {
318+
if (diff.rate < maxDiffRateFailure) {
318319
// Issue a warning but do not fail the test.
319320
print('WARNING:');
320321
print(message);

0 commit comments

Comments
 (0)