semantics_5_test.dart 1.18 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
    SemanticsTester semantics = new SemanticsTester(tester);
Hixie's avatar
Hixie committed
14

15
    await tester.pumpWidget(
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
      new Stack(
        children: <Widget>[
          new Semantics(
            // this tests that empty nodes disappear
          ),
          new Semantics(
            // this tests whether you can have a container with no other semantics
            container: true
          ),
          new Semantics(
            label: 'label' // (force a fork)
          ),
        ]
      )
    );
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

    expect(semantics, hasSemantics(
      new TestSemantics(
        id: 0,
        children: <TestSemantics>[
          new TestSemantics(
            id: 1,
          ),
          new TestSemantics(
            id: 2,
            label: 'label',
          ),
        ]
      )
    ));

    semantics.dispose();
Hixie's avatar
Hixie committed
48 49
  });
}