semantics_5_test.dart 1.4 KB
Newer Older
Hixie's avatar
Hixie committed
1 2 3 4 5 6 7 8
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';

9
import 'semantics_tester.dart';
Hixie's avatar
Hixie committed
10 11

void main() {
12
  testWidgets('Semantics 5', (WidgetTester tester) async {
13
    final SemanticsTester semantics = new SemanticsTester(tester);
Hixie's avatar
Hixie committed
14

15
    await tester.pumpWidget(
16
      new Stack(
17
        textDirection: TextDirection.ltr,
18
        fit: StackFit.expand,
19
        children: <Widget>[
20
          new Semantics(
21 22
            // this tests that empty nodes disappear
          ),
23
          new Semantics(
24
            // this tests whether you can have a container with no other semantics
25
            container: true,
26
          ),
27
          new Semantics(
28
            label: 'label', // (force a fork)
Ian Hickson's avatar
Ian Hickson committed
29
            textDirection: TextDirection.ltr,
30 31 32 33
          ),
        ]
      )
    );
34 35

    expect(semantics, hasSemantics(
36
      new TestSemantics.root(
37
        children: <TestSemantics>[
38
          new TestSemantics.rootChild(
39
            id: 1,
40
            rect: TestSemantics.fullScreen,
41
          ),
42
          new TestSemantics.rootChild(
43 44
            id: 2,
            label: 'label',
45
            rect: TestSemantics.fullScreen,
46 47 48 49 50 51
          ),
        ]
      )
    ));

    semantics.dispose();
Hixie's avatar
Hixie committed
52 53
  });
}