Unverified Commit 522d19e2 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Unskip the bidi semantics test. (#62823)

parent 209e3e9f
...@@ -506,6 +506,13 @@ void main() { ...@@ -506,6 +506,13 @@ void main() {
); );
// The expected visual order of the text is: // The expected visual order of the text is:
// hello world RIS OD you OD WOH YOB good bye // hello world RIS OD you OD WOH YOB good bye
// There are five unique text areas, they are, in visual order but
// showing the logical text:
// [hello world][SIR][HOW DO you DO][BOY][good bye]
// The direction of each varies based on the first bit of that area.
// The presence of the bidi formatting characters in the text is a
// bit dubious, but that's what we do currently, and it's not really
// clear what the perfect behavior would be...
final TestSemantics expectedSemantics = TestSemantics.root( final TestSemantics expectedSemantics = TestSemantics.root(
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics.rootChild( TestSemantics.rootChild(
...@@ -513,33 +520,31 @@ void main() { ...@@ -513,33 +520,31 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
TestSemantics( TestSemantics(
rect: const Rect.fromLTRB(-4.0, -4.0, 480.0, 18.0), rect: const Rect.fromLTRB(-4.0, -4.0, 480.0, 18.0),
label: 'hello world ', label: 'hello world${Unicode.RLE}${Unicode.RLO} ',
textDirection: TextDirection.ltr, // text direction is declared as LTR. textDirection: TextDirection.ltr,
), ),
TestSemantics( TestSemantics(
rect: const Rect.fromLTRB(150.0, -4.0, 200.0, 18.0), rect: const Rect.fromLTRB(416.0, -4.0, 466.0, 18.0),
label: 'RIS', label: 'BOY',
textDirection: TextDirection.rtl, // in the last string we switched to RTL using RLE. textDirection: TextDirection.rtl,
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.longPress],
flags: <SemanticsFlag>[SemanticsFlag.isLink],
), ),
TestSemantics( TestSemantics(
rect: const Rect.fromLTRB(192.0, -4.0, 424.0, 18.0), rect: const Rect.fromLTRB(192.0, -4.0, 424.0, 18.0),
label: ' OD you OD WOH ', // Still RTL. label: ' HOW DO${Unicode.PDF} you ${Unicode.RLO} DO ',
textDirection: TextDirection.rtl, textDirection: TextDirection.rtl,
), ),
TestSemantics( TestSemantics(
rect: const Rect.fromLTRB(416.0, -4.0, 466.0, 18.0), rect: const Rect.fromLTRB(150.0, -4.0, 200.0, 18.0),
label: 'YOB', label: 'SIR',
textDirection: TextDirection.rtl, // Still RTL. textDirection: TextDirection.rtl,
actions: <SemanticsAction>[ actions: <SemanticsAction>[SemanticsAction.tap],
SemanticsAction.longPress, flags: <SemanticsFlag>[SemanticsFlag.isLink],
],
), ),
TestSemantics( TestSemantics(
rect: const Rect.fromLTRB(472.0, -4.0, 606.0, 18.0), rect: const Rect.fromLTRB(472.0, -4.0, 606.0, 18.0),
label: ' good bye', label: '${Unicode.PDF}${Unicode.PDF} good bye',
textDirection: TextDirection.rtl, // Begin as RTL but pop to LTR. textDirection: TextDirection.rtl,
), ),
], ],
), ),
...@@ -554,7 +559,7 @@ void main() { ...@@ -554,7 +559,7 @@ void main() {
), ),
); );
semantics.dispose(); semantics.dispose();
}, skip: true); // https://github.com/flutter/flutter/issues/20891 }, skip: isBrowser); // https://github.com/flutter/flutter/issues/62945
testWidgets('TapGesture recognizers contribute link semantics', (WidgetTester tester) async { testWidgets('TapGesture recognizers contribute link semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
......
...@@ -4,16 +4,23 @@ ...@@ -4,16 +4,23 @@
import 'dart:io'; import 'dart:io';
// Whether the current dart code is running in an environment that was compiled /// Whether the test is running in a web browser compiled to JavaScript.
// to JavaScript. ///
const bool _kIsCompiledToJavaScript = identical(0, 0.0); /// See also:
///
/// * [kIsWeb], the equivalent constant in the `foundation` library.
const bool isBrowser = identical(0, 0.0);
/// Whether the test is running on the Windows operating system. /// Whether the test is running on the Windows operating system.
/// ///
/// This does not include test compiled to JavaScript running in a browser on /// This does not include tests compiled to JavaScript running in a browser on
/// the Windows operating system. /// the Windows operating system.
///
/// See also:
///
/// * [isBrowser], which reports true for tests running in browsers.
bool get isWindows { bool get isWindows {
if (_kIsCompiledToJavaScript) { if (isBrowser) {
return false; return false;
} }
return Platform.isWindows; return Platform.isWindows;
...@@ -21,10 +28,14 @@ bool get isWindows { ...@@ -21,10 +28,14 @@ bool get isWindows {
/// Whether the test is running on the macOS operating system. /// Whether the test is running on the macOS operating system.
/// ///
/// This does not include test compiled to JavaScript running in a browser on /// This does not include tests compiled to JavaScript running in a browser on
/// the macOS operating system. /// the macOS operating system.
///
/// See also:
///
/// * [isBrowser], which reports true for tests running in browsers.
bool get isMacOS { bool get isMacOS {
if (_kIsCompiledToJavaScript) { if (isBrowser) {
return false; return false;
} }
return Platform.isMacOS; return Platform.isMacOS;
...@@ -32,16 +43,15 @@ bool get isMacOS { ...@@ -32,16 +43,15 @@ bool get isMacOS {
/// Whether the test is running on the Linux operating system. /// Whether the test is running on the Linux operating system.
/// ///
/// This does not include test compiled to JavaScript running in a browser on /// This does not include tests compiled to JavaScript running in a browser on
/// the Linux operating system. /// the Linux operating system.
///
/// See also:
///
/// * [isBrowser], which reports true for tests running in browsers.
bool get isLinux { bool get isLinux {
if (_kIsCompiledToJavaScript) { if (isBrowser) {
return false; return false;
} }
return Platform.isLinux; return Platform.isLinux;
} }
/// Whether the test is running in a web browser compiled to JavaScript.
bool get isBrowser {
return _kIsCompiledToJavaScript;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment