Set text direction in semantics along with Directionality (#16907)

* Set text direction in semantics along with Directionality

* update tests for the extra SemanticsNode
diff --git a/packages/flutter/lib/src/widgets/localizations.dart b/packages/flutter/lib/src/widgets/localizations.dart
index d50b522..92768b0 100644
--- a/packages/flutter/lib/src/widgets/localizations.dart
+++ b/packages/flutter/lib/src/widgets/localizations.dart
@@ -544,14 +544,17 @@
   Widget build(BuildContext context) {
     if (_locale == null)
       return new Container();
-    return new _LocalizationsScope(
-      key: _localizedResourcesScopeKey,
-      locale: _locale,
-      localizationsState: this,
-      typeToResources: _typeToResources,
-      child: new Directionality(
-        textDirection: _textDirection,
-        child: widget.child,
+    return new Semantics(
+      textDirection: _textDirection,
+      child: new _LocalizationsScope(
+        key: _localizedResourcesScopeKey,
+        locale: _locale,
+        localizationsState: this,
+        typeToResources: _typeToResources,
+        child: new Directionality(
+          textDirection: _textDirection,
+          child: widget.child,
+        ),
       ),
     );
   }
diff --git a/packages/flutter/test/material/app_bar_test.dart b/packages/flutter/test/material/app_bar_test.dart
index 2a3e6b6..c7aa4da 100644
--- a/packages/flutter/test/material/app_bar_test.dart
+++ b/packages/flutter/test/material/app_bar_test.dart
@@ -1216,34 +1216,38 @@
       new TestSemantics.root(
         children: <TestSemantics>[
           new TestSemantics(
-            flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
             children: <TestSemantics>[
               new TestSemantics(
+                flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
                 children: <TestSemantics>[
                   new TestSemantics(
-                    label: 'Leading',
-                    textDirection: TextDirection.ltr,
-                  ),
-                  new TestSemantics(
-                    flags: <SemanticsFlag>[SemanticsFlag.namesRoute],
-                    label: 'Title',
-                    textDirection: TextDirection.ltr,
-                  ),
-                  new TestSemantics(
-                    label: 'Action 1',
-                    textDirection: TextDirection.ltr,
-                  ),
-                  new TestSemantics(
-                    label: 'Action 2',
-                    textDirection: TextDirection.ltr,
-                  ),
-                  new TestSemantics(
-                    label: 'Action 3',
-                    textDirection: TextDirection.ltr,
-                  ),
-                  new TestSemantics(
-                    label: 'Bottom',
-                    textDirection: TextDirection.ltr,
+                    children: <TestSemantics>[
+                      new TestSemantics(
+                        label: 'Leading',
+                        textDirection: TextDirection.ltr,
+                      ),
+                      new TestSemantics(
+                        flags: <SemanticsFlag>[SemanticsFlag.namesRoute],
+                        label: 'Title',
+                        textDirection: TextDirection.ltr,
+                      ),
+                      new TestSemantics(
+                        label: 'Action 1',
+                        textDirection: TextDirection.ltr,
+                      ),
+                      new TestSemantics(
+                        label: 'Action 2',
+                        textDirection: TextDirection.ltr,
+                      ),
+                      new TestSemantics(
+                        label: 'Action 3',
+                        textDirection: TextDirection.ltr,
+                      ),
+                      new TestSemantics(
+                        label: 'Bottom',
+                        textDirection: TextDirection.ltr,
+                      ),
+                    ],
                   ),
                 ],
               ),
@@ -1292,37 +1296,41 @@
       new TestSemantics.root(
         children: <TestSemantics>[
           new TestSemantics(
-            flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
             children: <TestSemantics>[
               new TestSemantics(
-                textDirection: TextDirection.rtl,
+                flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
                 children: <TestSemantics>[
                   new TestSemantics(
+                    textDirection: TextDirection.rtl,
                     children: <TestSemantics>[
                       new TestSemantics(
-                        label: 'Leading',
-                        textDirection: TextDirection.rtl,
-                      ),
-                      new TestSemantics(
-                        flags: <SemanticsFlag>[SemanticsFlag.namesRoute],
-                        label: 'Title',
-                        textDirection: TextDirection.rtl,
-                      ),
-                      new TestSemantics(
-                        label: 'Action 1',
-                        textDirection: TextDirection.rtl,
-                      ),
-                      new TestSemantics(
-                        label: 'Action 2',
-                        textDirection: TextDirection.rtl,
-                      ),
-                      new TestSemantics(
-                        label: 'Action 3',
-                        textDirection: TextDirection.rtl,
-                      ),
-                      new TestSemantics(
-                        label: 'Bottom',
-                        textDirection: TextDirection.rtl,
+                        children: <TestSemantics>[
+                          new TestSemantics(
+                            label: 'Leading',
+                            textDirection: TextDirection.rtl,
+                          ),
+                          new TestSemantics(
+                            flags: <SemanticsFlag>[SemanticsFlag.namesRoute],
+                            label: 'Title',
+                            textDirection: TextDirection.rtl,
+                          ),
+                          new TestSemantics(
+                            label: 'Action 1',
+                            textDirection: TextDirection.rtl,
+                          ),
+                          new TestSemantics(
+                            label: 'Action 2',
+                            textDirection: TextDirection.rtl,
+                          ),
+                          new TestSemantics(
+                            label: 'Action 3',
+                            textDirection: TextDirection.rtl,
+                          ),
+                          new TestSemantics(
+                            label: 'Bottom',
+                            textDirection: TextDirection.rtl,
+                          ),
+                        ],
                       ),
                     ],
                   ),
diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart
index 0a171ad..20cf54c1 100644
--- a/packages/flutter/test/material/bottom_navigation_bar_test.dart
+++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart
@@ -519,22 +519,27 @@
           children: <TestSemantics>[
             new TestSemantics(
               id: 2,
-              flags: <SemanticsFlag>[SemanticsFlag.isSelected],
-              actions: <SemanticsAction>[SemanticsAction.tap],
-              label: 'AC\nTab 1 of 3',
-              textDirection: TextDirection.ltr,
-            ),
-            new TestSemantics(
-              id: 3,
-              actions: <SemanticsAction>[SemanticsAction.tap],
-              label: 'Alarm\nTab 2 of 3',
-              textDirection: TextDirection.ltr,
-            ),
-            new TestSemantics(
-              id: 4,
-              actions: <SemanticsAction>[SemanticsAction.tap],
-              label: 'Hot Tub\nTab 3 of 3',
-              textDirection: TextDirection.ltr,
+              children: <TestSemantics>[
+                new TestSemantics(
+                  id: 3,
+                  flags: <SemanticsFlag>[SemanticsFlag.isSelected],
+                  actions: <SemanticsAction>[SemanticsAction.tap],
+                  label: 'AC\nTab 1 of 3',
+                  textDirection: TextDirection.ltr,
+                ),
+                new TestSemantics(
+                  id: 4,
+                  actions: <SemanticsAction>[SemanticsAction.tap],
+                  label: 'Alarm\nTab 2 of 3',
+                  textDirection: TextDirection.ltr,
+                ),
+                new TestSemantics(
+                  id: 5,
+                  actions: <SemanticsAction>[SemanticsAction.tap],
+                  label: 'Hot Tub\nTab 3 of 3',
+                  textDirection: TextDirection.ltr,
+                ),
+              ],
             ),
           ],
         ),
diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart
index 0aebafa..871a4b7 100644
--- a/packages/flutter/test/material/date_picker_test.dart
+++ b/packages/flutter/test/material/date_picker_test.dart
@@ -609,7 +609,11 @@
       );
 
       expect(semantics, hasSemantics(
-        new TestSemantics.root(children: <TestSemantics>[expected]),
+        new TestSemantics.root(children: <TestSemantics>[
+          new TestSemantics(
+            children: <TestSemantics>[expected],
+          ),
+        ]),
         ignoreId: true,
         ignoreTransform: true,
         ignoreRect: true,
diff --git a/packages/flutter/test/material/floating_action_button_test.dart b/packages/flutter/test/material/floating_action_button_test.dart
index d51810a..85621f8 100644
--- a/packages/flutter/test/material/floating_action_button_test.dart
+++ b/packages/flutter/test/material/floating_action_button_test.dart
@@ -281,19 +281,23 @@
     expect(semantics, hasSemantics(new TestSemantics.root(
       children: <TestSemantics>[
         new TestSemantics.rootChild(
-          flags: <SemanticsFlag>[
-            SemanticsFlag.scopesRoute,
-          ],
           children: <TestSemantics>[
             new TestSemantics(
-              label: 'Add Photo',
-              actions: <SemanticsAction>[
-                SemanticsAction.tap
-              ],
               flags: <SemanticsFlag>[
-                SemanticsFlag.isButton,
-                SemanticsFlag.hasEnabledState,
-                SemanticsFlag.isEnabled,
+                SemanticsFlag.scopesRoute,
+              ],
+              children: <TestSemantics>[
+                new TestSemantics(
+                  label: 'Add Photo',
+                  actions: <SemanticsAction>[
+                    SemanticsAction.tap
+                  ],
+                  flags: <SemanticsFlag>[
+                    SemanticsFlag.isButton,
+                    SemanticsFlag.hasEnabledState,
+                    SemanticsFlag.isEnabled,
+                  ],
+                ),
               ],
             ),
           ],
diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart
index 96624fa..918376a 100644
--- a/packages/flutter/test/material/tabs_test.dart
+++ b/packages/flutter/test/material/tabs_test.dart
@@ -1360,22 +1360,28 @@
               rect: TestSemantics.fullScreen,
               children: <TestSemantics>[
                 new TestSemantics(
-                  id: 3,
-                  actions: SemanticsAction.tap.index,
-                  flags: SemanticsFlag.isSelected.index,
-                  label: 'TAB #0\nTab 1 of 2',
-                  rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
-                  transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
-                ),
-                new TestSemantics(
-                  id: 4,
-                  actions: SemanticsAction.tap.index,
-                  label: 'TAB #1\nTab 2 of 2',
-                  rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
-                  transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
-                ),
-              ]
-            )
+                    id: 3,
+                    rect: TestSemantics.fullScreen,
+                    children: <TestSemantics>[
+                      new TestSemantics(
+                        id: 4,
+                        actions: SemanticsAction.tap.index,
+                        flags: SemanticsFlag.isSelected.index,
+                        label: 'TAB #0\nTab 1 of 2',
+                        rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
+                        transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
+                      ),
+                      new TestSemantics(
+                        id: 5,
+                        actions: SemanticsAction.tap.index,
+                        label: 'TAB #1\nTab 2 of 2',
+                        rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
+                        transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
+                      ),
+                    ]
+                )
+              ],
+            ),
           ],
         ),
       ],
@@ -1617,22 +1623,28 @@
               rect: TestSemantics.fullScreen,
               children: <TestSemantics>[
                 new TestSemantics(
-                  id: 3,
-                  actions: SemanticsAction.tap.index,
-                  flags: SemanticsFlag.isSelected.index,
-                  label: 'Semantics override 0\nTab 1 of 2',
-                  rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
-                  transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
-                ),
-                new TestSemantics(
-                  id: 4,
-                  actions: SemanticsAction.tap.index,
-                  label: 'Semantics override 1\nTab 2 of 2',
-                  rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
-                  transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
-                ),
-              ]
-            )
+                    id: 3,
+                    rect: TestSemantics.fullScreen,
+                    children: <TestSemantics>[
+                      new TestSemantics(
+                        id: 4,
+                        actions: SemanticsAction.tap.index,
+                        flags: SemanticsFlag.isSelected.index,
+                        label: 'Semantics override 0\nTab 1 of 2',
+                        rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
+                        transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
+                      ),
+                      new TestSemantics(
+                        id: 5,
+                        actions: SemanticsAction.tap.index,
+                        label: 'Semantics override 1\nTab 2 of 2',
+                        rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
+                        transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
+                      ),
+                    ]
+                )
+              ],
+            ),
           ],
         ),
       ],
diff --git a/packages/flutter/test/material/tooltip_test.dart b/packages/flutter/test/material/tooltip_test.dart
index 064e0f9..2cf59b6 100644
--- a/packages/flutter/test/material/tooltip_test.dart
+++ b/packages/flutter/test/material/tooltip_test.dart
@@ -622,12 +622,16 @@
     expect(semantics, hasSemantics(new TestSemantics.root(
       children: <TestSemantics>[
         new TestSemantics.rootChild(
-          flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
           children: <TestSemantics>[
             new TestSemantics(
-              label: 'Foo\nBar',
-              textDirection: TextDirection.ltr,
-            )
+              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+              children: <TestSemantics>[
+                new TestSemantics(
+                  label: 'Foo\nBar',
+                  textDirection: TextDirection.ltr,
+                )
+              ],
+            ),
           ],
         ),
       ],
@@ -654,12 +658,16 @@
     expect(semantics, hasSemantics(new TestSemantics.root(
       children: <TestSemantics>[
         new TestSemantics.rootChild(
-          flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
           children: <TestSemantics>[
             new TestSemantics(
-              label: 'Bar',
-              textDirection: TextDirection.ltr,
-            )
+              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+              children: <TestSemantics>[
+                new TestSemantics(
+                  label: 'Bar',
+                  textDirection: TextDirection.ltr,
+                )
+              ],
+            ),
           ],
         ),
       ],
diff --git a/packages/flutter/test/material/user_accounts_drawer_header_test.dart b/packages/flutter/test/material/user_accounts_drawer_header_test.dart
index 5441b24..2edbb29 100644
--- a/packages/flutter/test/material/user_accounts_drawer_header_test.dart
+++ b/packages/flutter/test/material/user_accounts_drawer_header_test.dart
@@ -333,29 +333,33 @@
         new TestSemantics(
           children: <TestSemantics>[
             new TestSemantics(
-              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
               children: <TestSemantics>[
                 new TestSemantics(
-                  label: 'Signed in\nname\nemail',
-                  textDirection: TextDirection.ltr,
+                  flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
                   children: <TestSemantics>[
                     new TestSemantics(
-                      label: r'B',
+                      label: 'Signed in\nname\nemail',
                       textDirection: TextDirection.ltr,
-                    ),
-                    new TestSemantics(
-                      label: r'C',
-                      textDirection: TextDirection.ltr,
-                    ),
-                    new TestSemantics(
-                      label: r'D',
-                      textDirection: TextDirection.ltr,
-                    ),
-                    new TestSemantics(
-                      flags: <SemanticsFlag>[SemanticsFlag.isButton],
-                      actions: <SemanticsAction>[SemanticsAction.tap],
-                      label: r'Show accounts',
-                      textDirection: TextDirection.ltr,
+                      children: <TestSemantics>[
+                        new TestSemantics(
+                          label: r'B',
+                          textDirection: TextDirection.ltr,
+                        ),
+                        new TestSemantics(
+                          label: r'C',
+                          textDirection: TextDirection.ltr,
+                        ),
+                        new TestSemantics(
+                          label: r'D',
+                          textDirection: TextDirection.ltr,
+                        ),
+                        new TestSemantics(
+                          flags: <SemanticsFlag>[SemanticsFlag.isButton],
+                          actions: <SemanticsAction>[SemanticsAction.tap],
+                          label: r'Show accounts',
+                          textDirection: TextDirection.ltr,
+                        ),
+                      ],
                     ),
                   ],
                 ),
@@ -385,23 +389,27 @@
         new TestSemantics(
           children: <TestSemantics>[
             new TestSemantics(
-              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
               children: <TestSemantics>[
                 new TestSemantics(
-                  label: 'Signed in',
-                  textDirection: TextDirection.ltr,
+                  flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
                   children: <TestSemantics>[
                     new TestSemantics(
-                      label: r'B',
+                      label: 'Signed in',
                       textDirection: TextDirection.ltr,
-                    ),
-                    new TestSemantics(
-                      label: r'C',
-                      textDirection: TextDirection.ltr,
-                    ),
-                    new TestSemantics(
-                      label: r'D',
-                      textDirection: TextDirection.ltr,
+                      children: <TestSemantics>[
+                        new TestSemantics(
+                          label: r'B',
+                          textDirection: TextDirection.ltr,
+                        ),
+                        new TestSemantics(
+                          label: r'C',
+                          textDirection: TextDirection.ltr,
+                        ),
+                        new TestSemantics(
+                          label: r'D',
+                          textDirection: TextDirection.ltr,
+                        ),
+                      ],
                     ),
                   ],
                 ),
diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart
index b329e2b..75a7e2c 100644
--- a/packages/flutter/test/widgets/editable_text_test.dart
+++ b/packages/flutter/test/widgets/editable_text_test.dart
@@ -592,12 +592,16 @@
     expect(semantics, hasSemantics(new TestSemantics(
       children: <TestSemantics>[
         new TestSemantics.rootChild(
-          flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
-          children:  <TestSemantics>[
+          children: <TestSemantics>[
             new TestSemantics(
-              flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isObscured],
-              value: expectedValue,
-              textDirection: TextDirection.ltr,
+              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+              children:  <TestSemantics>[
+                new TestSemantics(
+                  flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isObscured],
+                  value: expectedValue,
+                  textDirection: TextDirection.ltr,
+                ),
+              ],
             ),
           ],
         ),
@@ -714,30 +718,35 @@
       await tester.pump();
 
       final SemanticsOwner owner = tester.binding.pipelineOwner.semanticsOwner;
-      const int expectedNodeId = 3;
+      const int expectedNodeId = 4;
 
       expect(semantics, hasSemantics(new TestSemantics.root(
         children: <TestSemantics>[
           new TestSemantics.rootChild(
             id: 1,
-            flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
             children: <TestSemantics>[
-              new TestSemantics.rootChild(
-                id: expectedNodeId,
-                flags: <SemanticsFlag>[
-                  SemanticsFlag.isTextField,
-                  SemanticsFlag.isFocused
+              new TestSemantics(
+                id: 2,
+                flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+                children: <TestSemantics>[
+                  new TestSemantics.rootChild(
+                    id: expectedNodeId,
+                    flags: <SemanticsFlag>[
+                      SemanticsFlag.isTextField,
+                      SemanticsFlag.isFocused
+                    ],
+                    actions: <SemanticsAction>[
+                      SemanticsAction.moveCursorBackwardByCharacter,
+                      SemanticsAction.setSelection,
+                      SemanticsAction.copy,
+                      SemanticsAction.cut,
+                      SemanticsAction.paste
+                    ],
+                    value: 'test',
+                    textSelection: new TextSelection.collapsed(offset: controller.text.length),
+                    textDirection: TextDirection.ltr,
+                  ),
                 ],
-                actions: <SemanticsAction>[
-                  SemanticsAction.moveCursorBackwardByCharacter,
-                  SemanticsAction.setSelection,
-                  SemanticsAction.copy,
-                  SemanticsAction.cut,
-                  SemanticsAction.paste
-                ],
-                value: 'test',
-                textSelection: new TextSelection.collapsed(offset: controller.text.length),
-                textDirection: TextDirection.ltr,
               ),
             ],
           ),
diff --git a/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart b/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
index 276f97e..0cffd37 100644
--- a/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
+++ b/packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
@@ -105,31 +105,37 @@
           children: <TestSemantics>[
             new TestSemantics(
               id: 1,
-              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+              textDirection: TextDirection.ltr,
               children: <TestSemantics>[
                 new TestSemantics(
                   id: 2,
+                  flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
                   children: <TestSemantics>[
                     new TestSemantics(
-                      id: 5,
+                      id: 3,
                       children: <TestSemantics>[
                         new TestSemantics(
-                          id: 3,
-                          tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
-                          label: 'Plain text',
-                          textDirection: TextDirection.ltr,
-                        ),
-                        new TestSemantics(
-                          id: 4,
-                          tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
-                          flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.isSelected],
-                          actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease],
-                          label: '‪Interactive text‬',
-                          value: 'test-value',
-                          increasedValue: 'test-increasedValue',
-                          decreasedValue: 'test-decreasedValue',
-                          hint: 'test-hint',
-                          textDirection: TextDirection.rtl,
+                          id: 6,
+                          children: <TestSemantics>[
+                            new TestSemantics(
+                              id: 4,
+                              tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
+                              label: 'Plain text',
+                              textDirection: TextDirection.ltr,
+                            ),
+                            new TestSemantics(
+                              id: 5,
+                              tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
+                              flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.isSelected],
+                              actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease],
+                              label: '‪Interactive text‬',
+                              value: 'test-value',
+                              increasedValue: 'test-increasedValue',
+                              decreasedValue: 'test-decreasedValue',
+                              hint: 'test-hint',
+                              textDirection: TextDirection.rtl,
+                            ),
+                          ],
                         ),
                       ],
                     ),
diff --git a/packages/flutter/test/widgets/simple_semantics_test.dart b/packages/flutter/test/widgets/simple_semantics_test.dart
index 92398d4..8e1c2df 100644
--- a/packages/flutter/test/widgets/simple_semantics_test.dart
+++ b/packages/flutter/test/widgets/simple_semantics_test.dart
@@ -55,17 +55,23 @@
     expect(semantics, hasSemantics(new TestSemantics.root(
       children: <TestSemantics>[
         new TestSemantics.rootChild(
-          rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
           id: 2,
-          flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+          rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
           children: <TestSemantics>[
             new TestSemantics(
               id: 3,
-              label: 'Hello!',
-              textDirection: TextDirection.ltr,
-              rect: new Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
-              transform: new Matrix4.translationValues(395.0, 295.0, 0.0),
-            )
+              rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 600.0),
+              flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
+              children: <TestSemantics>[
+                new TestSemantics(
+                  id: 4,
+                  label: 'Hello!',
+                  textDirection: TextDirection.ltr,
+                  rect: new Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
+                  transform: new Matrix4.translationValues(395.0, 295.0, 0.0),
+                )
+              ],
+            ),
           ],
         ),
       ],