mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Channels don't preserve Map and List type arguments: Map<String, Object> arrives as Map<dynamic, dynamic> to the receiver. In Dart 2 type system dynamic no longer serves as bottom type so Map<dynamic, dynamic> can't be assign to a variable of type Map<String, dynamic>. Issue #14556
29 lines
1.1 KiB
Dart
29 lines
1.1 KiB
Dart
// Copyright 2017 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 'dart:ui' show TextDirection;
|
|
|
|
import 'package:flutter/semantics.dart';
|
|
import 'package:flutter/services.dart' show SystemChannels;
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('Semantic announcement', () async {
|
|
final List<Map<dynamic, dynamic>> log = <Map<dynamic, dynamic>>[];
|
|
|
|
SystemChannels.accessibility.setMockMessageHandler((Object mockMessage) async {
|
|
final Map<dynamic, dynamic> message = mockMessage;
|
|
log.add(message);
|
|
});
|
|
|
|
await SemanticsService.announce('announcement 1', TextDirection.ltr);
|
|
await SemanticsService.announce('announcement 2', TextDirection.rtl);
|
|
|
|
expect(log, equals(<Map<String, dynamic>>[
|
|
<String, dynamic> {'type': 'announce', 'data': <String, dynamic> {'message': 'announcement 1', 'textDirection': 1}},
|
|
<String, dynamic> {'type': 'announce', 'data': <String, dynamic> {'message': 'announcement 2', 'textDirection': 0}},
|
|
]));
|
|
});
|
|
}
|