Unverified Commit 324e20de authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Update TextStyle.hashCode to handle list fields (#50520)

parent 48d5fcab
...@@ -1177,7 +1177,6 @@ class TextStyle extends Diagnosticable { ...@@ -1177,7 +1177,6 @@ class TextStyle extends Diagnosticable {
color, color,
backgroundColor, backgroundColor,
fontFamily, fontFamily,
fontFamilyFallback,
fontSize, fontSize,
fontWeight, fontWeight,
fontStyle, fontStyle,
...@@ -1191,8 +1190,9 @@ class TextStyle extends Diagnosticable { ...@@ -1191,8 +1190,9 @@ class TextStyle extends Diagnosticable {
decoration, decoration,
decorationColor, decorationColor,
decorationStyle, decorationStyle,
shadows, hashList(shadows),
fontFeatures, hashList(fontFeatures),
hashList(fontFamilyFallback),
); );
} }
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' as ui show TextStyle, ParagraphStyle; import 'dart:ui' as ui show TextStyle, ParagraphStyle, FontFeature, Shadow;
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import '../flutter_test_alternative.dart'; import '../flutter_test_alternative.dart';
...@@ -256,6 +257,13 @@ void main() { ...@@ -256,6 +257,13 @@ void main() {
expect(TextStyle.lerp(foo.merge(bar), baz, 0.51).copyWith().debugLabel, '(lerp((foo).merge(bar) ⎯0.5→ baz)).copyWith'); expect(TextStyle.lerp(foo.merge(bar), baz, 0.51).copyWith().debugLabel, '(lerp((foo).merge(bar) ⎯0.5→ baz)).copyWith');
}); });
test('TextStyle.hashCode', () {
const TextStyle a = TextStyle(fontFamilyFallback: <String>['Roboto'], shadows: <ui.Shadow>[ui.Shadow()], fontFeatures: <ui.FontFeature>[ui.FontFeature('abcd')]);
const TextStyle b = TextStyle(fontFamilyFallback: <String>['Noto'], shadows: <ui.Shadow>[ui.Shadow()], fontFeatures: <ui.FontFeature>[ui.FontFeature('abcd')]);
expect(a.hashCode, a.hashCode);
expect(a.hashCode, isNot(equals(b.hashCode)));
}, skip: kIsWeb);
test('TextStyle foreground and color combos', () { test('TextStyle foreground and color combos', () {
const Color red = Color.fromARGB(255, 255, 0, 0); const Color red = Color.fromARGB(255, 255, 0, 0);
const Color blue = Color.fromARGB(255, 0, 0, 255); const Color blue = Color.fromARGB(255, 0, 0, 255);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment