@@ -1294,6 +1294,7 @@ void main() {
12941294 wrapped.onPlatformConfigurationChanged = () => notifications.add ('configuration' );
12951295 wrapped.onTextScaleFactorChanged = () => notifications.add ('textScaleFactor' );
12961296 wrapped.onPlatformBrightnessChanged = () => notifications.add ('platformBrightness' );
1297+ wrapped.onAlwaysUse24HourFormatChanged = () => notifications.add ('alwaysUse24HourFormat' );
12971298 wrapped.onAccessibilityFeaturesChanged = () => notifications.add ('accessibilityFeatures' );
12981299 wrapped.onMetricsChanged = () => notifications.add ('metrics' );
12991300
@@ -1318,9 +1319,9 @@ void main() {
13181319 'accessibilityFeatures' ,
13191320 ]);
13201321
1321- // The 24 hour format has no callback of its own: the configuration
1322- // notification is the only one that names it , and onMetricsChanged is
1323- // what tells the framework to re-read it.
1322+ // The 24 hour format announces onAlwaysUse24HourFormatChanged and
1323+ // onPlatformConfigurationChanged , and onMetricsChanged is what tells the
1324+ // framework to re-read it.
13241325 notifications.clear ();
13251326 debugSetViewMetricsOverride (
13261327 1 ,
@@ -1332,7 +1333,7 @@ void main() {
13321333 alwaysUse24HourFormat: true ,
13331334 ),
13341335 );
1335- expect (notifications, < String > ['configuration' , 'metrics' ]);
1336+ expect (notifications, < String > ['configuration' , 'alwaysUse24HourFormat' , ' metrics' ]);
13361337
13371338 // A table that scales differently but reports the same factor is still a
13381339 // change of text scaling.
@@ -1376,17 +1377,15 @@ void main() {
13761377 wrapped.onMetricsChanged = () => notifications.add ('metrics' );
13771378 wrapped.onTextScaleFactorChanged = () => notifications.add ('textScaleFactor' );
13781379 wrapped.onPlatformBrightnessChanged = () => notifications.add ('platformBrightness' );
1380+ wrapped.onAlwaysUse24HourFormatChanged = () => notifications.add ('alwaysUse24HourFormat' );
13791381 wrapped.onAccessibilityFeaturesChanged = () => notifications.add ('accessibilityFeatures' );
13801382
13811383 for (final MapEntry <String , _MetricChange > entry in _perMetricChange.entries) {
13821384 debugSetViewMetricsOverride (1 , _fullyPopulated);
13831385 notifications.clear ();
13841386 debugSetViewMetricsOverride (1 , entry.value (_fullyPopulated));
13851387 expect (notifications.toSet (), switch (entry.key) {
1386- // dart:ui has no callback of its own for the 24 hour format: it
1387- // reports it through the configuration notification, and the
1388- // framework re-reads it when the view metrics change.
1389- 'alwaysUse24HourFormat' => < String > {'configuration' , 'metrics' },
1388+ 'alwaysUse24HourFormat' => < String > {'configuration' , 'alwaysUse24HourFormat' , 'metrics' },
13901389 'textScaling' => < String > {'configuration' , 'textScaleFactor' },
13911390 'platformBrightness' => < String > {'configuration' , 'platformBrightness' },
13921391 final String metric when viewMetrics.contains (metric) => < String > {'metrics' },
@@ -1469,6 +1468,16 @@ void main() {
14691468 });
14701469
14711470 group ('engine roll tolerance' , () {
1471+ test ('forwards onAlwaysUse24HourFormatChanged' , () {
1472+ final fake = _TwoViewPlatformDispatcher ();
1473+ final ui.PlatformDispatcher dispatcher = debugApplyViewMetricsOverrides (fake);
1474+ var calls = 0 ;
1475+ dispatcher.onAlwaysUse24HourFormatChanged = () => calls += 1 ;
1476+ expect (fake.onAlwaysUse24HourFormatChanged, isNotNull);
1477+ fake.onAlwaysUse24HourFormatChanged !();
1478+ expect (calls, 1 );
1479+ });
1480+
14721481 test ('wrappers declare no noSuchMethod' , () {
14731482 final fake = _TwoViewPlatformDispatcher ();
14741483 final ui.PlatformDispatcher dispatcher = debugApplyViewMetricsOverrides (fake);
@@ -1573,6 +1582,9 @@ class _TwoViewPlatformDispatcher implements ui.PlatformDispatcher {
15731582 @override
15741583 ui.VoidCallback ? onTextScaleFactorChanged;
15751584
1585+ @override
1586+ ui.VoidCallback ? onAlwaysUse24HourFormatChanged;
1587+
15761588 @override
15771589 ui.ViewFocusChangeCallback ? onViewFocusChange;
15781590
0 commit comments