Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1302)

Unified Diff: sky/tests/raw/render_box.dart

Issue 1160763004: Add support for testing content in SkyView (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/tests/raw/render_box.dart
diff --git a/sky/tests/raw/render_box.dart b/sky/tests/raw/render_box.dart
new file mode 100644
index 0000000000000000000000000000000000000000..76ac54c3b5838eefef01d6939066c3865919ecc9
--- /dev/null
+++ b/sky/tests/raw/render_box.dart
@@ -0,0 +1,40 @@
+// 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 '../resources/third_party/unittest/unittest.dart';
+import '../resources/unit.dart';
+import 'dart:sky' as sky;
+import 'package:sky/framework/layout2.dart';
+
+class RenderSizedBox extends RenderBox {
+ final double desiredHeight;
+ final double desiredWidth;
+
+ RenderSizedBox({ this.desiredHeight: double.INFINITY,
+ this.desiredWidth: double.INFINITY });
+
+ BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) {
+ return new BoxDimensions.withConstraints(constraints,
+ height: desiredHeight,
+ width: desiredWidth);
+ }
+
+ void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) {
+ width = constraints.constrainWidth(desiredWidth);
+ height = constraints.constrainHeight(desiredHeight);
+ layoutDone();
+ }
+}
+
+void main() {
+ initUnit();
+
+ test("should size to render view", () {
+ RenderSizedBox root = new RenderSizedBox();
+ RenderView renderView = new RenderView(root: root);
+ renderView.layout(newWidth: sky.view.width, newHeight: sky.view.height);
+ expect(root.width, equals(sky.view.width));
+ expect(root.height, equals(sky.view.height));
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698