mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-15 03:04:25 +08:00
Add:创建 flutter go web 版
This commit is contained in:
78
packages/flutter_web/test/widgets/semantics_8_test.dart
Normal file
78
packages/flutter_web/test/widgets/semantics_8_test.dart
Normal file
@ -0,0 +1,78 @@
|
||||
// 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_web/material.dart';
|
||||
import 'package:flutter_web/widgets.dart';
|
||||
import 'package:flutter_web_test/flutter_web_test.dart';
|
||||
|
||||
import 'semantics_tester.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Semantics 8 - Merging with reset', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
await tester.pumpWidget(MergeSemantics(
|
||||
child: Semantics(
|
||||
container: true,
|
||||
child: Semantics(
|
||||
container: true,
|
||||
child:
|
||||
Stack(textDirection: TextDirection.ltr, children: <Widget>[
|
||||
Semantics(
|
||||
checked: true,
|
||||
),
|
||||
Semantics(
|
||||
label: 'label',
|
||||
textDirection: TextDirection.ltr,
|
||||
)
|
||||
])))));
|
||||
|
||||
expect(
|
||||
semantics,
|
||||
hasSemantics(TestSemantics.root(children: <TestSemantics>[
|
||||
TestSemantics.rootChild(
|
||||
id: 1,
|
||||
flags: SemanticsFlag.hasCheckedState.index |
|
||||
SemanticsFlag.isChecked.index,
|
||||
label: 'label',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: TestSemantics.fullScreen,
|
||||
)
|
||||
])));
|
||||
|
||||
// switch the order of the inner Semantics node to trigger a reset
|
||||
await tester.pumpWidget(MergeSemantics(
|
||||
child: Semantics(
|
||||
container: true,
|
||||
child: Semantics(
|
||||
container: true,
|
||||
child:
|
||||
Stack(textDirection: TextDirection.ltr, children: <Widget>[
|
||||
Semantics(
|
||||
label: 'label',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
Semantics(checked: true)
|
||||
])))));
|
||||
|
||||
expect(
|
||||
semantics,
|
||||
hasSemantics(
|
||||
TestSemantics.root(
|
||||
children: <TestSemantics>[
|
||||
TestSemantics.rootChild(
|
||||
id: 1,
|
||||
flags: SemanticsFlag.hasCheckedState.index |
|
||||
SemanticsFlag.isChecked.index,
|
||||
label: 'label',
|
||||
textDirection: TextDirection.ltr,
|
||||
rect: TestSemantics.fullScreen,
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user