Updated tests (#67083)

This commit is contained in:
Yash Johri 2020-10-15 03:52:04 +05:30 committed by GitHub
parent 83e99f75c6
commit 0a130100ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 24 deletions

View file

@ -3201,7 +3201,7 @@ void main() {
controller: textController,
decoration: null,
inputFormatters: <TextInputFormatter> [
BlacklistingTextInputFormatter(
FilteringTextInputFormatter.deny(
RegExp(r'[a-z]'),
replacementString: '#',
),
@ -3250,11 +3250,11 @@ void main() {
decoration: null,
maxLines: 2,
inputFormatters: <TextInputFormatter> [
BlacklistingTextInputFormatter(
FilteringTextInputFormatter.deny(
RegExp(r'[a-z]'),
replacementString: '12\n',
),
WhitelistingTextInputFormatter(RegExp(r'\n[0-9]')),
FilteringTextInputFormatter.allow(RegExp(r'\n[0-9]')),
],
),
));
@ -3315,7 +3315,7 @@ void main() {
controller: textController,
decoration: null,
inputFormatters: <TextInputFormatter> [
WhitelistingTextInputFormatter.digitsOnly,
FilteringTextInputFormatter.digitsOnly,
],
),
),
@ -3635,7 +3635,7 @@ void main() {
controller: textController,
maxLength: 10,
inputFormatters: <TextInputFormatter> [
BlacklistingTextInputFormatter(
FilteringTextInputFormatter.deny(
RegExp(r'[a-z]'),
replacementString: '#',
),

View file

@ -153,7 +153,7 @@ void main() {
});
test('cursorColor', () {
expect(ThemeData(cursorColor: Colors.red).cursorColor, Colors.red);
expect(const TextSelectionThemeData(cursorColor: Colors.red).cursorColor, Colors.red);
});
testWidgets('ThemeData.from a light color scheme sets appropriate values', (WidgetTester tester) async {
@ -430,9 +430,9 @@ void main() {
toggleButtonsTheme: otherTheme.toggleButtonsTheme,
buttonColor: otherTheme.buttonColor,
secondaryHeaderColor: otherTheme.secondaryHeaderColor,
textSelectionColor: otherTheme.textSelectionColor,
cursorColor: otherTheme.cursorColor,
textSelectionHandleColor: otherTheme.textSelectionHandleColor,
textSelectionColor: otherTheme.textSelectionTheme.selectionColor,
cursorColor: otherTheme.textSelectionTheme.cursorColor,
textSelectionHandleColor: otherTheme.textSelectionTheme.selectionHandleColor,
backgroundColor: otherTheme.backgroundColor,
dialogBackgroundColor: otherTheme.dialogBackgroundColor,
indicatorColor: otherTheme.indicatorColor,
@ -476,7 +476,6 @@ void main() {
outlinedButtonTheme: otherTheme.outlinedButtonTheme,
textSelectionTheme: otherTheme.textSelectionTheme,
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
useTextSelectionTheme: otherTheme.useTextSelectionTheme,
);
expect(themeDataCopy.brightness, equals(otherTheme.brightness));
@ -505,11 +504,11 @@ void main() {
expect(themeDataCopy.toggleButtonsTheme, equals(otherTheme.toggleButtonsTheme));
expect(themeDataCopy.buttonColor, equals(otherTheme.buttonColor));
expect(themeDataCopy.secondaryHeaderColor, equals(otherTheme.secondaryHeaderColor));
expect(themeDataCopy.textSelectionColor, equals(otherTheme.textSelectionColor));
expect(themeDataCopy.cursorColor, equals(otherTheme.cursorColor));
expect(themeDataCopy.textSelectionColor, equals(otherTheme.textSelectionColor));
expect(themeDataCopy.cursorColor, equals(otherTheme.cursorColor));
expect(themeDataCopy.textSelectionHandleColor, equals(otherTheme.textSelectionHandleColor));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionColor, equals(otherTheme.textSelectionTheme.selectionColor));
expect(themeDataCopy.textSelectionTheme.cursorColor, equals(otherTheme.textSelectionTheme.cursorColor));
expect(themeDataCopy.textSelectionTheme.selectionHandleColor, equals(otherTheme.textSelectionTheme.selectionHandleColor));
expect(themeDataCopy.backgroundColor, equals(otherTheme.backgroundColor));
expect(themeDataCopy.dialogBackgroundColor, equals(otherTheme.dialogBackgroundColor));
expect(themeDataCopy.indicatorColor, equals(otherTheme.indicatorColor));
@ -549,7 +548,6 @@ void main() {
expect(themeDataCopy.outlinedButtonTheme, equals(otherTheme.outlinedButtonTheme));
expect(themeDataCopy.textSelectionTheme, equals(otherTheme.textSelectionTheme));
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
expect(themeDataCopy.useTextSelectionTheme, equals(otherTheme.useTextSelectionTheme));
});
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {

View file

@ -101,7 +101,7 @@ void main() {
test('test filtering formatter, deny mode (deprecated names)', () {
final TextEditingValue actualValue =
BlacklistingTextInputFormatter(RegExp(r'[a-z]'))
FilteringTextInputFormatter.deny(RegExp(r'[a-z]'))
.formatEditUpdate(testOldValue, testNewValue);
// Expecting
@ -134,7 +134,7 @@ void main() {
test('test single line formatter (deprecated names)', () {
final TextEditingValue actualValue =
BlacklistingTextInputFormatter.singleLineFormatter
FilteringTextInputFormatter.singleLineFormatter
.formatEditUpdate(testOldValue, testNewValue);
// Expecting
@ -166,7 +166,7 @@ void main() {
test('test filtering formatter, allow mode (deprecated names)', () {
final TextEditingValue actualValue =
WhitelistingTextInputFormatter(RegExp(r'[a-c]'))
FilteringTextInputFormatter.allow(RegExp(r'[a-c]'))
.formatEditUpdate(testOldValue, testNewValue);
// Expecting
@ -198,7 +198,7 @@ void main() {
test('test digits only formatter (deprecated names)', () {
final TextEditingValue actualValue =
WhitelistingTextInputFormatter.digitsOnly
FilteringTextInputFormatter.digitsOnly
.formatEditUpdate(testOldValue, testNewValue);
// Expecting
@ -528,7 +528,7 @@ void main() {
const TextEditingValue oldValue = TextEditingValue(text: '12345');
const TextEditingValue newValue = TextEditingValue(text: '12345@');
final WhitelistingTextInputFormatter formatter = WhitelistingTextInputFormatter.digitsOnly;
final TextInputFormatter formatter = FilteringTextInputFormatter.digitsOnly;
final TextEditingValue formatted = formatter.formatEditUpdate(oldValue, newValue);
// assert that we are passing digits only at the first time
@ -583,8 +583,8 @@ void main() {
TextEditingValue oldValue = collapsedValue('123', 0);
TextEditingValue newValue = collapsedValue('123456', 6);
final WhitelistingTextInputFormatter formatter =
WhitelistingTextInputFormatter.digitsOnly;
final TextInputFormatter formatter =
FilteringTextInputFormatter.digitsOnly;
TextEditingValue formatted = formatter.formatEditUpdate(oldValue,
newValue);

View file

@ -453,7 +453,6 @@ void main() {
textDirection: TextDirection.ltr,
child: Center(
child: Stack(
overflow: Overflow.visible,
clipBehavior: Clip.none,
children: const <Widget>[
SizedBox(