Unverified Commit 0d0b2dba authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Replace text directionality control characters with escape sequences in the...

Replace text directionality control characters with escape sequences in the semantics_tester (#93034)
parent 77378934
......@@ -635,12 +635,9 @@ class SemanticsTester {
if (nodeData.actions != 0)
buf.writeln(' actions: ${_actionsToSemanticsActionExpression(nodeData.actions)},');
if (node.label != null && node.label.isNotEmpty) {
final String escapedLabel = node.label.replaceAll('\n', r'\n');
if (escapedLabel != node.label) {
buf.writeln(" label: r'$escapedLabel',");
} else {
buf.writeln(" label: '$escapedLabel',");
}
// Escape newlines and text directionality control characters.
final String escapedLabel = node.label.replaceAll('\n', r'\n').replaceAll('\u202a', r'\u202a').replaceAll('\u202c', r'\u202c');
buf.writeln(" label: '$escapedLabel',");
}
if (node.value != null && node.value.isNotEmpty)
buf.writeln(" value: '${node.value}',");
......
......@@ -132,7 +132,7 @@ void _tests() {
tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.isSelected],
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease],
label: '‪Interactive text‬',
label: '\u202aInteractive text\u202c',
value: 'test-value',
increasedValue: 'test-increasedValue',
decreasedValue: 'test-decreasedValue',
......
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