mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix min/max typo in BoxConstraints.deflate
R=ianh@google.com Review URL: https://codereview.chromium.org/1153413003
This commit is contained in:
parent
72ca1d9f32
commit
a90cc80a88
@ -55,9 +55,9 @@ class BoxConstraints {
|
||||
double horizontal = edges.left + edges.right;
|
||||
double vertical = edges.top + edges.bottom;
|
||||
return new BoxConstraints(
|
||||
minWidth: math.min(0.0, minWidth - horizontal),
|
||||
minWidth: math.max(0.0, minWidth - horizontal),
|
||||
maxWidth: maxWidth - horizontal,
|
||||
minHeight: math.min(0.0, minHeight - vertical),
|
||||
minHeight: math.max(0.0, minHeight - vertical),
|
||||
maxHeight: maxHeight - vertical
|
||||
);
|
||||
}
|
||||
|
||||
7
tests/raw/padding_deflate-expected.txt
Normal file
7
tests/raw/padding_deflate-expected.txt
Normal file
@ -0,0 +1,7 @@
|
||||
CONSOLE: unittest-suite-wait-for-done
|
||||
CONSOLE: TestView enabled
|
||||
CONSOLE: PASS: should not have a 0 sized colored Box
|
||||
CONSOLE:
|
||||
CONSOLE: All 1 tests passed.
|
||||
CONSOLE: unittest-suite-success
|
||||
DONE
|
||||
26
tests/raw/padding_deflate.dart
Normal file
26
tests/raw/padding_deflate.dart
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2015 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 'dart:sky' as sky;
|
||||
import '../resources/third_party/unittest/unittest.dart';
|
||||
import '../resources/unit.dart';
|
||||
import '../resources/display_list.dart';
|
||||
import 'package:sky/framework/rendering/box.dart';
|
||||
|
||||
void main() {
|
||||
initUnit();
|
||||
|
||||
test("should not have a 0 sized colored Box", () {
|
||||
var coloredBox = new RenderDecoratedBox();
|
||||
var paddingBox = new RenderPadding(padding: const EdgeDims.all(10.0),
|
||||
child: coloredBox);
|
||||
RenderBox root = new RenderDecoratedBox(
|
||||
child: paddingBox
|
||||
);
|
||||
TestView renderView = new TestView(child: root);
|
||||
renderView.layout(new ViewConstraints(width: sky.view.width, height: sky.view.height));
|
||||
expect(coloredBox.size.width, equals(sky.view.width - 20));
|
||||
expect(coloredBox.size.height, equals(sky.view.height - 20));
|
||||
});
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user