mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Flush UserSettings to window (#6850)
This commit is contained in:
parent
1e7e676e4d
commit
396402f5bd
@ -68,6 +68,9 @@ void _updateLocales(List<String> locales) {
|
||||
@pragma('vm:entry-point')
|
||||
void _updateUserSettingsData(String jsonData) {
|
||||
final Map<String, dynamic> data = json.decode(jsonData);
|
||||
if (data.isEmpty) {
|
||||
return;
|
||||
}
|
||||
_updateTextScaleFactor(data['textScaleFactor'].toDouble());
|
||||
_updateAlwaysUse24HourFormat(data['alwaysUse24HourFormat']);
|
||||
}
|
||||
|
||||
@ -128,7 +128,8 @@ bool RuntimeController::FlushRuntimeStateToIsolate() {
|
||||
return SetViewportMetrics(window_data_.viewport_metrics) &&
|
||||
SetLocales(window_data_.locale_data) &&
|
||||
SetSemanticsEnabled(window_data_.semantics_enabled) &&
|
||||
SetAccessibilityFeatures(window_data_.accessibility_feature_flags_);
|
||||
SetAccessibilityFeatures(window_data_.accessibility_feature_flags_) &&
|
||||
SetUserSettingsData(window_data_.user_settings_data);
|
||||
}
|
||||
|
||||
bool RuntimeController::SetViewportMetrics(const ViewportMetrics& metrics) {
|
||||
|
||||
@ -67,6 +67,12 @@ void main() {
|
||||
window.onTextScaleFactorChanged = originalOnTextScaleFactorChanged;
|
||||
});
|
||||
|
||||
test('updateUserSettings can handle an empty object', () {
|
||||
// this should now throw.
|
||||
_updateUserSettingsData('{}');
|
||||
expect(true, equals(true));
|
||||
});
|
||||
|
||||
test('onMetricsChanged preserves callback zone', () {
|
||||
Zone innerZone;
|
||||
Zone runZone;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user