Skip to content

Commit 3773835

Browse files
authored
Make CkPicture resurrectable (flutter#22807)
* Make CkPicture resurrectable * disable goldens on Firefox * add non-recording canvas test; fix Firefox test
1 parent e71c6f4 commit 3773835

18 files changed

+1346
-251
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: 06e0333b8371965dce5dc05e140e6dfb454f33fa
2+
revision: ac75f12c6e93461369e1391da6cc20bf8cb08829

lib/web_ui/dev/test_runner.dart

Lines changed: 35 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -436,35 +436,39 @@ class TestCommand extends Command<bool> with ArgUtils {
436436
'test',
437437
));
438438

439-
if (isUnitTestsScreenshotsAvailable) {
440-
// Separate screenshot tests from unit-tests. Screenshot tests must run
441-
// one at a time. Otherwise, they will end up screenshotting each other.
442-
// This is not an issue for unit-tests.
443-
final FilePath failureSmokeTestPath = FilePath.fromWebUi(
444-
'test/golden_tests/golden_failure_smoke_test.dart',
445-
);
446-
final List<FilePath> screenshotTestFiles = <FilePath>[];
447-
final List<FilePath> unitTestFiles = <FilePath>[];
448-
449-
for (io.File testFile
450-
in testDir.listSync(recursive: true).whereType<io.File>()) {
451-
final FilePath testFilePath = FilePath.fromCwd(testFile.path);
452-
if (!testFilePath.absolute.endsWith('_test.dart')) {
453-
// Not a test file at all. Skip.
454-
continue;
455-
}
456-
if (testFilePath == failureSmokeTestPath) {
457-
// A smoke test that fails on purpose. Skip.
458-
continue;
459-
}
439+
// Separate screenshot tests from unit-tests. Screenshot tests must run
440+
// one at a time. Otherwise, they will end up screenshotting each other.
441+
// This is not an issue for unit-tests.
442+
final FilePath failureSmokeTestPath = FilePath.fromWebUi(
443+
'test/golden_tests/golden_failure_smoke_test.dart',
444+
);
445+
final List<FilePath> screenshotTestFiles = <FilePath>[];
446+
final List<FilePath> unitTestFiles = <FilePath>[];
447+
448+
for (io.File testFile
449+
in testDir.listSync(recursive: true).whereType<io.File>()) {
450+
final FilePath testFilePath = FilePath.fromCwd(testFile.path);
451+
if (!testFilePath.absolute.endsWith('_test.dart')) {
452+
// Not a test file at all. Skip.
453+
continue;
454+
}
455+
if (testFilePath == failureSmokeTestPath) {
456+
// A smoke test that fails on purpose. Skip.
457+
continue;
458+
}
460459

461-
if (path.split(testFilePath.relativeToWebUi).contains('golden_tests')) {
462-
screenshotTestFiles.add(testFilePath);
463-
} else {
464-
unitTestFiles.add(testFilePath);
465-
}
460+
// All files under test/golden_tests are considered golden tests.
461+
final bool isUnderGoldenTestsDirectory = path.split(testFilePath.relativeToWebUi).contains('golden_tests');
462+
// Any file whose name ends with "_golden_test.dart" is run as a golden test.
463+
final bool isGoldenTestFile = path.basename(testFilePath.relativeToWebUi).endsWith('_golden_test.dart');
464+
if (isUnderGoldenTestsDirectory || isGoldenTestFile) {
465+
screenshotTestFiles.add(testFilePath);
466+
} else {
467+
unitTestFiles.add(testFilePath);
466468
}
469+
}
467470

471+
if (isUnitTestsScreenshotsAvailable) {
468472
// This test returns a non-zero exit code on purpose. Run it separately.
469473
if (io.Platform.environment['CIRRUS_CI'] != 'true') {
470474
await _runTestBatch(
@@ -474,11 +478,13 @@ class TestCommand extends Command<bool> with ArgUtils {
474478
);
475479
_checkExitCode();
476480
}
481+
}
477482

478-
// Run all unit-tests as a single batch.
479-
await _runTestBatch(unitTestFiles, concurrency: 10, expectFailure: false);
480-
_checkExitCode();
483+
// Run all unit-tests as a single batch.
484+
await _runTestBatch(unitTestFiles, concurrency: 10, expectFailure: false);
485+
_checkExitCode();
481486

487+
if (isUnitTestsScreenshotsAvailable) {
482488
// Run screenshot tests one at a time.
483489
for (FilePath testFilePath in screenshotTestFiles) {
484490
await _runTestBatch(
@@ -488,24 +494,6 @@ class TestCommand extends Command<bool> with ArgUtils {
488494
);
489495
_checkExitCode();
490496
}
491-
} else {
492-
final List<FilePath> unitTestFiles = <FilePath>[];
493-
for (io.File testFile
494-
in testDir.listSync(recursive: true).whereType<io.File>()) {
495-
final FilePath testFilePath = FilePath.fromCwd(testFile.path);
496-
if (!testFilePath.absolute.endsWith('_test.dart')) {
497-
// Not a test file at all. Skip.
498-
continue;
499-
}
500-
if (!path
501-
.split(testFilePath.relativeToWebUi)
502-
.contains('golden_tests')) {
503-
unitTestFiles.add(testFilePath);
504-
}
505-
}
506-
// Run all unit-tests as a single batch.
507-
await _runTestBatch(unitTestFiles, concurrency: 10, expectFailure: false);
508-
_checkExitCode();
509497
}
510498
}
511499

0 commit comments

Comments
 (0)