@@ -44,6 +44,7 @@ void main() {
44
44
decorationColor: Color (0xFF0000FF ),
45
45
decorationStyle: TextDecorationStyle .dashed,
46
46
decorationThickness: 1.5 ,
47
+ backgroundColor: Color (0xFFFF00FF ),
47
48
);
48
49
final textPaint = TextPaint (style: flutterStyle);
49
50
@@ -77,6 +78,7 @@ void main() {
77
78
expect (inlineTextStyle.decorationColor, const Color (0xFF0000FF ));
78
79
expect (inlineTextStyle.decorationStyle, TextDecorationStyle .dashed);
79
80
expect (inlineTextStyle.decorationThickness, 1.5 );
81
+ expect (inlineTextStyle.background! .color, const Color (0xFFFF00FF ));
80
82
81
83
final newTextPaint = inlineTextStyle.asTextRenderer ();
82
84
expect (newTextPaint.style.fontSize, 12 );
@@ -108,7 +110,33 @@ void main() {
108
110
expect (newTextPaint.style.decorationColor, const Color (0xFF0000FF ));
109
111
expect (newTextPaint.style.decorationStyle, TextDecorationStyle .dashed);
110
112
expect (newTextPaint.style.decorationThickness, 1.5 );
113
+ expect (newTextPaint.style.background! .color, const Color (0xFFFF00FF ));
111
114
},
112
115
);
113
116
});
117
+
118
+ test (
119
+ 'TextPaint and InlineTextStyle can receive Paint instead of Color' ,
120
+ () {
121
+ final flutterStyle = flutter.TextStyle (
122
+ fontSize: 12 ,
123
+ fontFamily: 'Times' ,
124
+ foreground: Paint ()..color = const Color (0xFF0000FF ),
125
+ background: Paint ()..color = const Color (0xFFFF00FF ),
126
+ );
127
+ final textPaint = TextPaint (style: flutterStyle);
128
+
129
+ final inlineTextStyle = textPaint.asInlineTextStyle ();
130
+ expect (inlineTextStyle.fontSize, 12 );
131
+ expect (inlineTextStyle.fontFamily, 'Times' );
132
+ expect (inlineTextStyle.foreground! .color, const Color (0xFF0000FF ));
133
+ expect (inlineTextStyle.background! .color, const Color (0xFFFF00FF ));
134
+
135
+ final newTextPaint = inlineTextStyle.asTextRenderer ();
136
+ expect (newTextPaint.style.fontSize, 12 );
137
+ expect (newTextPaint.style.fontFamily, 'Times' );
138
+ expect (newTextPaint.style.foreground! .color, const Color (0xFF0000FF ));
139
+ expect (newTextPaint.style.background! .color, const Color (0xFFFF00FF ));
140
+ },
141
+ );
114
142
}
0 commit comments