mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
75 lines
2.1 KiB
Dart
75 lines
2.1 KiB
Dart
// Copyright 2014 The Flutter 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 '../flutter_test_alternative.dart';
|
|
|
|
import 'rendering_tester.dart';
|
|
|
|
class RenderLayoutTestBox extends RenderProxyBox {
|
|
RenderLayoutTestBox(this.onLayout);
|
|
|
|
final VoidCallback onLayout;
|
|
|
|
@override
|
|
void layout(Constraints constraints, { bool parentUsesSize = false }) {
|
|
// Doing this in tests is ok, but if you're writing your own
|
|
// render object, you want to override performLayout(), not
|
|
// layout(). Overriding layout() would remove many critical
|
|
// performance optimizations of the rendering system, as well as
|
|
// many bypassing many checked-mode integrity checks.
|
|
super.layout(constraints, parentUsesSize: parentUsesSize);
|
|
onLayout();
|
|
}
|
|
|
|
@override
|
|
bool get sizedByParent => true;
|
|
|
|
@override
|
|
void performLayout() { }
|
|
}
|
|
|
|
void main() {
|
|
test('moving children', () {
|
|
RenderBox child1, child2;
|
|
bool movedChild1 = false;
|
|
bool movedChild2 = false;
|
|
final RenderFlex block = RenderFlex(textDirection: TextDirection.ltr);
|
|
block.add(child1 = RenderLayoutTestBox(() { movedChild1 = true; }));
|
|
block.add(child2 = RenderLayoutTestBox(() { movedChild2 = true; }));
|
|
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
layout(block);
|
|
expect(movedChild1, isTrue);
|
|
expect(movedChild2, isTrue);
|
|
|
|
movedChild1 = false;
|
|
movedChild2 = false;
|
|
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
pumpFrame();
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
|
|
block.move(child1, after: child2);
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
pumpFrame();
|
|
expect(movedChild1, isTrue);
|
|
expect(movedChild2, isTrue);
|
|
|
|
movedChild1 = false;
|
|
movedChild2 = false;
|
|
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
pumpFrame();
|
|
expect(movedChild1, isFalse);
|
|
expect(movedChild2, isFalse);
|
|
});
|
|
}
|