"Fossies" - the Fresh Open Source Software Archive 
Member "flutter-3.7.1/packages/flutter/test/widgets/absorb_pointer_test.dart" (1 Feb 2023, 1771 Bytes) of package /linux/misc/flutter-3.7.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 // Copyright 2014 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 import 'package:flutter/widgets.dart';
6 import 'package:flutter_test/flutter_test.dart';
7
8 import 'semantics_tester.dart';
9
10 void main() {
11 testWidgets('AbsorbPointers do not block siblings', (WidgetTester tester) async {
12 bool tapped = false;
13 await tester.pumpWidget(
14 Column(
15 children: <Widget>[
16 Expanded(
17 child: GestureDetector(
18 onTap: () => tapped = true,
19 ),
20 ),
21 const Expanded(
22 child: AbsorbPointer(),
23 ),
24 ],
25 ),
26 );
27 await tester.tap(find.byType(GestureDetector));
28 expect(tapped, true);
29 });
30
31 testWidgets('AbsorbPointers semantics', (WidgetTester tester) async {
32 final SemanticsTester semantics = SemanticsTester(tester);
33 await tester.pumpWidget(
34 AbsorbPointer(
35 child: Semantics(
36 label: 'test',
37 textDirection: TextDirection.ltr,
38 ),
39 ),
40 );
41 expect(semantics, hasSemantics(TestSemantics.root(), ignoreId: true, ignoreRect: true, ignoreTransform: true));
42
43 await tester.pumpWidget(
44 AbsorbPointer(
45 absorbing: false,
46 child: Semantics(
47 label: 'test',
48 textDirection: TextDirection.ltr,
49 ),
50 ),
51 );
52
53 expect(semantics, hasSemantics(
54 TestSemantics.root(
55 children: <TestSemantics>[
56 TestSemantics.rootChild(
57 label: 'test',
58 textDirection: TextDirection.ltr,
59 ),
60 ],
61 ),
62 ignoreId: true,
63 ignoreRect: true,
64 ignoreTransform: true,
65 ));
66 semantics.dispose();
67 });
68 }