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

Side by Side Diff: sky/examples/widgets/sector.dart

Issue 1182223004: Add a test for the sector app. (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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/tests/examples/sector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:math' as math; 5 import 'dart:math' as math;
6 6
7 import 'package:sky/rendering/box.dart'; 7 import 'package:sky/rendering/box.dart';
8 import 'package:sky/rendering/flex.dart'; 8 import 'package:sky/rendering/flex.dart';
9 import 'package:sky/theme2/colors.dart'; 9 import 'package:sky/theme2/colors.dart';
10 import 'package:sky/theme2/edges.dart'; 10 import 'package:sky/theme2/edges.dart';
(...skipping 10 matching lines...) Expand all
21 RenderBox initCircle() { 21 RenderBox initCircle() {
22 return new RenderBoxToRenderSectorAdapter( 22 return new RenderBoxToRenderSectorAdapter(
23 innerRadius: 25.0, 23 innerRadius: 25.0,
24 child: new RenderSectorRing(padding: 0.0) 24 child: new RenderSectorRing(padding: 0.0)
25 ); 25 );
26 } 26 }
27 27
28 class SectorApp extends App { 28 class SectorApp extends App {
29 29
30 RenderBoxToRenderSectorAdapter sectors = initCircle(); 30 RenderBoxToRenderSectorAdapter sectors = initCircle();
31 math.Random rand = new math.Random(); 31 math.Random rand = new math.Random(1);
32 32
33 void addSector() { 33 void addSector() {
34 double deltaTheta; 34 double deltaTheta;
35 var ring = (sectors.child as RenderSectorRing); 35 var ring = (sectors.child as RenderSectorRing);
36 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorConst raints(), ring.deltaRadius); 36 SectorDimensions currentSize = ring.getIntrinsicDimensions(const SectorConst raints(), ring.deltaRadius);
37 if (currentSize.deltaTheta >= kTwoPi - (math.PI * 0.2 + 0.05)) 37 if (currentSize.deltaTheta >= kTwoPi - (math.PI * 0.2 + 0.05))
38 deltaTheta = kTwoPi - currentSize.deltaTheta; 38 deltaTheta = kTwoPi - currentSize.deltaTheta;
39 else 39 else
40 deltaTheta = math.PI * rand.nextDouble() / 5.0 + 0.05; 40 deltaTheta = math.PI * rand.nextDouble() / 5.0 + 0.05;
41 Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080); 41 Color color = new Color(((0xFF << 24) + rand.nextInt(0xFFFFFF)) | 0x808080);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 } 135 }
136 136
137 void main() { 137 void main() {
138 runApp(new SectorApp()); 138 runApp(new SectorApp());
139 WidgetAppView.appView.onFrame = () { 139 WidgetAppView.appView.onFrame = () {
140 // uncomment this for debugging: 140 // uncomment this for debugging:
141 // WidgetAppView.appView.debugDumpRenderTree(); 141 // WidgetAppView.appView.debugDumpRenderTree();
142 }; 142 };
143 } 143 }
OLDNEW
« no previous file with comments | « no previous file | sky/tests/examples/sector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698