flutter_flutter/packages/flutter/test/services/spell_check_test.dart
Justin McCandless ed47c4bb1f
Spell check range error (#153055)
Fixed a bug in spell checkers, especially custom ones, where deleting characters rapidly threw an error.
2024-08-09 13:52:06 -07:00

35 lines
1.1 KiB
Dart

// Copyright 2014 The Flutter 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/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test('SuggestionSpan.toString', () {
const SuggestionSpan suggestionSpan = SuggestionSpan(
TextRange(start: 12, end: 17),
<String>[
'weird',
],
);
expect(suggestionSpan.toString(), 'SuggestionSpan(range: TextRange(start: 12, end: 17), suggestions: [weird])');
});
test('SpellCheckResults.toString', () {
const SuggestionSpan suggestionSpan = SuggestionSpan(
TextRange(start: 12, end: 17),
<String>[
'weird',
],
);
const SpellCheckResults spellCheckResults = SpellCheckResults(
'i before e except after c is so wierd.',
<SuggestionSpan>[suggestionSpan],
);
expect(spellCheckResults.toString(), 'SpellCheckResults(spellCheckText: i before e except after c is so wierd., suggestionSpans: [SuggestionSpan(range: TextRange(start: 12, end: 17), suggestions: [weird])])');
});
}