Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
907d101
Skia gold for dart tests
dnfield Oct 18, 2023
a363fd1
analysis
dnfield Oct 18, 2023
cac8ef6
merge
dnfield Oct 18, 2023
adbf750
package locations
dnfield Oct 18, 2023
8b9b14f
more
dnfield Oct 18, 2023
4d97460
syntax...
dnfield Oct 18, 2023
f90fa53
smp 1
dnfield Oct 19, 2023
003d82a
more
dnfield Oct 19, 2023
de6c217
more print
dnfield Oct 19, 2023
1f536fc
sadness
dnfield Oct 19, 2023
696f55a
reversions
dnfield Oct 19, 2023
61294eb
delete file
dnfield Oct 19, 2023
9a56340
Merge remote-tracking branch 'upstream/main' into gold
dnfield Oct 19, 2023
7bcd6da
Try less multiprocessing?
dnfield Oct 19, 2023
a2a199d
merge
dnfield Oct 25, 2023
7baf8fd
reduce cases, avoid collisions for SMP
dnfield Oct 25, 2023
dd5207f
oops
dnfield Oct 25, 2023
f22b78d
fix test suite name
dnfield Oct 26, 2023
008fc30
unique
dnfield Oct 26, 2023
41c5b4b
verbose
dnfield Oct 26, 2023
5775f31
actually verbose
dnfield Oct 26, 2023
4bb2cba
fix
dnfield Oct 26, 2023
4e00412
missing file
dnfield Oct 26, 2023
b87ff9d
ok
dnfield Oct 26, 2023
85efbb3
simplify
dnfield Oct 26, 2023
2795751
Merge remote-tracking branch 'upstream/main' into gold
dnfield Oct 30, 2023
0dca473
merge
dnfield Oct 30, 2023
e9ac142
verbose true
dnfield Oct 30, 2023
e3aebc4
no fuzzy?
dnfield Oct 30, 2023
be22658
more
dnfield Oct 30, 2023
6856c53
debug
dnfield Oct 30, 2023
633260b
littest?
dnfield Oct 30, 2023
fc2ff4f
?
dnfield Oct 30, 2023
31598d3
wut
dnfield Oct 30, 2023
da8e777
more debug
dnfield Oct 30, 2023
b335c07
try this
dnfield Oct 31, 2023
e792bb6
fix async?
dnfield Oct 31, 2023
268af9a
ok
dnfield Oct 31, 2023
1f6c3a2
...
dnfield Oct 31, 2023
3d47777
Engine checkout path var name
dnfield Oct 31, 2023
678b8a9
see if we can live without litetest changes
dnfield Oct 31, 2023
48f28b5
unused import
dnfield Oct 31, 2023
557980b
Merge remote-tracking branch 'upstream/main' into gold
dnfield Nov 1, 2023
ab92d49
zanderso review
dnfield Nov 1, 2023
7de9ca7
override for harvester
dnfield Nov 1, 2023
65d8433
more
dnfield Nov 1, 2023
f0ed06b
last one
dnfield Nov 1, 2023
6180f24
fix web_ui
dnfield Nov 1, 2023
8db70f3
...one more for web
dnfield Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix async?
  • Loading branch information
dnfield committed Oct 31, 2023
commit e792bb6458c93bd1caf3cce76b0501887a759464
4 changes: 0 additions & 4 deletions testing/dart/canvas_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'dart:ui';
import 'dart:isolate';

import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -127,7 +126,6 @@ void testNoCrashes() {
}

void main() async {
ReceivePort port = ReceivePort('test');
final ImageComparer comparer = await ImageComparer.create(verbose: true);

testNoCrashes();
Expand Down Expand Up @@ -1034,8 +1032,6 @@ void main() async {
canvas.restoreToCount(canvas.getSaveCount() + 1);
expect(canvas.getSaveCount(), equals(6));
});

port.close();
}

Matcher listEquals(ByteData expected) => (dynamic v) {
Expand Down
43 changes: 22 additions & 21 deletions testing/litetest/lib/src/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'dart:async';
import 'dart:io' show stdout;
import 'dart:isolate';

import 'package:async_helper/async_minitest.dart' as m;
import 'package:async_helper/async_helper.dart' as m;
import 'package:expect/expect.dart' as e;

/// The state that each [Test] may be in.
Expand Down Expand Up @@ -35,9 +35,8 @@ class Test {
this.body, {
StringSink? logger,
TestLifecycle? lifecycle,
}) :
_logger = logger ?? stdout,
_lifecycle = lifecycle ?? _DefaultTestLifecycle(name);
}) : _logger = logger ?? stdout,
_lifecycle = lifecycle ?? _DefaultTestLifecycle(name);

/// The name of the test.
final String name;
Expand All @@ -52,30 +51,32 @@ class Test {
TestState state = TestState.allocated;

final TestLifecycle _lifecycle;
final Object _testToken = Object();

/// Runs the test.
///
/// Also signals the test's progress to the [TestLifecycle] object
/// that was provided when the [Test] was constructed, which will eventually
/// call the provided [onDone] callback.
void run({
Future<void> run({
void Function()? onDone,
}) {
m.test(name, () async {
await Future<void>(() async {
state = TestState.started;
_logger.writeln('Test "$name": Started');
try {
await body();
state = TestState.succeeded;
_logger.writeln('Test "$name": Passed');
} on e.ExpectException catch (e, st) {
state = TestState.failed;
_logger.writeln('Test "$name": Failed\n$e\n$st');
} finally {
_lifecycle.onDone(cleanup: onDone);
}
});
}) async {
m.asyncStart();
await Future<void>(() async {
state = TestState.started;
_logger.writeln('Test "$name": Started');
try {
await body();
state = TestState.succeeded;
_logger.writeln('Test "$name": Passed');
} on e.ExpectException catch (e, st) {
state = TestState.failed;
_logger.writeln('Test "$name": Failed\n$e\n$st');
} finally {
_lifecycle.onDone(cleanup: onDone);
}
}).then((_) {
m.asyncEnd();
});
_lifecycle.onStart();
}
Expand Down
50 changes: 25 additions & 25 deletions testing/skia_gold_client/lib/skia_gold_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class SkiaGoldClient {
'--work-dir', _tempPath,
'--test-name', cleanTestName(testName),
'--png-file', goldenFile.path,
// ..._getMatchingArguments(testName, screenshotSize, pixelDeltaThreshold, maxDifferentPixelsRate),
..._getMatchingArguments(testName, screenshotSize, pixelDeltaThreshold, maxDifferentPixelsRate),
];

final ProcessResult result = await _runCommand(imgtestCommand);
Expand Down Expand Up @@ -344,7 +344,7 @@ class SkiaGoldClient {
'--work-dir', _tempPath,
'--test-name', cleanTestName(testName),
'--png-file', goldenFile.path,
// ..._getMatchingArguments(testName, screenshotSize, pixelDeltaThreshold, differentPixelsRate),
..._getMatchingArguments(testName, screenshotSize, pixelDeltaThreshold, differentPixelsRate),
];

final ProcessResult result = await _runCommand(tryjobCommand);
Expand All @@ -368,29 +368,29 @@ class SkiaGoldClient {
}
}

// List<String> _getMatchingArguments(
// String testName,
// int screenshotSize,
// int pixelDeltaThreshold,
// double differentPixelsRate,
// ) {
// // The algorithm to be used when matching images. The available options are:
// // - "fuzzy": Allows for customizing the thresholds of pixel differences.
// // - "sobel": Same as "fuzzy" but performs edge detection before performing
// // a fuzzy match.
// const String algorithm = 'fuzzy';

// // The number of pixels in this image that are allowed to differ from the
// // baseline. It's okay for this to be a slightly high number like 10% of the
// // image size because those wrong pixels are constrained by
// // `pixelDeltaThreshold` below.
// final int maxDifferentPixels = (screenshotSize * differentPixelsRate).toInt();
// return <String>[
// '--add-test-optional-key', 'image_matching_algorithm:$algorithm',
// // '--add-test-optional-key', 'fuzzy_max_different_pixels:$maxDifferentPixels',
// // '--add-test-optional-key', 'fuzzy_pixel_delta_threshold:$pixelDeltaThreshold',
// ];
// }
List<String> _getMatchingArguments(
String testName,
int screenshotSize,
int pixelDeltaThreshold,
double differentPixelsRate,
) {
// The algorithm to be used when matching images. The available options are:
// - "fuzzy": Allows for customizing the thresholds of pixel differences.
// - "sobel": Same as "fuzzy" but performs edge detection before performing
// a fuzzy match.
const String algorithm = 'fuzzy';

// The number of pixels in this image that are allowed to differ from the
// baseline. It's okay for this to be a slightly high number like 10% of the
// image size because those wrong pixels are constrained by
// `pixelDeltaThreshold` below.
final int maxDifferentPixels = (screenshotSize * differentPixelsRate).toInt();
return <String>[
'--add-test-optional-key', 'image_matching_algorithm:$algorithm',
'--add-test-optional-key', 'fuzzy_max_different_pixels:$maxDifferentPixels',
'--add-test-optional-key', 'fuzzy_pixel_delta_threshold:$pixelDeltaThreshold',
];
}

/// Returns the latest positive digest for the given test known to Skia Gold
/// at head.
Expand Down