Commit 471a828
authored
[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 flutter/flutter#133955
## Tests
Adds one test.1 parent 4e63a6a commit 471a828
File tree
3 files changed
+55
-22
lines changed- packages/flutter_test
- lib/src
- test
3 files changed
+55
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
1957 | 1955 | | |
1958 | 1956 | | |
1959 | 1957 | | |
1960 | | - | |
1961 | | - | |
| 1958 | + | |
| 1959 | + | |
1962 | 1960 | | |
1963 | 1961 | | |
1964 | 1962 | | |
| |||
1982 | 1980 | | |
1983 | 1981 | | |
1984 | 1982 | | |
1985 | | - | |
| 1983 | + | |
1986 | 1984 | | |
1987 | 1985 | | |
1988 | 1986 | | |
| |||
1999 | 1997 | | |
2000 | 1998 | | |
2001 | 1999 | | |
2002 | | - | |
2003 | | - | |
| 2000 | + | |
| 2001 | + | |
2004 | 2002 | | |
2005 | 2003 | | |
2006 | 2004 | | |
| |||
2021 | 2019 | | |
2022 | 2020 | | |
2023 | 2021 | | |
2024 | | - | |
| 2022 | + | |
2025 | 2023 | | |
2026 | 2024 | | |
2027 | 2025 | | |
| |||
2036 | 2034 | | |
2037 | 2035 | | |
2038 | 2036 | | |
2039 | | - | |
2040 | | - | |
| 2037 | + | |
| 2038 | + | |
2041 | 2039 | | |
2042 | 2040 | | |
2043 | 2041 | | |
| |||
2052 | 2050 | | |
2053 | 2051 | | |
2054 | 2052 | | |
2055 | | - | |
| 2053 | + | |
2056 | 2054 | | |
2057 | 2055 | | |
2058 | 2056 | | |
| |||
2065 | 2063 | | |
2066 | 2064 | | |
2067 | 2065 | | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
2071 | 2069 | | |
2072 | 2070 | | |
2073 | 2071 | | |
| |||
2088 | 2086 | | |
2089 | 2087 | | |
2090 | 2088 | | |
2091 | | - | |
| 2089 | + | |
2092 | 2090 | | |
2093 | 2091 | | |
2094 | 2092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
| 714 | + | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
723 | | - | |
| 723 | + | |
| 724 | + | |
724 | 725 | | |
725 | 726 | | |
726 | 727 | | |
| |||
767 | 768 | | |
768 | 769 | | |
769 | 770 | | |
770 | | - | |
| 771 | + | |
| 772 | + | |
771 | 773 | | |
772 | 774 | | |
773 | 775 | | |
| |||
811 | 813 | | |
812 | 814 | | |
813 | 815 | | |
814 | | - | |
| 816 | + | |
| 817 | + | |
815 | 818 | | |
816 | 819 | | |
817 | 820 | | |
| |||
860 | 863 | | |
861 | 864 | | |
862 | 865 | | |
863 | | - | |
| 866 | + | |
| 867 | + | |
864 | 868 | | |
865 | 869 | | |
866 | 870 | | |
| |||
894 | 898 | | |
895 | 899 | | |
896 | 900 | | |
897 | | - | |
| 901 | + | |
| 902 | + | |
898 | 903 | | |
899 | 904 | | |
900 | 905 | | |
| |||
922 | 927 | | |
923 | 928 | | |
924 | 929 | | |
925 | | - | |
| 930 | + | |
| 931 | + | |
926 | 932 | | |
927 | 933 | | |
928 | 934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
363 | 392 | | |
0 commit comments