Commit Graph

195 Commits

Author SHA1 Message Date
Alejandro Santiago
a97a9b33fc
Update matchesGoldenFile documentation reference to goldenFileComparator (#150343)
Updates the documentation for the [`matchesGoldenFile`](https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html) comparator. 

The documentation currently references the abstract class [`GoldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/GoldenFileComparator-class.html) "as the backend for this matcher", however I believe it should instead reference to [`goldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/goldenFileComparator.html) that also clearly states in its documentation that it is "This comparator is used as the backend for [matchesGoldenFile](https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html).".

Knowledge about [`goldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/goldenFileComparator.html) is useful for Flutter developers since it is required when trying to set their own custom comparator, and there is currently no reference to it within the [`matchesGoldenFile`](https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html). The abstract class [`GoldenFileComparator`](https://api.flutter.dev/flutter/flutter_test/GoldenFileComparator-class.html) is still being referenced within the second suggestion.

#76337, precisely https://github.com/flutter/flutter/issues/76337#issuecomment-2172941109
2024-06-17 22:00:12 +00:00
Greg Spencer
d68e05bf36
Reland: Request focus if accessibility focus is given to a Focus widget (#142942) (#149840)
## Description

This attempts to re-land #142942 after being reverted in https://github.com/flutter/flutter/pull/149741 because it broke the iOS [platform view UI integration test](https://github.com/flutter/flutter/blob/master/dev/integration_tests/ios_platform_view_tests/ios/PlatformViewUITests/PlatformViewUITests.m?rgh-link-date=2024-06-06T19%3A47%3A27Z).

The changes here from the original are that in the Focus widget we no longer set the `onFocus` for the `Semantics` if the platform is iOS.  It was not intended to do anything on iOS anyhow.

Also, I updated the matchers to not actually do anything yet with the SemanticsAction.focus matching, so that this can be landed without breaking customer tests, and once they have been updated to correctly look for the focus action, we can land a PR that will turn it on.

## Related Issues
 - https://github.com/flutter/flutter/issues/149838
 - https://github.com/flutter/flutter/issues/83809
 - https://github.com/flutter/flutter/issues/149842

## Tests
 - Updated framework tests to look for the appropriate things using the matchers, even though it doesn't actually test for them yet.
2024-06-12 20:05:10 +00:00
auto-submit[bot]
ec9965bd89
Reverts "Request focus if SemanticsAction.focus is sent to a focusable widget (#142942)" (#149741)
Reverts: flutter/flutter#142942
Initiated by: zanderso
Reason for reverting: Seems to have affected iOS platform view focus: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20native_platform_view_ui_tests_ios/10626/overview
Original PR Author: gspencergoog

Reviewed By: {yjbanov, goderbauer, chunhtai}

This change reverts the following previous change:
## Description

This causes the `Focus` widget to request focus on its focus node if the accessibility system (screen reader) focuses a widget via the `SemanticsAction.focus` action.

## Related Issues
 - https://github.com/flutter/flutter/issues/83809

## Tests
 - Added a test to make sure that focus is requested when `SemanticsAction.focus` is sent by the engine.
2024-06-05 14:54:18 +00:00
Greg Spencer
dd700e6d7c
Request focus if SemanticsAction.focus is sent to a focusable widget (#142942)
## Description

This causes the `Focus` widget to request focus on its focus node if the accessibility system (screen reader) focuses a widget via the `SemanticsAction.focus` action.

## Related Issues
 - https://github.com/flutter/flutter/issues/83809

## Tests
 - Added a test to make sure that focus is requested when `SemanticsAction.focus` is sent by the engine.
2024-06-05 00:42:59 +00:00
Nate
73ecc8a9b2
Reland "if chains → switch expressions" (#148634)
I did a goof a while back:

![late initialization error](https://github.com/flutter/flutter/assets/10457200/47dc423f-0dd0-4869-9a11-59cb7d1ea46e)

Now that [the bug is fixed](e9d403541f), I think we're good to re-implement the if-chains cleanup!

Related:

- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
2024-05-20 17:43:00 +00:00
Zachary Anderson
597462a3c4
Revert "if chains → switch expressions" (#148556)
Reverts flutter/flutter#147793

Introduced https://github.com/flutter/flutter/issues/148548.
2024-05-17 10:27:02 -07:00
Nate
4734d80f22
if chains → switch expressions (#147793)
Previous "if-chains" pull requests:
- https://github.com/flutter/flutter/pull/144905
- https://github.com/flutter/flutter/pull/144977
- https://github.com/flutter/flutter/pull/145194
- https://github.com/flutter/flutter/pull/146293
- https://github.com/flutter/flutter/pull/147472

<br>

I think this one should be enough to wrap things up!

fixes https://github.com/flutter/flutter/issues/144903

---------

Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
2024-05-10 00:55:48 -06: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
Michael Goderbauer
68e346e41c
Remove outdated ignores from tool (#140467)
These were not ignoring anything (anymore).
2023-12-20 22:14:32 +00:00
Bartek Pacia
948523b80c
Add accessibility identifier to SemanticsProperties (#138331)
This PR adds `String? identifier` to `Semantics` and `SemanticsProperties`. The `identifier` will be exposed on Android as `resource-id` and on iOS as `accessibilityIdentifier`.

Mainly targeted at #17988

Initial Engine PR with Android support: https://github.com/flutter/engine/pull/47961
iOS Engine PR: https://github.com/flutter/engine/pull/48858

### Migration

This change breaks the SemanticsUpdateBuilder API which is on the Framework<-->Engine border. For more details see [engine PR](https://github.com/flutter/engine/pull/47961).

Steps:
part 1: [engine] add `SemanticsUpdateBuilderNew` https://github.com/flutter/engine/pull/47961
**part 2: [flutter] use `SemanticsUpdateBuilderNew`**  <-- we are here
part 3: [engine] update `SemanticsUpdateBuilder` to be the same as `SemanticsUpdateBuilderNew`*
part 4: [flutter] use (now updated) `SemanticsUpdateBuilder` again.
part 5: [engine] remove `SemanticsBuilderNew`
2023-12-11 18:03:07 +00:00
pdblasi-google
52a1a31823
Adds API for performing semantics actions in tests (#132598)
* Added `performAction` to `SemanticsController` as well as specific methods for specific actions
* Added a `scrollable` finder to `find.semantics` as a convenience method for `findAny(<all scrollable actions>)`
* Updated `containsSemantics` and `matchSemantics` matchers to also work on `FinderBase<Semantics>`

Closes #112413
2023-10-18 00:26:14 +00:00
Kostia Sokolovskyi
a4e3f93367
Fix memory leak in _MatchesReferenceImage (#135150) 2023-09-22 15:26:25 -07:00
Ian Hickson
ccdf826466
PaginatedDataTable improvements (#131374)
- slightly improved assert message when row cell counts don't match column count.
- more breadcrumbs in API documentation. more documentation in general.
- added more documentation for the direction of the "ascending" arrow.
- two samples for PaginatedDataTable.
- make PaginatedDataTable support hot reloading across changes to the number of columns.
- introduce matrix3MoreOrLessEquals. An earlier version of this PR used it in tests, but eventually it was not needed. The function seems useful to keep though.
2023-08-15 00:55:07 +00:00
pdblasi-google
5df1c996ad
Adds SemanticsNode Finders for searching the semantics tree (#127137)
* Pulled `FinderBase` out of `Finder`
  * `FinderBase` can be used for any object, not just elements
  * Terminology was updated to be more "find" related
* Re-implemented `Finder` using `FinderBase<Element>`
  * Backwards compatibility maintained with `_LegacyFinderMixin`
* Introduced base classes for SemanticsNode finders
* Introduced basic SemanticsNode finders through `find.semantics`
* Updated some relevant matchers to make use of the more generic `FinderBase`

Closes #123634
Closes #115874
2023-08-10 21:31:06 +00:00
Michael Goderbauer
64a0683b41
Analyze code snippets in flutter_test docs (#132246)
Fixes https://github.com/flutter/flutter/issues/132274.
2023-08-10 17:18:12 +00:00
Qun Cheng
71d96ddf9c
Add Expanded/Collapsed State for Semantics (#131233) 2023-07-31 12:09:27 -07:00
pdblasi-google
e1702a96f6
Removes deprecated APIs from v2.6 in binding.dart and widget_tester.dart (#129663)
Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart`

Resolves #129654
2023-07-05 19:26:24 +00:00
William Oprandi
a9f17c876b
Fix syntax error in docstring (#128692) 2023-06-13 15:04:21 -07:00
Phil Quitslund
d0c0439b8d
fixes to anticipate next Dart linter release (#127211)
The upcoming linter release notices null literals as unnecessary argument values and flags more `type_literal_in_constant_pattern` cases. 

See breakages: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8780744067138629361/+/u/analyze_flutter_flutter/stdout
2023-05-19 21:27:24 +00:00
Tomasz Gucio
99c7e9f088
Add spaces after flow control statements (#126320) 2023-05-15 11:07:30 +02:00
fzyzcjy
37c95a2853
fix: moreOrLessEquals does not allow actual to be integers (#125599)
Close https://github.com/flutter/flutter/issues/125600
2023-04-27 14:28:32 +00:00
Nate Bosch
dcfd35f8a7
Remove uses of deprecated test_api imports (#124732)
Most of these imports were never appropriate. The `test_api` package was never intended for use in `_test.dart` files.
Where possible move imports to `matcher`, otherwise move them to `test` or `flutter_test`.

Leave uses of `test_api` from `flutter_test` library code.
2023-04-20 20:55:28 +00:00
Bernardo Ferrari
2e4d976bde
SemanticsFlag/SemanticsAction cleanup (part 4) (#123329)
`SemanticsFlag`/`SemanticsAction` cleanup (part 4)
2023-04-12 19:07:08 +00:00
Michael Goderbauer
83720015a4
Remove unnecessary null checks in flutter_test (#118865) 2023-01-20 22:01:13 +00:00
yaakovschectman
4d3c122434
Use tristate checkbox engine changes (#111032)
* Introduce tests for tristate checkboxes

* Initial

* Use tristate changes in engine

* Flutter_test matchers test update

* Comments, tests

* Update packages/flutter/lib/src/semantics/semantics.dart

Co-authored-by: Chris Bracken <chris@bracken.jp>

* Assert mutual exclusivity

* Assert valid state before updating state

* Update packages/flutter/lib/src/semantics/semantics.dart

Typo fix in comment

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>

Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2022-09-08 17:41:54 -04:00
pdblasi-google
574fb1f0a0
110598: expect() in semantic test producing unhelpful output (#110613) 2022-09-07 20:55:33 +00:00
Pierre-Louis
0c2f7bc2a2
Remove errant double spaces (#110758) 2022-09-02 04:00:58 +00:00
Ian Hickson
9b2668a451
Minor fix compendium (#107874) 2022-08-11 02:33:07 +00:00
Greg Spencer
f7c41d0988
Update equalsIgnoringHashCodes to take a list of Strings (#108507) 2022-08-03 19:48:06 +00:00
pdblasi-google
e499530152
Create containsSemantics to allow for partial matching of semantics in tests. (#108573) 2022-08-01 22:08:06 +00:00
Bernardo Ferrari
22cb06b57f
Add OvalBorder and BoxShape.oval (#103833) 2022-07-20 21:29:04 +00:00
Jonah Williams
f980d6654e
Add a matcher for Matrix4 that includes epsilon (#107326) 2022-07-11 19:23:05 +00:00
Ian Hickson
265ef1efb8
Export SpellOutStringAttribute and LocaleStringAttribute (#106682) 2022-06-27 20:10:05 +00:00
Alexandre Ardhuin
56c4e3cdd8
add some exports of public API in foundation/serialization.dart (#104231) 2022-06-08 13:33:12 -07:00
Pierre-Louis
74cfc3db67
Use curly_braces_in_flow_control_structures for non-flutter packages (#104629)
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_driver`

* Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens`

* Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens_client`

* Use `curly_braces_in_flow_control_structures` for `packages/flutter_localizations`

* Use `curly_braces_in_flow_control_structures` for `packages/flutter_test`

* Use `curly_braces_in_flow_control_structures` for `packages/flutter_web_plugins`

* fix comments

* Use `curly_braces_in_flow_control_structures` for `packages/integration_test`

* fix indentation
2022-05-25 20:01:11 +02:00
Alexandre Ardhuin
07f1c20474
add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Daniel Cardona Rojas
a3a9a23e46
Add matcher to find at least a given number of widgets (#102081) (#102342) 2022-04-22 15:24:10 -07:00
chunhtai
2ebc7bee9c
Adds tooltip to semantics node (#87684) 2022-04-21 12:14:09 -07:00
chunhtai
796df06c32
Add API sample code to AccessibilityGuideline (#102161) 2022-04-19 14:34:08 -07:00
Harsh Bhikadia
fece72cac7
docs(flutter_test): fix mention of non-existing matchesSemanticsNode (#99659) 2022-03-16 18:55:18 -07:00
Ian Hickson
ab89ce285f
Clean up the bindings APIs. (#89451) 2022-02-03 14:55:15 -08:00
Alberto
ee6a693cde
chore(flutter_test): updated 'matchesGoldenFile' documentation (#96194) 2022-01-20 15:25:20 -08:00
Kate Lovett
616f9bcffa
Add tag support for executing reduced test sets (#86821) 2021-08-30 15:41:02 -07:00
Jonah Williams
fa0782b696
reassign jonahwilliams todos (#88707) 2021-08-23 12:27:07 -07:00
chunhtai
67cee63087
Add string attribute api to text span (#86667) 2021-07-30 15:49:04 -07:00
Ren You
3dea9f0251
Revert "Clean up the bindings APIs (#86438)" (#86484)
This reverts commit d056500bfe.
2021-07-15 09:29:16 -07:00
Ian Hickson
d056500bfe
Clean up the bindings APIs (#86438) 2021-07-14 14:41:24 -07:00
Zachary Anderson
7f741e9181
Revert "Clean up the bindings APIs (#86388)" (#86404)
This reverts commit 31de052e3f.
2021-07-13 21:32:29 -07:00
Ian Hickson
31de052e3f
Clean up the bindings APIs (#86388) 2021-07-13 18:31:11 -07:00
Ian Hickson
c800b9c3e4
Revert "Clean up the bindings APIs (#83843)" (#86386)
This reverts commit e2490f2906.
2021-07-13 15:47:40 -07:00