Commit graph

1442 commits

Author SHA1 Message Date
Michael Goderbauer 63f917c36d
Bump meta to 1.14.0 (#146925)
Not sure why the auto-roller hasn't picked this up...
2024-04-17 15:25:51 -07:00
Ian Hickson 3fadf9e2fb
Make goldenFileComparator a field instead of a trivial property (#146800)
Removes an unnecessary abstraction.
2024-04-17 21:55:55 +00:00
Pierre-Louis 4a65a76279
Reland: Update link branches to main (#146882)
Reland https://github.com/flutter/flutter/pull/146558, reverted in https://github.com/flutter/flutter/pull/146880 due to an outdated test result

## Original description

- Update CS and googlesource.com link branches
- Update GitHub /blob/ and /tree/ links

Tested links manually and fixes a few broken or deprecated links

Added a test that validates that `master` isn't used, except for specified repos.

Part of https://github.com/flutter/flutter/issues/121564
2024-04-17 13:16:33 +00:00
Pierre-Louis 33a9643b5d
Revert "Update link branches to main" (#146880)
Reverts flutter/flutter#146558

Causes failure
2024-04-17 13:25:18 +02:00
Pierre-Louis 072b8874a0
Update link branches to main (#146558)
- Update CS and googlesource.com link branches
- Update GitHub /blob/ and /tree/ links

Tested links manually and fixes a few broken or deprecated links

Added a test that validates that `master` isn't used, except for
specified repos.

Part of https://github.com/flutter/flutter/issues/121564

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
2024-04-17 09:44:23 +02:00
flutter-pub-roller-bot 4efdf190a8
Roll pub packages (#146842)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-04-16 22:07:27 +00:00
Jackson Gardner 51e70fa16b
Fix skwasm tests (#145570)
Skwasm tests are now running as `bringup: true` in postsubmit, but failing. Let's get them fixed.
2024-04-09 19:35:07 +00:00
Qun Cheng 69db714fbb
Update material_color_utilities package version to latest 0.11.1 (#145959)
This PR is to update material_color_utilities package version to the latest. `material_color_utilities/scheme/scheme_fruit_salad.dart` and `material_color_utilities/scheme/scheme_rainbow.dart` are exported after version 0.9.0.

Once this PR is merged, we don't need to explicitly import these two files like the change in PR #144805, which breaks some dependencies in `Google testing`.
2024-04-03 02:16:13 +00:00
Polina Cherkasova bca1d6ad1f
Upgrade leak_tracker. (#145997) 2024-03-29 12:31:52 -07:00
Polina Cherkasova 1a2f34ab5b
Upgrade leak_tracker. (#145940) 2024-03-29 02:39:17 +00:00
Jackson Gardner 31209d04ff
flutter test --wasm support (#145347)
* Adds support for `flutter test --wasm`.
  * The test compilation flow is a bit different now, so that it supports compilers other than DDC. Specifically, when we run a set of unit tests, we generate a "switchboard" main function that imports each unit test and runs the main function for a specific one based off of a value set by the JS bootstrapping code. This way, there is one compile step and the same compile output is invoked for each unit test file.
* Also, removes all references to `dart:html` from flutter/flutter.
* Adds CI steps for running the framework unit tests with dart2wasm+skwasm
  * These steps are marked as `bringup: true`, so we don't know what kind of failures they will result in. Any failures they have will not block the tree at all yet while we're still in `bringup: true`. Once this PR is merged, I plan on looking at any failures and either fixing them or disabling them so we can get these CI steps running on presubmit.

This fixes https://github.com/flutter/flutter/issues/126692
2024-03-21 20:08:07 +00:00
flutter-pub-roller-bot 61b3f975a0
Roll pub packages (#145476)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-03-21 00:09:24 +00:00
Nate b9e537336f
Turning if chains into shorter switch statements (#144977)
This pull request is part of the effort to solve issue #144903.

In the past, my efforts to reduce line length involved refactoring away from switch statements, but unlike [yesterday's PR](https://github.com/flutter/flutter/pull/144905), this one is full of switch statements that make things more concise!
2024-03-13 17:16:17 +00:00
Michael Goderbauer 77651bc496
Reland "Fail tests on exceptions raised after test completed (#144706)" (#144980)
Reverts flutter/flutter#144970

No changes in this PR compared to the original. The test failure was fixed by adding missing awaits in https://github.com/flutter/flutter/pull/144978.

Fixes https://github.com/flutter/flutter/issues/144353.
2024-03-12 18:17:10 +00:00
auto-submit[bot] 49f45d2095
Reverts "Fail tests on exceptions raised after test completed (#144706)" (#144970)
Reverts: flutter/flutter#144706
Initiated by: gspencergoog
Reason for reverting: This has broken the tree because some tests are still failing post completion. This particular one looks like it might have to do with a gold image not existing.
Original PR Author: goderbauer

Reviewed By: {Piinks}

This change reverts the following previous change:
A test was failing silently because of this (see https://github.com/flutter/flutter/issues/144353 and fixed in https://github.com/flutter/flutter/pull/144709). The failure went undetected for months. Ideally, this should have been a regular non-silent failure. This change makes that so. `package:test` can properly handle reported exceptions outside of test cases. With this change, the test fails as follows:

```
00:03 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#1cd37(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +81 -1: Smoke test material/context_menu/context_menu_controller.0.dart
00:03 +81 -1: Smoke test material/color_scheme/dynamic_content_color.0.dart [E]
  Test failed. See exception logs above.
  The test description was: Smoke test material/color_scheme/dynamic_content_color.0.dart
  
  This test failed after it had already completed.
  Make sure to use a matching library which informs the test runner
  of pending async work.
```
2024-03-11 23:31:18 +00:00
Michael Goderbauer 91cccc8e6b
Fail tests on exceptions raised after test completed (#144706)
A test was failing silently because of this (see
https://github.com/flutter/flutter/issues/144353 and fixed in
https://github.com/flutter/flutter/pull/144709). The failure went
undetected for months. Ideally, this should have been a regular
non-silent failure. This change makes that so. `package:test` can
properly handle reported exceptions outside of test cases. With this
change, the test fails as follows:

```
00:03 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#1cd37(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +81 -1: Smoke test material/context_menu/context_menu_controller.0.dart
00:03 +81 -1: Smoke test material/color_scheme/dynamic_content_color.0.dart [E]
  Test failed. See exception logs above.
  The test description was: Smoke test material/color_scheme/dynamic_content_color.0.dart
  
  This test failed after it had already completed.
  Make sure to use a matching library which informs the test runner
  of pending async work.
```
2024-03-11 16:05:24 -07:00
Nate 26e379e0fc
Refactoring if chains into switch statements (#144905)
Based on issue #144903, this PR aims to bring the codebase more in line with the [Flutter repo style guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-using-if-chains-or--or--with-enum-values):

> #### Avoid using `if` chains or `?:` or `==` with enum values

<br>

This change unfortunately increases the total line length, but it also improves readability.
2024-03-11 23:04:57 +00:00
Polina Cherkasova a04fe3169a
Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
Bruno Leroux 471a82856d
[flutter_test] Use defaultTargetPlatform for key events simulation (#143579)
## Description

This PRs changes the default value for the `platform` parameter used to simulate key events.

With this PR, the default value is "web" on web, otherwise it is the operating system name retrieved from `defaultTargetPlatform`.

Previously, for methods in `WidgetController`, it defaulted to “web” on web, and “android” everywhere else. And for methods in `KeyEventSimulator` it defaulted to “web” on web, and the operating system that the test was running on everywhere else. Because the operating system was based on `Platform.operatingSystem`, it usually differed from the target platform the test was running on.

AFAIK, the `platform` parameter is only meaningful for simulating `RawKeyEvent`. Once `RawKeyboard` will be fully removed, the `platform` parameter won’t be needed. 
@gspencergoog  In the meantime, do you think it is worth merging this fix?

## Related Issue

Fixes to https://github.com/flutter/flutter/issues/133955

## Tests

Adds one test.
2024-03-07 16:08:20 +00:00
Bruno Leroux 8ade81fb20
[flutter_test] Change KeyEventSimulator default transit mode (#143847)
## Description

This PRs changes the default value transit mode for key event simulation.

The default transit mode for key event simulation is currently `KeyDataTransitMode.rawKeyData` while on the framework side `KeyDataTransitMode.keyDataThenRawKeyData` is the preferred transit mode.

`KeyDataTransitMode.keyDataThenRawKeyData` is more accurate and can help detect issues.

For instance the following test will fail with `KeyDataTransitMode.rawKeyData` because raw keyboard logic for modifier keys is less accurate:

```dart
  testWidgets('Press control left once', (WidgetTester tester) async {
    debugKeyEventSimulatorTransitModeOverride = KeyDataTransitMode.keyDataThenRawKeyData;

    final List<KeyEvent> events = <KeyEvent>[];
    final FocusNode focusNode = FocusNode();
    addTearDown(focusNode.dispose);

    await tester.pumpWidget(
      Focus(
        focusNode: focusNode,
        autofocus: true,
        onKeyEvent: (_, KeyEvent event) {
          events.add(event);
          return KeyEventResult.handled;
        },
        child: Container(),
      ),
    );

    await simulateKeyDownEvent(LogicalKeyboardKey.controlLeft);

    // This will fail when transit mode is KeyDataTransitMode.rawKeyData
    // because a down event for controlRight is synthesized.
    expect(events.length, 1);

    debugKeyEventSimulatorTransitModeOverride = null;
  });
```

And the following this test is ok with `KeyDataTransitMode.rawKeyData` but rightly fails with `KeyDataTransitMode.keyDataThenRawKeyData`:

```dart
  testWidgets('Simulates consecutive key down events', (WidgetTester tester) async {
    debugKeyEventSimulatorTransitModeOverride = KeyDataTransitMode.rawKeyData;

    // Simulating several key down events without key up in between is tolerated
    // when transit mode is KeyDataTransitMode.rawKeyData, it will trigger an
    // assert on KeyDataTransitMode.keyDataThenRawKeyData.
    await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);
    await simulateKeyDownEvent(LogicalKeyboardKey.arrowDown);

    debugKeyEventSimulatorTransitModeOverride = null;
  });
```

## Related Issue

Related to https://github.com/flutter/flutter/issues/143845

## Tests

Adds two tests.
2024-03-07 07:19:26 +00:00
Nate 1a0dc8f1e1
Add missing parameter to TableBorder.symmetric, and improve class constructors (#144279)
Originally, my aim was just to refactor (as per usual), but while messing around with the `TableBorder.symmetric` constructor, I realized that `borderRadius` was missing!

This pull request makes a few class constructors more efficient, and it fixes #144277 by adding the missing parameter.

<br>
2024-03-04 20:20:19 +00:00
Qun Cheng 0d8eafb006
Reland "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2" (#144273) 2024-02-28 13:55:50 -08:00
hangyu fdb17ab069
Reland [a11y] Add isEnabled semantics flag to text field (#143601)
Reland #143334
2024-02-27 22:49:13 +00:00
auto-submit[bot] 2eee0b5750
Reverts "Reland - Introduce tone-based surfaces and accent color add-ons - Part 2 (#144001)" (#144262)
Reverts flutter/flutter#144001

Initiated by: Piinks

Reason for reverting: Failing goldens at the tip of tree

Original PR Author: QuncCccccc

Reviewed By: {HansMuller}

This change reverts the following previous change:
Original Description:
Reverts flutter/flutter#143973

This is a reland for #138521 with an updated g3fix(cl/605555997). Local test: cl/609608958.
2024-02-27 22:04:18 +00:00
Qun Cheng 871d59221c
Reland - Introduce tone-based surfaces and accent color add-ons - Part 2 (#144001)
Reverts flutter/flutter#143973

This is a reland for #138521 with an updated g3fix(cl/605555997). Local test: cl/609608958.
2024-02-27 20:21:14 +00:00
Polina Cherkasova 523b0c4d84
Move debugShowWidgetInspectorOverride (#144029)
Contributes to https://github.com/dart-lang/leak_tracker/issues/218
2024-02-26 23:55:52 +00:00
Nate c53a18f4e4
Implementing null-aware operators throughout the repository (#143804)
This pull request fixes #143803 by taking advantage of Dart's null-aware operators.

And unlike `switch` expressions ([9 PRs](https://github.com/flutter/flutter/pull/143634) and counting), the Flutter codebase is already fantastic when it comes to null-aware coding. After refactoring the entire repo, all the changes involving `?.` and `??` can fit into a single pull request.
2024-02-23 19:02:22 +00:00
Qun Cheng 4715216c01
Revert "Introduce tone-based surfaces and accent color add-ons - Part 2" (#143973)
Reverts flutter/flutter#138521
2024-02-22 14:51:28 -08:00
Derek Xu dfb5888e8f
Support using lightweight Flutter Engines to run tests (#141726)
This PR implements the functionality described above and hides it behind
the `--experimental-faster-testing` flag of `flutter test`.

### The following are some performance measurements from test runs
conducted on GitHub Actions

run 1 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/1
run 2 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/2
run 3 logs:
https://github.com/derekxu16/flutter_test_ci/actions/runs/8008029772/attempts/3

**length of `flutter test --reporter=expanded test/animation
test/foundation` step**

run 1: 54s
run 2: 52s
run 3: 56s

average: 54s

**length of `flutter test --experimental-faster-testing
--reporter=expanded test/animation test/foundation` step**

run 1: 27s
run 2: 27s
run 3: 29s

average: 27.67s (~48.77% shorter than 54s)

**length of `flutter test --reporter=expanded test/animation
test/foundation test/gestures test/painting test/physics test/rendering
test/scheduler test/semantics test/services` step**

run 1: 260s
run 2: 270s
run 3: 305s

average: 278.33s


**length of `flutter test --experimental-faster-testing
--reporter=expanded test/animation test/foundation test/gestures
test/painting test/physics test/rendering test/scheduler test/semantics
test/services` step**

from a clean build (right after deleting the build folder):

run 1: 215s
run 2: 227s
run 3: 245s

average: 229s (~17.72% shorter than 278.33s)

Note that in reality, `test/material` was not passed to `flutter test`
in the trials below. All of the test files under `test/material` except
for `test/material/icons_test.dart` were listed out individually

**length of `flutter test --reporter=expanded test/material` step**

run 1: 408s
run 2: 421s
run 3: 451s

average: 426.67s

**length of `flutter test --experimental-faster-testing
--reporter=expanded test/material` step**

run 1: 382s
run 2: 373s
run 3: 400s

average: 385s (~9.77% shorter than 426.67s)

---------

Co-authored-by: Dan Field <dnfield@google.com>
2024-02-22 13:32:29 -05:00
Qun Cheng a2c7ed95d1
Introduce tone-based surfaces and accent color add-ons - Part 2 (#138521)
This PR is to introduce 19 new color roles and deprecate 3 color roles in `ColorScheme`.
**Tone-based surface colors** (7 colors): 
* surfaceBright
* surfaceDim
* surfaceContainer
* surfaceContainerLowest
* surfaceContainerLow
* surfaceContainerHigh
* surfaceContainerHighest

**Accent color add-ons** (12 colors):
* primary/secondary/tertiary-Fixed
* primary/secondary/tertiary-FixedDim
* onPrimary/onSecondary/onTertiary-Fixed
* onPrimary/onSecondary/onTertiary-FixedVariant

**Deprecated colors**:
* background -> replaced with surface
* onBackground -> replaced with onSurface
* surfaceVariant -> replaced with surfaceContainerHighest

Please checkout this [design doc](https://docs.google.com/document/d/1ODqivpM_6c490T4j5XIiWCDKo5YqHy78YEFqDm4S8h4/edit?usp=sharing) for more information:)

![Screenshot 2024-01-08 at 4 56 51 PM](https://github.com/flutter/flutter/assets/36861262/353cdb4c-6ba9-4435-a518-fd3f67e415f0)
2024-02-20 19:01:50 +00:00
Michael Goderbauer 546bdec7ef
Fix implementation imports outside of lib (#143594)
Work towards https://github.com/dart-lang/linter/issues/4859

There are libraries outside a `lib/` directory, which violate `implementation_imports`.

Supersedes https://github.com/flutter/flutter/pull/143560.
2024-02-16 22:38:10 +00:00
Michael Goderbauer 50862bc04a
Fix SemanticsFinder for multi-view (#143485)
Fixes https://github.com/flutter/flutter/issues/143405.

It was counter-intuitive that a SemanticsFinder without specifying a FlutterView would only search the nodes in the default view. This change makes it so that when no view is specified the semantics trees of all known FlutterViews are searched.
2024-02-16 22:24:55 +00:00
Kate Lovett ea3d066237
Reland simulatedAccessibilityTraversal fix (#143527)
Relands https://github.com/flutter/flutter/pull/143386
Which was reverted in https://github.com/flutter/flutter/pull/143523
Fixes https://github.com/flutter/flutter/issues/143173
Unblocks https://github.com/flutter/flutter/pull/143485

⭐ ➡️  Update from the revert is in this commit: 1e6853291e
2024-02-15 21:37:40 +00:00
auto-submit[bot] d00fe8faae
Reverts "Fix and test SemanticsController.simulatedAccessibilityTraversal (#143386)" (#143523)
Reverts flutter/flutter#143386

Initiated by: Piinks

Reason for reverting: This broke a customer test.

Original PR Author: Piinks

Reviewed By: {goderbauer}

This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/143173

The `start` and `end` parameters of `SemanticsController.simulatedAccessibilityTraversal` were deprecated in https://github.com/flutter/flutter/issues/112413, but no tests were added that verified the new API. 😳

This change
- fixes a typo in an error message
- fixes the new `startNode` and `endNode` not being accounted for in setting the traversal range
- adds dart fixes for the deprecations
- adds tests for the new API that is meant to replace the deprecated one.
  - Filed https://github.com/flutter/flutter/issues/143405 to follow up on the new API not working in multiple views.
2024-02-15 15:49:26 +00:00
auto-submit[bot] 0fac13b443
Reverts "[a11y] Add isEnabled semantics flag to text field (#143334)" (#143494)
Reverts flutter/flutter#143334

Initiated by: hangyujin

Reason for reverting: broke g3 tests

Original PR Author: hangyujin

Reviewed By: {LongCatIsLooong}

This change reverts the following previous change:
Original Description:
Add a semantics flag to   text field to fix https://github.com/flutter/flutter/issues/143337 (in IOS the disabled text field is not read `dimmed`)

internal: b/322345393
2024-02-14 22:43:18 +00:00
Michael Goderbauer 3f09b23338
cleanup now-irrelevant ignores for deprecated_member_use (#143403)
Follow-up to https://github.com/flutter/flutter/pull/143347.
2024-02-14 21:08:25 +00:00
Kate Lovett f190d6259f
Fix and test SemanticsController.simulatedAccessibilityTraversal (#143386)
Fixes https://github.com/flutter/flutter/issues/143173

The `start` and `end` parameters of `SemanticsController.simulatedAccessibilityTraversal` were deprecated in https://github.com/flutter/flutter/issues/112413, but no tests were added that verified the new API. 😳

This change
- fixes a typo in an error message
- fixes the new `startNode` and `endNode` not being accounted for in setting the traversal range
- adds dart fixes for the deprecations
- adds tests for the new API that is meant to replace the deprecated one.
  - Filed https://github.com/flutter/flutter/issues/143405 to follow up on the new API not working in multiple views.
2024-02-14 20:48:36 +00:00
hangyu 14bce28f3c
[a11y] Add isEnabled semantics flag to text field (#143334)
Add a semantics flag to   text field to fix https://github.com/flutter/flutter/issues/143337 (in IOS the disabled text field is not read `dimmed`)

internal: b/322345393
2024-02-13 22:35:43 +00:00
Polina Cherkasova b48dfca382
Upgrade leak_tracker. (#143236) 2024-02-09 14:41:22 -08:00
Kris Pypen 2f117c545b
Fix: performance improvement on golden test comparison (#142913)
During golden test image comparison 2 lists of a different type are compared with the method "identical", so this will never be true. The test image is a _Uint8ArrayView while the master image is an Uint8List. So that results in always a heavy computation to get the difference between the test and the master image.

When you run this test snippet I go from 51 seconds to 14 seconds:
```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  for (int i = 0; i < 100; i++) {
    testWidgets('Small test', (WidgetTester tester) async {
      await tester.pumpWidget(Directionality(textDirection: TextDirection.ltr, child: Text('jo')));
      await expectLater(find.byType(Text), matchesGoldenFile('main.png'));
    });
  }
}
```
2024-02-09 22:05:00 +00:00
Valentin Vignal ab836a2db0
Add the number of mismatched pixels to golden tests output (#142975)
Fixes https://github.com/flutter/flutter/issues/141036
2024-02-07 18:59:57 +00:00
Andrew Brampton 10f1e63579
Update _goldens_io.dart to generate failure images during a size mism… (#142177)
Update the `matchesGoldenFile()` / `LocalComparisonOutput` code to generate failure images for golden tests that fail when the image sizes do not match. This can make it far quicker to identify what is wrong with the test image.

Fixes https://github.com/flutter/flutter/issues/141488

- [ x I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
2024-02-07 03:23:29 +00:00
Christopher Fujino a80333349a
Unpin test (#141427)
Fixes https://github.com/flutter/flutter/issues/140169
2024-02-01 18:53:23 +00:00
Aizat Azhar 75a2e5b493
Reset framesEnabled to default value at the end of each test (#141844)
Reset `framesEnabled` to `true` at the end of each test as otherwise subsequent tests may fail when pumping a widget

Fixes #141835
2024-01-30 16:04:15 +00:00
Michael Goderbauer 671d8eaf71
Relands "Add runWidget to bootstrap a widget tree without a default View" (#142344)
Reverts flutter/flutter#142339

In the original change one of the tests included the same view twice which resulted in a different failure than the expected one. The second commit contains the fix for this. I don't understand how this wasn't caught presubmit on CI.
2024-01-26 23:05:53 +00:00
auto-submit[bot] 114261a63a
Reverts "Add runWidget to bootstrap a widget tree without a default View" (#142339)
Reverts flutter/flutter#141484
Initiated by: eliasyishak
This change reverts the following previous change:
Original Description:
The existing `runApp` bootstraps the widget tree and renders the provided widget into the default view (which is currently the implicit View from `PlatformDispatcher.implicitView` and - in the future - may be a default-created window). Apps, that want more control over the View they are rendered in, need a new way to bootstrap the widget tree: `runWidget`. It does not make any assumptions about the View the provided widget is rendered into. Instead, it is up to the caller to include a View widget in the provided widget tree that specifies where content should be rendered. In the future, this may enable developers to create a custom window for their app instead of relying on the default-created one.
2024-01-26 21:06:27 +00:00
Michael Goderbauer 5b44596c5f
Add runWidget to bootstrap a widget tree without a default View (#141484)
The existing `runApp` bootstraps the widget tree and renders the provided widget into the default view (which is currently the implicit View from `PlatformDispatcher.implicitView` and - in the future - may be a default-created window). Apps, that want more control over the View they are rendered in, need a new way to bootstrap the widget tree: `runWidget`. It does not make any assumptions about the View the provided widget is rendered into. Instead, it is up to the caller to include a View widget in the provided widget tree that specifies where content should be rendered. In the future, this may enable developers to create a custom window for their app instead of relying on the default-created one.
2024-01-26 19:12:21 +00:00
Polina Cherkasova a522b38e96
Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
Jesús S Guerrero b5262f0d80
Revert "[web] - Fix broken TextField in semantics mode when it's a sibling of Navigator" (#142129)
Reverts flutter/flutter#138446

b/322136071
2024-01-24 16:13:26 +00:00
Hassan Toor 59e892d391
[web] - Fix broken TextField in semantics mode when it's a sibling of Navigator (#138446)
When a `TextField` is rendered before a `Navigator`, it breaks in semantics mode.  This is because the framework generates the incorrect semantics tree (excludes the TextField) and when that tree gets sent to the engine, we don't get the signal to create the corresponding `<input>` element.

This happens for a few reasons:
* `ModalBarrier` uses `BlockSemantics` to drop the semantics of routes beneath the current route in `Navigator`
* `ModalBarrier` mistakenly recognizes the widget outside of the `Navigator` to be its sibling
*  So we end up dropping the semantics node of the `TextField` rendered before it. 

The fix is to let `Navigator` generate a semantics node so that `ModalBarrier` doesn't mistakenly think widgets outside of `Navigator` are its siblings.  

`Navigator` doesn't currently do this, which causes all the nodes generated from its widget subtree to be directly attached to the parent semantics node above `Navigator` - since this is also the parent of `TextField`, it considers them siblings. 

Fixes https://github.com/flutter/flutter/issues/129324
2024-01-22 17:03:14 +00:00