Michael Goderbauer f8a2bd20e9 Redesign Semantic Tree Compilation Algorithm (#12605)
* Oct 12 10:12am

* implicit_semantics_test.dart passes

* refactoring

* works in nice

* minor rename

* more doc comments

* to be explicit check better

* fix test

* ++

* ++

* semantics_9_test (BlockSemantics) and implicit_semantics_test are passing

* doc updates

* tiny refactor

* fix static errors in tests

* fix gesture detector

* ++

* ++

* geometry

* ++

* remove noGeometry

* revert test

* +

* all tests but scrolling/clipping pass

* clipping works

* scrolling halfway

* sliver tests pass

* ALL TESTS PASS

* SemanticsNode changed

* docs and tiny fixes

* card test

* more doc comments

* remove missed print

* more tests

* make test pass on Linux

* remove changes to intellij proj file

* review comments
2017-10-18 16:28:24 -07:00

64 lines
1.8 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);
});
test('ensure frame is scheduled for markNeedsSemanticsUpdate with onlyChanges: true', () {
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(onlyLocalUpdates: true);
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;
}
}