Fix min/max typo in BoxConstraints.deflate

R=ianh@google.com

Review URL: https://codereview.chromium.org/1153413003
This commit is contained in:
Eric Seidel 2015-06-03 11:12:17 -07:00
parent 72ca1d9f32
commit a90cc80a88
3 changed files with 35 additions and 2 deletions

View File

@ -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
);
}

View 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

View 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));
});
}