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

Unified Diff: sky/tests/widgets/syncs1.dart

Issue 1182463006: Clean up how we remove nodes from the render tree, and make sure we reinsert them in the right plac… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « sky/sdk/lib/widgets/widget.dart ('k') | sky/tests/widgets/syncs1-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/widgets/syncs1.dart
diff --git a/sky/tests/widgets/syncs1.dart b/sky/tests/widgets/syncs1.dart
new file mode 100644
index 0000000000000000000000000000000000000000..14750eb3981acb23fc2c84284f8208a50a5dae2c
--- /dev/null
+++ b/sky/tests/widgets/syncs1.dart
@@ -0,0 +1,100 @@
+// 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:async';
+
+import 'package:sky/widgets/basic.dart';
+import 'package:sky/widgets/raised_button.dart';
+
+import '../resources/display_list.dart';
+
+class FiddleApp extends App {
+
+ bool arbitrarySetting = true;
+
+ void toggle() {
+ setState(() {
+ arbitrarySetting = !arbitrarySetting;
+ });
+ }
+
+ Widget buildFlex1() {
+ return new Flex([
+ new Flexible(child: new Container(
+ decoration: new BoxDecoration(
+ backgroundColor: const Color(0xFF00FFFF)
+ )
+ )),
+ new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR'), onPressed: toggle)
+ ]);
+ }
+
+ Widget buildFlex2() {
+ return new Flex([
+ new Flexible(child: new Container(
+ key: 'something-else',
+ decoration: new BoxDecoration(
+ backgroundColor: const Color(0xEFFF9F00)
+ )
+ )),
+ new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
+ ]);
+ }
+
+ Widget buildStack1() {
+ return new Stack([
+ new Positioned(child: new Container(
+ decoration: new BoxDecoration(
+ backgroundColor: const Color(0xFF00FFFF)
+ )
+ )),
+ new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR'), onPressed: toggle)
+ ]);
+ }
+
+ Widget buildStack2() {
+ return new Stack([
+ new Positioned(child: new Container(
+ key: 'something-else',
+ decoration: new BoxDecoration(
+ backgroundColor: const Color(0xEFFF9F00)
+ )
+ )),
+ new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
+ ]);
+ }
+
+ Widget build() {
+ return new Block([
+ new SizedBox(
+ key: 'flex-example',
+ height: 250.0,
+ child: arbitrarySetting ? buildFlex1() : buildFlex2()
+ ),
+ new SizedBox(
+ key: 'stack-example',
+ height: 250.0,
+ child: arbitrarySetting ? buildStack1() : buildStack2()
+ )
+ ]);
+ }
+}
+
+main() {
+ TestRenderView renderViewOverride = new TestRenderView();
+ FiddleApp app = new FiddleApp();
+ runApp(app, renderViewOverride: renderViewOverride);
+ new Future.microtask(() {
+ renderViewOverride.checkFrame();
+ app.toggle();
+ new Future.microtask(() {
+ renderViewOverride.checkFrame();
+ app.toggle();
+ new Future.microtask(() {
+ renderViewOverride.checkFrame();
+ renderViewOverride.endTest();
+ });
+ });
+ });
+}
« no previous file with comments | « sky/sdk/lib/widgets/widget.dart ('k') | sky/tests/widgets/syncs1-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698