@@ -363,4 +363,46 @@ void main() {
363363 expect (theme.bodySmall! .textBaseline, TextBaseline .alphabetic);
364364 expect (theme.bodySmall! .leadingDistribution, TextLeadingDistribution .even);
365365 });
366+
367+ test ('Default M3 light textTheme styles all use onSurface' , () {
368+ final ThemeData theme = ThemeData (useMaterial3: true );
369+ final TextTheme textTheme = theme.textTheme;
370+ final Color dark = theme.colorScheme.onSurface;
371+ expect (textTheme.displayLarge! .color, dark);
372+ expect (textTheme.displayMedium! .color, dark);
373+ expect (textTheme.displaySmall! .color, dark);
374+ expect (textTheme.headlineLarge! .color, dark);
375+ expect (textTheme.headlineMedium! .color, dark);
376+ expect (textTheme.headlineSmall! .color, dark);
377+ expect (textTheme.titleLarge! .color, dark);
378+ expect (textTheme.titleMedium! .color, dark);
379+ expect (textTheme.titleSmall! .color, dark);
380+ expect (textTheme.bodyLarge! .color, dark);
381+ expect (textTheme.bodyMedium! .color, dark);
382+ expect (textTheme.bodySmall! .color, dark);
383+ expect (textTheme.labelLarge! .color, dark);
384+ expect (textTheme.labelMedium! .color, dark);
385+ expect (textTheme.labelSmall! .color, dark);
386+ });
387+
388+ test ('Default M3 dark textTheme styles all use onSurface' , () {
389+ final ThemeData theme = ThemeData (useMaterial3: true , brightness: Brightness .dark);
390+ final TextTheme textTheme = theme.textTheme;
391+ final Color light = theme.colorScheme.onSurface;
392+ expect (textTheme.displayLarge! .color, light);
393+ expect (textTheme.displayMedium! .color, light);
394+ expect (textTheme.displaySmall! .color, light);
395+ expect (textTheme.headlineLarge! .color, light);
396+ expect (textTheme.headlineMedium! .color, light);
397+ expect (textTheme.headlineSmall! .color, light);
398+ expect (textTheme.titleLarge! .color, light);
399+ expect (textTheme.titleMedium! .color, light);
400+ expect (textTheme.titleSmall! .color, light);
401+ expect (textTheme.bodyLarge! .color, light);
402+ expect (textTheme.bodyMedium! .color, light);
403+ expect (textTheme.bodySmall! .color, light);
404+ expect (textTheme.labelLarge! .color, light);
405+ expect (textTheme.labelMedium! .color, light);
406+ expect (textTheme.labelSmall! .color, light);
407+ });
366408}
0 commit comments