Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5a2456

Browse files
committed
test: Fix test case
1 parent 6d4504f commit f5a2456

1 file changed

Lines changed: 9 additions & 105 deletions

File tree

engine/src/flutter/lib/web_ui/test/engine/text_editing_test.dart

Lines changed: 9 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,121 +1943,25 @@ Future<void> testMain() async {
19431943
hideKeyboard();
19441944
});
19451945

1946-
test('Supports composition changes with shift arrow selection in Japanese IME', () {
1947-
final DefaultTextEditingStrategy editingStrategy = DefaultTextEditingStrategy(textEditing);
1948-
1946+
test('Do not update composingBase and composingExtent while composing Text', () {
19491947
showKeyboard(inputType: 'text');
1950-
editingStrategy.composingText = 'へんかん';
1948+
// 'text' is input as a composing target
1949+
editingStrategy!.composingText = 'test';
19511950
sendFrameworkMessage(
19521951
codec.encodeMethodCall(
19531952
const MethodCall('TextInput.setEditingState', <String, dynamic>{
1954-
'text': 'へんかん',
1953+
'text': 'test',
19551954
'selectionBase': 4,
1956-
'selectionExtent': 4,
1957-
'composingBase': 0,
1958-
'composingExtent': 4,
1959-
}),
1960-
),
1961-
);
1962-
checkInputEditingState(textEditing!.strategy.domElement, 'へんかん', 4, 4);
1963-
1964-
// text composition is started
1965-
sendFrameworkMessage(
1966-
codec.encodeMethodCall(
1967-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
1968-
'text': '変換',
1969-
'selectionBase': 0,
1970-
'selectionExtent': 2,
1971-
'composingBase': 0,
1972-
'composingExtent': 2,
1973-
}),
1974-
),
1975-
);
1976-
checkInputEditingState(textEditing!.strategy.domElement, '変換', 0, 2);
1977-
1978-
// shift + ←
1979-
sendFrameworkMessage(
1980-
codec.encodeMethodCall(
1981-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
1982-
'text': '変化ん',
1983-
'selectionBase': 0,
1984-
'selectionExtent': 2,
1985-
'composingBase': -1,
1986-
'composingExtent': -1,
1987-
}),
1988-
),
1989-
);
1990-
checkInputEditingState(textEditing!.strategy.domElement, '変化ん', 0, 2);
1991-
1992-
// shift + ←
1993-
sendFrameworkMessage(
1994-
codec.encodeMethodCall(
1995-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
1996-
'text': '変かん',
1997-
'selectionBase': 0,
1998-
'selectionExtent': 1,
1999-
'composingBase': -1,
2000-
'composingExtent': -1,
2001-
}),
2002-
),
2003-
);
2004-
checkInputEditingState(textEditing!.strategy.domElement, '変かん', 0, 1);
2005-
2006-
// shift + ←
2007-
sendFrameworkMessage(
2008-
codec.encodeMethodCall(
2009-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
2010-
'text': 'へんかん',
2011-
'selectionBase': 0,
2012-
'selectionExtent': 1,
2013-
'composingBase': -1,
2014-
'composingExtent': -1,
1955+
'selectionExtent': 0,
20151956
}),
20161957
),
20171958
);
2018-
checkInputEditingState(textEditing!.strategy.domElement, 'へんかん', 0, 1);
20191959

2020-
// shift + →
2021-
sendFrameworkMessage(
2022-
codec.encodeMethodCall(
2023-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
2024-
'text': '変かん',
2025-
'selectionBase': 0,
2026-
'selectionExtent': 1,
2027-
'composingBase': -1,
2028-
'composingExtent': -1,
2029-
}),
2030-
),
2031-
);
2032-
checkInputEditingState(textEditing!.strategy.domElement, '変かん', 0, 1);
1960+
// 'text' is composed as Japanese, and baseOffset and extentOffset are updated
1961+
final EditingState editingState = EditingState(text: 'test', baseOffset: 0, extentOffset: 1);
1962+
editingStrategy!.setEditingState(editingState);
20331963

2034-
// shift + →
2035-
sendFrameworkMessage(
2036-
codec.encodeMethodCall(
2037-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
2038-
'text': '変化ん',
2039-
'selectionBase': 0,
2040-
'selectionExtent': 2,
2041-
'composingBase': -1,
2042-
'composingExtent': -1,
2043-
}),
2044-
),
2045-
);
2046-
checkInputEditingState(textEditing!.strategy.domElement, '変化ん', 0, 2);
2047-
2048-
// shift + →
2049-
sendFrameworkMessage(
2050-
codec.encodeMethodCall(
2051-
const MethodCall('TextInput.setEditingState', <String, dynamic>{
2052-
'text': '変換',
2053-
'selectionBase': 0,
2054-
'selectionExtent': 2,
2055-
'composingBase': 0,
2056-
'composingExtent': 2,
2057-
}),
2058-
),
2059-
);
2060-
checkInputEditingState(textEditing!.strategy.domElement, '変換', 0, 2);
1964+
checkInputEditingState(textEditing!.strategy.domElement, 'test', 0, 4);
20611965
});
20621966

20631967
test('Supports deletion at inverted selection', () async {

0 commit comments

Comments
 (0)