mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* ensures that only semantics boundaries will be added to owner._nodesNeedingSemantics as expected by compiler. * no longer throws assert if markNeedsSemanticsUpdate is called on non-semantic-boundary render object with a non-semantic-boundary parent. * Fixes #13109. * removes onlyLocalUpdates from markNeedsSemanticsUpdate as its no longer needed.
49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
// Copyright 2017 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test('ensure frame is scheduled for markNeedsSemanticsUpdate', () {
|
|
final TestRenderObject renderObject = new TestRenderObject();
|
|
int onNeedVisualUpdateCallCount = 0;
|
|
final PipelineOwner owner = new PipelineOwner(onNeedVisualUpdate: () {
|
|
onNeedVisualUpdateCallCount +=1;
|
|
});
|
|
owner.ensureSemantics();
|
|
renderObject.attach(owner);
|
|
owner.flushSemantics();
|
|
|
|
expect(onNeedVisualUpdateCallCount, 1);
|
|
renderObject.markNeedsSemanticsUpdate();
|
|
expect(onNeedVisualUpdateCallCount, 2);
|
|
});
|
|
}
|
|
|
|
class TestRenderObject extends RenderObject {
|
|
@override
|
|
void debugAssertDoesMeetConstraints() {}
|
|
|
|
@override
|
|
Rect get paintBounds => null;
|
|
|
|
@override
|
|
void performLayout() {}
|
|
|
|
@override
|
|
void performResize() {}
|
|
|
|
@override
|
|
Rect get semanticBounds => new Rect.fromLTWH(0.0, 0.0, 10.0, 20.0);
|
|
|
|
@override
|
|
void describeSemanticsConfiguration(SemanticsConfiguration config) {
|
|
super.describeSemanticsConfiguration(config);
|
|
config.isSemanticBoundary = true;
|
|
}
|
|
}
|
|
|