Merge remote-tracking branch 'upstream/master' into doubletap
This commit is contained in:
commit
af92062569
@ -2,7 +2,6 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'lib/sector_layout.dart';
|
import 'lib/sector_layout.dart';
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import 'dart:ui' as ui;
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
|
|
||||||
import 'stock_data.dart';
|
import 'stock_data.dart';
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class StockHomeState extends State<StockHome> {
|
|||||||
),
|
),
|
||||||
new DrawerItem(
|
new DrawerItem(
|
||||||
icon: 'device/dvr',
|
icon: 'device/dvr',
|
||||||
onPressed: () { debugDumpApp(); },
|
onPressed: () { debugDumpApp(); debugDumpRenderTree(); },
|
||||||
child: new Text('Dump App to Console')
|
child: new Text('Dump App to Console')
|
||||||
),
|
),
|
||||||
new DrawerDivider(),
|
new DrawerDivider(),
|
||||||
|
@ -45,6 +45,8 @@ class GestureArenaEntry {
|
|||||||
class _GestureArenaState {
|
class _GestureArenaState {
|
||||||
final List<GestureArenaMember> members = new List<GestureArenaMember>();
|
final List<GestureArenaMember> members = new List<GestureArenaMember>();
|
||||||
bool isOpen = true;
|
bool isOpen = true;
|
||||||
|
bool isHeld = false;
|
||||||
|
bool hasPendingSweep = false;
|
||||||
|
|
||||||
void add(GestureArenaMember member) {
|
void add(GestureArenaMember member) {
|
||||||
assert(isOpen);
|
assert(isOpen);
|
||||||
@ -72,6 +74,46 @@ class GestureArena {
|
|||||||
_tryToResolveArena(key, state);
|
_tryToResolveArena(key, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Force resolution on this arena, giving the win to the first member
|
||||||
|
void sweep(Object key) {
|
||||||
|
_GestureArenaState state = _arenas[key];
|
||||||
|
if (state == null)
|
||||||
|
return; // This arena either never existed or has been resolved.
|
||||||
|
assert(!state.isOpen);
|
||||||
|
if (state.isHeld) {
|
||||||
|
state.hasPendingSweep = true;
|
||||||
|
return; // This arena is being held for a long-lived member
|
||||||
|
}
|
||||||
|
_arenas.remove(key);
|
||||||
|
if (!state.members.isEmpty) {
|
||||||
|
// First member wins
|
||||||
|
state.members.first.acceptGesture(key);
|
||||||
|
// Give all the other members the bad news
|
||||||
|
for (int i = 1; i < state.members.length; i++)
|
||||||
|
state.members[i].rejectGesture(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Prevent the arena from being swept
|
||||||
|
void hold(Object key) {
|
||||||
|
_GestureArenaState state = _arenas[key];
|
||||||
|
if (state == null)
|
||||||
|
return; // This arena either never existed or has been resolved.
|
||||||
|
state.isHeld = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Release a hold, allowing the arena to be swept
|
||||||
|
/// If a sweep was attempted on a held arena, the sweep will be done
|
||||||
|
/// on release
|
||||||
|
void release(Object key) {
|
||||||
|
_GestureArenaState state = _arenas[key];
|
||||||
|
if (state == null)
|
||||||
|
return; // This arena either never existed or has been resolved.
|
||||||
|
state.isHeld = false;
|
||||||
|
if (state.hasPendingSweep)
|
||||||
|
sweep(key);
|
||||||
|
}
|
||||||
|
|
||||||
void _tryToResolveArena(Object key, _GestureArenaState state) {
|
void _tryToResolveArena(Object key, _GestureArenaState state) {
|
||||||
assert(_arenas[key] == state);
|
assert(_arenas[key] == state);
|
||||||
assert(!state.isOpen);
|
assert(!state.isOpen);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ui' as ui;
|
|
||||||
|
|
||||||
import 'package:flutter/animation.dart';
|
import 'package:flutter/animation.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
|
@ -252,25 +252,131 @@ class TextStyle {
|
|||||||
List<String> result = <String>[];
|
List<String> result = <String>[];
|
||||||
if (color != null)
|
if (color != null)
|
||||||
result.add('${prefix}color: $color');
|
result.add('${prefix}color: $color');
|
||||||
// TODO(hansmuller): escape the fontFamily string.
|
|
||||||
if (fontFamily != null)
|
if (fontFamily != null)
|
||||||
result.add('${prefix}fontFamily: "$fontFamily"');
|
result.add('${prefix}family: "$fontFamily"');
|
||||||
if (fontSize != null)
|
if (fontSize != null)
|
||||||
result.add('${prefix}fontSize: $fontSize');
|
result.add('${prefix}size: $fontSize');
|
||||||
if (fontWeight != null)
|
if (fontWeight != null) {
|
||||||
result.add('${prefix}fontWeight: $fontWeight');
|
switch (fontWeight) {
|
||||||
if (fontStyle != null)
|
case FontWeight.w100:
|
||||||
result.add('${prefix}fontStyle: $fontStyle');
|
result.add('${prefix}weight: 100');
|
||||||
if (textAlign != null)
|
break;
|
||||||
result.add('${prefix}textAlign: $textAlign');
|
case FontWeight.w200:
|
||||||
if (textBaseline != null)
|
result.add('${prefix}weight: 200');
|
||||||
result.add('${prefix}textBaseline: $textBaseline');
|
break;
|
||||||
if (decoration != null)
|
case FontWeight.w300:
|
||||||
result.add('${prefix}decoration: $decoration');
|
result.add('${prefix}weight: 300');
|
||||||
if (decorationColor != null)
|
break;
|
||||||
result.add('${prefix}decorationColor: $decorationColor');
|
case FontWeight.w400:
|
||||||
if (decorationStyle != null)
|
result.add('${prefix}weight: 400');
|
||||||
result.add('${prefix}decorationStyle: $decorationStyle');
|
break;
|
||||||
|
case FontWeight.w500:
|
||||||
|
result.add('${prefix}weight: 500');
|
||||||
|
break;
|
||||||
|
case FontWeight.w600:
|
||||||
|
result.add('${prefix}weight: 600');
|
||||||
|
break;
|
||||||
|
case FontWeight.w700:
|
||||||
|
result.add('${prefix}weight: 700');
|
||||||
|
break;
|
||||||
|
case FontWeight.w800:
|
||||||
|
result.add('${prefix}weight: 800');
|
||||||
|
break;
|
||||||
|
case FontWeight.w900:
|
||||||
|
result.add('${prefix}weight: 900');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fontStyle != null) {
|
||||||
|
switch (fontStyle) {
|
||||||
|
case FontStyle.normal:
|
||||||
|
result.add('${prefix}style: normal');
|
||||||
|
break;
|
||||||
|
case FontStyle.italic:
|
||||||
|
result.add('${prefix}style: italic');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (textAlign != null) {
|
||||||
|
switch (textAlign) {
|
||||||
|
case TextAlign.left:
|
||||||
|
result.add('${prefix}align: left');
|
||||||
|
break;
|
||||||
|
case TextAlign.right:
|
||||||
|
result.add('${prefix}align: right');
|
||||||
|
break;
|
||||||
|
case TextAlign.center:
|
||||||
|
result.add('${prefix}align: center');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (textBaseline != null) {
|
||||||
|
switch (textBaseline) {
|
||||||
|
case TextBaseline.alphabetic:
|
||||||
|
result.add('${prefix}baseline: alphabetic');
|
||||||
|
break;
|
||||||
|
case TextBaseline.ideographic:
|
||||||
|
result.add('${prefix}baseline: ideographic');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (decoration != null || decorationColor != null || decorationStyle != null) {
|
||||||
|
String decorationDescription = '${prefix}decoration: ';
|
||||||
|
bool haveDecorationDescription = false;
|
||||||
|
if (decorationStyle != null) {
|
||||||
|
switch (decorationStyle) {
|
||||||
|
case TextDecorationStyle.solid:
|
||||||
|
decorationDescription += 'solid';
|
||||||
|
break;
|
||||||
|
case TextDecorationStyle.double:
|
||||||
|
decorationDescription += 'double';
|
||||||
|
break;
|
||||||
|
case TextDecorationStyle.dotted:
|
||||||
|
decorationDescription += 'dotted';
|
||||||
|
break;
|
||||||
|
case TextDecorationStyle.dashed:
|
||||||
|
decorationDescription += 'dashed';
|
||||||
|
break;
|
||||||
|
case TextDecorationStyle.wavy:
|
||||||
|
decorationDescription += 'wavy';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
haveDecorationDescription = true;
|
||||||
|
}
|
||||||
|
if (decorationColor != null) {
|
||||||
|
if (haveDecorationDescription)
|
||||||
|
decorationDescription += ' ';
|
||||||
|
decorationDescription += '$decorationColor';
|
||||||
|
haveDecorationDescription = true;
|
||||||
|
}
|
||||||
|
if (decoration != null) {
|
||||||
|
if (haveDecorationDescription)
|
||||||
|
decorationDescription += ' ';
|
||||||
|
bool multipleDecorations = false;
|
||||||
|
for (TextDecoration value in decoration) {
|
||||||
|
if (multipleDecorations)
|
||||||
|
decorationDescription += '+';
|
||||||
|
switch (value) {
|
||||||
|
case TextDecoration.none:
|
||||||
|
decorationDescription += 'none';
|
||||||
|
break;
|
||||||
|
case TextDecoration.underline:
|
||||||
|
decorationDescription += 'underline';
|
||||||
|
break;
|
||||||
|
case TextDecoration.overline:
|
||||||
|
decorationDescription += 'overline';
|
||||||
|
break;
|
||||||
|
case TextDecoration.lineThrough:
|
||||||
|
decorationDescription += 'line-through';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
multipleDecorations = true;
|
||||||
|
}
|
||||||
|
haveDecorationDescription = true;
|
||||||
|
}
|
||||||
|
assert(haveDecorationDescription);
|
||||||
|
result.add(decorationDescription);
|
||||||
|
}
|
||||||
if (result.isEmpty)
|
if (result.isEmpty)
|
||||||
return '$prefix<no style specified>';
|
return '$prefix<no style specified>';
|
||||||
return result.join('\n');
|
return result.join('\n');
|
||||||
|
@ -244,6 +244,8 @@ class FlutterBinding extends HitTestTarget {
|
|||||||
pointerRouter.route(event);
|
pointerRouter.route(event);
|
||||||
if (event.type == 'pointerdown')
|
if (event.type == 'pointerdown')
|
||||||
GestureArena.instance.close(event.pointer);
|
GestureArena.instance.close(event.pointer);
|
||||||
|
else if (event.type == 'pointerup')
|
||||||
|
GestureArena.instance.sweep(event.pointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1139,11 +1139,18 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
/// Returns a description of the tree rooted at this node.
|
/// Returns a description of the tree rooted at this node.
|
||||||
/// If the prefix argument is provided, then every line in the output
|
/// If the prefix argument is provided, then every line in the output
|
||||||
/// will be prefixed by that string.
|
/// will be prefixed by that string.
|
||||||
String toStringDeep([String prefix = '']) {
|
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
||||||
RenderObject debugPreviousActiveLayout = _debugActiveLayout;
|
RenderObject debugPreviousActiveLayout = _debugActiveLayout;
|
||||||
_debugActiveLayout = null;
|
_debugActiveLayout = null;
|
||||||
prefix += ' ';
|
String result = '$prefixLineOne$this\n';
|
||||||
String result = '$this\n${debugDescribeSettings(prefix)}${debugDescribeChildren(prefix)}';
|
final String childrenDescription = debugDescribeChildren(prefixOtherLines);
|
||||||
|
final String settingsPrefix = childrenDescription != '' ? '$prefixOtherLines \u2502 ' : '$prefixOtherLines ';
|
||||||
|
result += debugDescribeSettings(settingsPrefix);
|
||||||
|
if (childrenDescription != '')
|
||||||
|
result += '$prefixOtherLines \u2502\n';
|
||||||
|
else
|
||||||
|
result += '$prefixOtherLines\n';
|
||||||
|
result += childrenDescription;
|
||||||
_debugActiveLayout = debugPreviousActiveLayout;
|
_debugActiveLayout = debugPreviousActiveLayout;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1198,7 +1205,7 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> implem
|
|||||||
}
|
}
|
||||||
String debugDescribeChildren(String prefix) {
|
String debugDescribeChildren(String prefix) {
|
||||||
if (child != null)
|
if (child != null)
|
||||||
return '${prefix}child: ${child.toStringDeep(prefix)}';
|
return '${child.toStringDeep("$prefix \u2514\u2500child: ", "$prefix ")}';
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1442,13 +1449,19 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
|
|||||||
|
|
||||||
String debugDescribeChildren(String prefix) {
|
String debugDescribeChildren(String prefix) {
|
||||||
String result = '';
|
String result = '';
|
||||||
int count = 1;
|
if (_firstChild != null) {
|
||||||
ChildType child = _firstChild;
|
ChildType child = _firstChild;
|
||||||
while (child != null) {
|
int count = 1;
|
||||||
result += '${prefix}child $count: ${child.toStringDeep(prefix)}';
|
while (child != _lastChild) {
|
||||||
count += 1;
|
result += '${child.toStringDeep("$prefix \u251C\u2500child $count: ", "$prefix \u2502")}';
|
||||||
final ParentDataType childParentData = child.parentData;
|
count += 1;
|
||||||
child = childParentData.nextSibling;
|
final ParentDataType childParentData = child.parentData;
|
||||||
|
child = childParentData.nextSibling;
|
||||||
|
}
|
||||||
|
if (child != null) {
|
||||||
|
assert(child == _lastChild);
|
||||||
|
result += '${child.toStringDeep("$prefix \u2514\u2500child $count: ", "$prefix ")}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -883,6 +883,7 @@ class FractionalOffset {
|
|||||||
value = 37 * value + y.hashCode;
|
value = 37 * value + y.hashCode;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
String toString() => '$runtimeType($x, $y)';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Applies a transformation before painting its child
|
/// Applies a transformation before painting its child
|
||||||
@ -1016,7 +1017,7 @@ class RenderTransform extends RenderProxyBox {
|
|||||||
String debugDescribeSettings(String prefix) {
|
String debugDescribeSettings(String prefix) {
|
||||||
List<String> result = _transform.toString().split('\n').map((String s) => '$prefix $s\n').toList();
|
List<String> result = _transform.toString().split('\n').map((String s) => '$prefix $s\n').toList();
|
||||||
result.removeLast();
|
result.removeLast();
|
||||||
return '${super.debugDescribeSettings(prefix)}${prefix}transform matrix:\n${result.join()}\n${prefix}origin: $origin\n';
|
return '${super.debugDescribeSettings(prefix)}${prefix}transform matrix:\n${result.join()}\n${prefix}origin: $origin\nalignment: $alignment\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,9 @@ void runApp(Widget app) {
|
|||||||
void debugDumpApp() {
|
void debugDumpApp() {
|
||||||
assert(WidgetFlutterBinding.instance != null);
|
assert(WidgetFlutterBinding.instance != null);
|
||||||
assert(WidgetFlutterBinding.instance.renderViewElement != null);
|
assert(WidgetFlutterBinding.instance.renderViewElement != null);
|
||||||
|
String mode = 'RELEASE MODE';
|
||||||
|
assert(() { mode = 'CHECKED MODE'; return true; });
|
||||||
|
print('${WidgetFlutterBinding.instance.runtimeType} - $mode');
|
||||||
WidgetFlutterBinding.instance.renderViewElement.toStringDeep().split('\n').forEach(print);
|
WidgetFlutterBinding.instance.renderViewElement.toStringDeep().split('\n').forEach(print);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +394,11 @@ abstract class State<T extends StatefulComponent> {
|
|||||||
|
|
||||||
void debugFillDescription(List<String> description) {
|
void debugFillDescription(List<String> description) {
|
||||||
description.add('$hashCode');
|
description.add('$hashCode');
|
||||||
if (_debugLifecycleState != _StateLifecycle.ready)
|
assert(() {
|
||||||
description.add('$_debugLifecycleState');
|
if (_debugLifecycleState != _StateLifecycle.ready)
|
||||||
|
description.add('$_debugLifecycleState');
|
||||||
|
return true;
|
||||||
|
});
|
||||||
if (_config == null)
|
if (_config == null)
|
||||||
description.add('no config');
|
description.add('no config');
|
||||||
if (_element == null)
|
if (_element == null)
|
||||||
@ -829,9 +832,7 @@ abstract class Element<T extends Widget> implements BuildContext {
|
|||||||
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
String toStringDeep([String prefixLineOne = '', String prefixOtherLines = '']) {
|
||||||
String result = '$prefixLineOne$this\n';
|
String result = '$prefixLineOne$this\n';
|
||||||
List<Element> children = <Element>[];
|
List<Element> children = <Element>[];
|
||||||
visitChildren((Element child) {
|
visitChildren(children.add);
|
||||||
children.add(child);
|
|
||||||
});
|
|
||||||
if (children.length > 0) {
|
if (children.length > 0) {
|
||||||
Element last = children.removeLast();
|
Element last = children.removeLast();
|
||||||
for (Element child in children)
|
for (Element child in children)
|
||||||
|
@ -4,14 +4,22 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
|
|||||||
_PhysicsDebugDraw(
|
_PhysicsDebugDraw(
|
||||||
box2d.ViewportTransform transform,
|
box2d.ViewportTransform transform,
|
||||||
this.physicsNode
|
this.physicsNode
|
||||||
) : super(transform);
|
) : super(transform) {
|
||||||
|
appendFlags(
|
||||||
|
box2d.DebugDraw.JOINT_BIT |
|
||||||
|
box2d.DebugDraw.CENTER_OF_MASS_BIT |
|
||||||
|
box2d.DebugDraw.WIREFRAME_DRAWING_BIT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
PhysicsNode physicsNode;
|
PhysicsNode physicsNode;
|
||||||
|
|
||||||
PaintingCanvas canvas;
|
PaintingCanvas canvas;
|
||||||
|
|
||||||
void drawSegment(Vector2 p1, Vector2 p2, box2d.Color3i color) {
|
void drawSegment(Vector2 p1, Vector2 p2, box2d.Color3i color) {
|
||||||
Paint paint = new Paint()..color = _toColor(color);
|
Paint paint = new Paint()
|
||||||
|
..color = _toColor(color)
|
||||||
|
..strokeWidth = 1.0;
|
||||||
canvas.drawLine(_toPoint(p1), _toPoint(p2), paint);
|
canvas.drawLine(_toPoint(p1), _toPoint(p2), paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +41,6 @@ class _PhysicsDebugDraw extends box2d.DebugDraw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) {
|
void drawCircle(Vector2 center, num radius, box2d.Color3i color, [Vector2 axis]) {
|
||||||
print("drawCircle: $center");
|
|
||||||
Paint paint = new Paint()
|
Paint paint = new Paint()
|
||||||
..color = _toColor(color)
|
..color = _toColor(color)
|
||||||
..setStyle(ui.PaintingStyle.stroke)
|
..setStyle(ui.PaintingStyle.stroke)
|
||||||
|
@ -32,8 +32,10 @@ class SpriteBox extends RenderBox {
|
|||||||
if (value == _rootNode) return;
|
if (value == _rootNode) return;
|
||||||
|
|
||||||
// Ensure that the root node has a size
|
// Ensure that the root node has a size
|
||||||
assert(value.size.width > 0);
|
assert(_transformMode == SpriteBoxTransformMode.nativePoints
|
||||||
assert(value.size.height > 0);
|
|| value.size.width > 0);
|
||||||
|
assert(_transformMode == SpriteBoxTransformMode.nativePoints
|
||||||
|
|| value.size.height > 0);
|
||||||
|
|
||||||
// Remove sprite box references
|
// Remove sprite box references
|
||||||
if (_rootNode != null) _removeSpriteBoxReference(_rootNode);
|
if (_rootNode != null) _removeSpriteBoxReference(_rootNode);
|
||||||
@ -101,11 +103,11 @@ class SpriteBox extends RenderBox {
|
|||||||
assert(rootNode != null);
|
assert(rootNode != null);
|
||||||
assert(rootNode._spriteBox == null);
|
assert(rootNode._spriteBox == null);
|
||||||
|
|
||||||
// Setup root node
|
|
||||||
this.rootNode = rootNode;
|
|
||||||
|
|
||||||
// Setup transform mode
|
// Setup transform mode
|
||||||
this.transformMode = mode;
|
this.transformMode = mode;
|
||||||
|
|
||||||
|
// Setup root node
|
||||||
|
this.rootNode = rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _removeSpriteBoxReference(Node node) {
|
void _removeSpriteBoxReference(Node node) {
|
||||||
@ -310,6 +312,8 @@ class SpriteBox extends RenderBox {
|
|||||||
rootNode.size = new Size(systemWidth, systemHeight);
|
rootNode.size = new Size(systemWidth, systemHeight);
|
||||||
break;
|
break;
|
||||||
case SpriteBoxTransformMode.nativePoints:
|
case SpriteBoxTransformMode.nativePoints:
|
||||||
|
systemWidth = size.width;
|
||||||
|
systemHeight = size.height;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -6,15 +6,15 @@ void main() {
|
|||||||
Document document = new Document();
|
Document document = new Document();
|
||||||
|
|
||||||
test("should throw with invalid arguments", () {
|
test("should throw with invalid arguments", () {
|
||||||
var parent = document.createElement("div");
|
Element parent = document.createElement("div");
|
||||||
var child = document.createElement("div");
|
Element child = document.createElement("div");
|
||||||
parent.appendChild(child);
|
parent.appendChild(child);
|
||||||
// TODO(eseidel): This should throw!
|
// TODO(eseidel): This should throw!
|
||||||
// expect(() {
|
// expect(() {
|
||||||
// parent.insertBefore([parent]);
|
// parent.insertBefore([parent]);
|
||||||
// }, throws);
|
// }, throws);
|
||||||
expect(() {
|
expect(() {
|
||||||
child.insertBefore([parent]);
|
child.insertBefore(<Node>[parent]);
|
||||||
}, throws);
|
}, throws);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,36 +5,36 @@ import 'package:test/test.dart';
|
|||||||
import 'dom_utils.dart';
|
import 'dom_utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
var document = new Document();
|
Document document = new Document();
|
||||||
|
|
||||||
test("should replace elements", () {
|
test("should replace elements", () {
|
||||||
var parent = document.createElement("div");
|
Element parent = document.createElement("div");
|
||||||
var oldChild = parent.appendChild(document.createElement("div"));
|
Element oldChild = parent.appendChild(document.createElement("div"));
|
||||||
var newChild = document.createElement("div");
|
Element newChild = document.createElement("div");
|
||||||
oldChild.replaceWith([newChild]);
|
oldChild.replaceWith(<Node>[newChild]);
|
||||||
expect(oldChild.parentNode, isNull);
|
expect(oldChild.parentNode, isNull);
|
||||||
expect(newChild.parentNode, equals(parent));
|
expect(newChild.parentNode, equals(parent));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should replace text", () {
|
test("should replace text", () {
|
||||||
var parent = document.createElement("div");
|
Element parent = document.createElement("div");
|
||||||
var oldChild = parent.appendChild(document.createText(" it's a text "));
|
Node oldChild = parent.appendChild(document.createText(" it's a text "));
|
||||||
var newChild = document.createElement("div");
|
Element newChild = document.createElement("div");
|
||||||
oldChild.replaceWith([newChild]);
|
oldChild.replaceWith(<Node>[newChild]);
|
||||||
expect(oldChild.parentNode, isNull);
|
expect(oldChild.parentNode, isNull);
|
||||||
expect(newChild.parentNode, equals(parent));
|
expect(newChild.parentNode, equals(parent));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should replace children with a fragment", () {
|
test("should replace children with a fragment", () {
|
||||||
var fragment = document.createDocumentFragment();
|
DocumentFragment fragment = document.createDocumentFragment();
|
||||||
var child1 = fragment.appendChild(document.createElement("div"));
|
Element child1 = fragment.appendChild(document.createElement("div"));
|
||||||
var child2 = fragment.appendChild(document.createText(" text "));
|
Node child2 = fragment.appendChild(document.createText(" text "));
|
||||||
var child3 = fragment.appendChild(document.createText(" "));
|
Node child3 = fragment.appendChild(document.createText(" "));
|
||||||
var child4 = fragment.appendChild(document.createElement("div"));
|
Element child4 = fragment.appendChild(document.createElement("div"));
|
||||||
var parent = document.createElement("div");
|
Element parent = document.createElement("div");
|
||||||
var oldChild = parent.appendChild(document.createElement("div"));
|
Element oldChild = parent.appendChild(document.createElement("div"));
|
||||||
var lastChild = parent.appendChild(document.createElement("div"));
|
Element lastChild = parent.appendChild(document.createElement("div"));
|
||||||
oldChild.replaceWith([fragment]);
|
oldChild.replaceWith(<Node>[fragment]);
|
||||||
expect(child1.parentNode, equals(parent));
|
expect(child1.parentNode, equals(parent));
|
||||||
expect(child2.parentNode, equals(parent));
|
expect(child2.parentNode, equals(parent));
|
||||||
expect(child3.parentNode, equals(parent));
|
expect(child3.parentNode, equals(parent));
|
||||||
|
@ -66,4 +66,176 @@ void main() {
|
|||||||
expect(secondAcceptRan, isFalse);
|
expect(secondAcceptRan, isFalse);
|
||||||
expect(secondRejectRan, isTrue);
|
expect(secondRejectRan, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Should win by sweep', () {
|
||||||
|
GestureArena arena = new GestureArena();
|
||||||
|
|
||||||
|
int primaryKey = 4;
|
||||||
|
bool firstAcceptRan = false;
|
||||||
|
bool firstRejectRan = false;
|
||||||
|
bool secondAcceptRan = false;
|
||||||
|
bool secondRejectRan = false;
|
||||||
|
|
||||||
|
TestGestureArenaMember first = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
TestGestureArenaMember second = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
arena.add(primaryKey, first);
|
||||||
|
arena.add(primaryKey, second);
|
||||||
|
arena.close(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.sweep(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isTrue);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isTrue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should win on release after hold sweep release', () {
|
||||||
|
GestureArena arena = new GestureArena();
|
||||||
|
|
||||||
|
int primaryKey = 4;
|
||||||
|
bool firstAcceptRan = false;
|
||||||
|
bool firstRejectRan = false;
|
||||||
|
bool secondAcceptRan = false;
|
||||||
|
bool secondRejectRan = false;
|
||||||
|
|
||||||
|
TestGestureArenaMember first = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
TestGestureArenaMember second = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
arena.add(primaryKey, first);
|
||||||
|
arena.add(primaryKey, second);
|
||||||
|
arena.close(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.hold(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.sweep(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.release(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isTrue);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isTrue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should win on sweep after hold release sweep', () {
|
||||||
|
GestureArena arena = new GestureArena();
|
||||||
|
|
||||||
|
int primaryKey = 4;
|
||||||
|
bool firstAcceptRan = false;
|
||||||
|
bool firstRejectRan = false;
|
||||||
|
bool secondAcceptRan = false;
|
||||||
|
bool secondRejectRan = false;
|
||||||
|
|
||||||
|
TestGestureArenaMember first = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
firstRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
TestGestureArenaMember second = new TestGestureArenaMember(
|
||||||
|
onAcceptGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondAcceptRan = true;
|
||||||
|
},
|
||||||
|
onRejectGesture: (int key) {
|
||||||
|
expect(key, equals(primaryKey));
|
||||||
|
secondRejectRan = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
arena.add(primaryKey, first);
|
||||||
|
arena.add(primaryKey, second);
|
||||||
|
arena.close(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.hold(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.release(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isFalse);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isFalse);
|
||||||
|
|
||||||
|
arena.sweep(primaryKey);
|
||||||
|
|
||||||
|
expect(firstAcceptRan, isTrue);
|
||||||
|
expect(firstRejectRan, isFalse);
|
||||||
|
expect(secondAcceptRan, isFalse);
|
||||||
|
expect(secondRejectRan, isTrue);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ void main() {
|
|||||||
longPressRecognized = true;
|
longPressRecognized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
new FakeAsync().run((async) {
|
new FakeAsync().run((FakeAsync async) {
|
||||||
longPress.addPointer(down);
|
longPress.addPointer(down);
|
||||||
GestureArena.instance.close(5);
|
GestureArena.instance.close(5);
|
||||||
expect(longPressRecognized, isFalse);
|
expect(longPressRecognized, isFalse);
|
||||||
@ -50,7 +50,7 @@ void main() {
|
|||||||
longPressRecognized = true;
|
longPressRecognized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
new FakeAsync().run((async) {
|
new FakeAsync().run((FakeAsync async) {
|
||||||
longPress.addPointer(down);
|
longPress.addPointer(down);
|
||||||
GestureArena.instance.close(5);
|
GestureArena.instance.close(5);
|
||||||
expect(longPressRecognized, isFalse);
|
expect(longPressRecognized, isFalse);
|
||||||
@ -82,7 +82,7 @@ void main() {
|
|||||||
longPressRecognized = true;
|
longPressRecognized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
new FakeAsync().run((async) {
|
new FakeAsync().run((FakeAsync async) {
|
||||||
showPress.addPointer(down);
|
showPress.addPointer(down);
|
||||||
longPress.addPointer(down);
|
longPress.addPointer(down);
|
||||||
GestureArena.instance.close(5);
|
GestureArena.instance.close(5);
|
||||||
|
@ -26,7 +26,7 @@ void main() {
|
|||||||
showPressRecognized = true;
|
showPressRecognized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
new FakeAsync().run((async) {
|
new FakeAsync().run((FakeAsync async) {
|
||||||
showPress.addPointer(down);
|
showPress.addPointer(down);
|
||||||
GestureArena.instance.close(5);
|
GestureArena.instance.close(5);
|
||||||
expect(showPressRecognized, isFalse);
|
expect(showPressRecognized, isFalse);
|
||||||
@ -48,7 +48,7 @@ void main() {
|
|||||||
showPressRecognized = true;
|
showPressRecognized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
new FakeAsync().run((async) {
|
new FakeAsync().run((FakeAsync async) {
|
||||||
showPress.addPointer(down);
|
showPress.addPointer(down);
|
||||||
GestureArena.instance.close(5);
|
GestureArena.instance.close(5);
|
||||||
expect(showPressRecognized, isFalse);
|
expect(showPressRecognized, isFalse);
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
backgroundColor: const Color(0xFF00FF00),
|
backgroundColor: const Color(0xFF00FF00),
|
||||||
gradient: new RadialGradient(
|
gradient: new RadialGradient(
|
||||||
center: Point.origin, radius: 500.0,
|
center: Point.origin, radius: 500.0,
|
||||||
colors: [Colors.yellow[500], Colors.blue[500]]),
|
colors: <Color>[Colors.yellow[500], Colors.blue[500]]),
|
||||||
boxShadow: shadows[3])
|
boxShadow: shadows[3])
|
||||||
);
|
);
|
||||||
layout(root);
|
layout(root);
|
||||||
@ -34,7 +34,7 @@ void main() {
|
|||||||
child: inner
|
child: inner
|
||||||
);
|
);
|
||||||
RenderBox flex = new RenderFlex(
|
RenderBox flex = new RenderFlex(
|
||||||
children: [padding],
|
children: <RenderBox>[padding],
|
||||||
direction: FlexDirection.vertical,
|
direction: FlexDirection.vertical,
|
||||||
alignItems: FlexAlignItems.stretch
|
alignItems: FlexAlignItems.stretch
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@ import 'rendering_tester.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
test('Overconstrained flex', () {
|
test('Overconstrained flex', () {
|
||||||
RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration());
|
RenderDecoratedBox box = new RenderDecoratedBox(decoration: new BoxDecoration());
|
||||||
RenderFlex flex = new RenderFlex(children: [ box ]);
|
RenderFlex flex = new RenderFlex(children: <RenderBox>[box]);
|
||||||
layout(flex, constraints: const BoxConstraints(
|
layout(flex, constraints: const BoxConstraints(
|
||||||
minWidth: 200.0, maxWidth: 100.0, minHeight: 200.0, maxHeight: 100.0)
|
minWidth: 200.0, maxWidth: 100.0, minHeight: 200.0, maxHeight: 100.0)
|
||||||
);
|
);
|
||||||
@ -24,7 +24,7 @@ void main() {
|
|||||||
test('Parent data', () {
|
test('Parent data', () {
|
||||||
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
RenderDecoratedBox box1 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
||||||
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
||||||
RenderFlex flex = new RenderFlex(children: [ box1, box2 ]);
|
RenderFlex flex = new RenderFlex(children: <RenderBox>[box1, box2]);
|
||||||
layout(flex, constraints: const BoxConstraints(
|
layout(flex, constraints: const BoxConstraints(
|
||||||
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
|
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
|
||||||
);
|
);
|
||||||
@ -33,7 +33,8 @@ void main() {
|
|||||||
expect(box2.size.width, equals(0.0));
|
expect(box2.size.width, equals(0.0));
|
||||||
expect(box2.size.height, equals(0.0));
|
expect(box2.size.height, equals(0.0));
|
||||||
|
|
||||||
box2.parentData.flex = 1;
|
final FlexParentData box2ParentData = box2.parentData;
|
||||||
|
box2ParentData.flex = 1;
|
||||||
flex.markNeedsLayout();
|
flex.markNeedsLayout();
|
||||||
pumpFrame();
|
pumpFrame();
|
||||||
expect(box1.size.width, equals(0.0));
|
expect(box1.size.width, equals(0.0));
|
||||||
@ -47,8 +48,9 @@ void main() {
|
|||||||
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
RenderDecoratedBox box2 = new RenderDecoratedBox(decoration: new BoxDecoration());
|
||||||
RenderFlex flex = new RenderFlex();
|
RenderFlex flex = new RenderFlex();
|
||||||
flex.setupParentData(box2);
|
flex.setupParentData(box2);
|
||||||
box2.parentData.flex = 2;
|
final FlexParentData box2ParentData = box2.parentData;
|
||||||
flex.addAll([box1, box2]);
|
box2ParentData.flex = 2;
|
||||||
|
flex.addAll(<RenderBox>[box1, box2]);
|
||||||
layout(flex, constraints: const BoxConstraints(
|
layout(flex, constraints: const BoxConstraints(
|
||||||
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
|
minWidth: 0.0, maxWidth: 100.0, minHeight: 0.0, maxHeight: 100.0)
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ import 'rendering_tester.dart';
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('Basic grid layout test', () {
|
test('Basic grid layout test', () {
|
||||||
List<RenderBox> children = [
|
List<RenderBox> children = <RenderBox>[
|
||||||
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
||||||
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
||||||
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
new RenderDecoratedBox(decoration: new BoxDecoration()),
|
||||||
@ -15,7 +15,7 @@ void main() {
|
|||||||
RenderGrid grid = new RenderGrid(children: children, maxChildExtent: 100.0);
|
RenderGrid grid = new RenderGrid(children: children, maxChildExtent: 100.0);
|
||||||
layout(grid, constraints: const BoxConstraints(maxWidth: 200.0));
|
layout(grid, constraints: const BoxConstraints(maxWidth: 200.0));
|
||||||
|
|
||||||
children.forEach((child) {
|
children.forEach((RenderBox child) {
|
||||||
expect(child.size.width, equals(100.0), reason: "child width");
|
expect(child.size.width, equals(100.0), reason: "child width");
|
||||||
expect(child.size.height, equals(100.0), reason: "child height");
|
expect(child.size.height, equals(100.0), reason: "child height");
|
||||||
});
|
});
|
||||||
@ -29,7 +29,7 @@ void main() {
|
|||||||
|
|
||||||
pumpFrame();
|
pumpFrame();
|
||||||
|
|
||||||
children.forEach((child) {
|
children.forEach((RenderBox child) {
|
||||||
expect(child.size.width, equals(50.0), reason: "child width");
|
expect(child.size.width, equals(50.0), reason: "child width");
|
||||||
expect(child.size.height, equals(50.0), reason: "child height");
|
expect(child.size.height, equals(50.0), reason: "child height");
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ void main() {
|
|||||||
backgroundColor: const Color(0xFFFF0000)
|
backgroundColor: const Color(0xFFFF0000)
|
||||||
));
|
));
|
||||||
|
|
||||||
RenderBox stack = new RenderStack(children: [red, green]);
|
RenderBox stack = new RenderStack(children: <RenderBox>[red, green]);
|
||||||
(green.parentData as StackParentData)
|
(green.parentData as StackParentData)
|
||||||
..top = 0.0
|
..top = 0.0
|
||||||
..right = 0.0
|
..right = 0.0
|
||||||
|
@ -10,7 +10,7 @@ void main() {
|
|||||||
test('Cannot scroll a non-overflowing block', () {
|
test('Cannot scroll a non-overflowing block', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Block([
|
new Block(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
height: 200.0, // less than 600, the height of the test area
|
height: 200.0, // less than 600, the height of the test area
|
||||||
child: new Text('Hello')
|
child: new Text('Hello')
|
||||||
@ -37,7 +37,7 @@ void main() {
|
|||||||
test('Can scroll an overflowing block', () {
|
test('Can scroll an overflowing block', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Block([
|
new Block(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
height: 2000.0, // more than 600, the height of the test area
|
height: 2000.0, // more than 600, the height of the test area
|
||||||
child: new Text('Hello')
|
child: new Text('Hello')
|
||||||
|
@ -6,7 +6,7 @@ import 'widget_tester.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
test('Can be placed in an infinte box', () {
|
test('Can be placed in an infinte box', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new Block([new Center()]));
|
tester.pumpWidget(new Block(<Widget>[new Center()]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
Key keyB = new GlobalKey();
|
Key keyB = new GlobalKey();
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 100.0,
|
top: 100.0,
|
||||||
left: 100.0,
|
left: 100.0,
|
||||||
|
@ -8,7 +8,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
DateTime currentValue;
|
DateTime currentValue;
|
||||||
|
|
||||||
Widget widget = new Block([
|
Widget widget = new Block(<Widget>[
|
||||||
new DatePicker(
|
new DatePicker(
|
||||||
selectedDate: new DateTime.utc(2015, 6, 9, 7, 12),
|
selectedDate: new DateTime.utc(2015, 6, 9, 7, 12),
|
||||||
firstDate: new DateTime.utc(2013),
|
firstDate: new DateTime.utc(2013),
|
||||||
|
@ -8,7 +8,7 @@ import 'widget_tester.dart';
|
|||||||
const double itemExtent = 100.0;
|
const double itemExtent = 100.0;
|
||||||
ScrollDirection scrollDirection = ScrollDirection.vertical;
|
ScrollDirection scrollDirection = ScrollDirection.vertical;
|
||||||
DismissDirection dismissDirection = DismissDirection.horizontal;
|
DismissDirection dismissDirection = DismissDirection.horizontal;
|
||||||
List<int> dismissedItems = [];
|
List<int> dismissedItems = <int>[];
|
||||||
|
|
||||||
void handleOnResized(item) {
|
void handleOnResized(item) {
|
||||||
expect(dismissedItems.contains(item), isFalse);
|
expect(dismissedItems.contains(item), isFalse);
|
||||||
@ -117,7 +117,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.vertical;
|
scrollDirection = ScrollDirection.vertical;
|
||||||
dismissDirection = DismissDirection.horizontal;
|
dismissDirection = DismissDirection.horizontal;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -136,7 +136,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.horizontal;
|
scrollDirection = ScrollDirection.horizontal;
|
||||||
dismissDirection = DismissDirection.vertical;
|
dismissDirection = DismissDirection.vertical;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -155,7 +155,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.vertical;
|
scrollDirection = ScrollDirection.vertical;
|
||||||
dismissDirection = DismissDirection.left;
|
dismissDirection = DismissDirection.left;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -174,7 +174,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.vertical;
|
scrollDirection = ScrollDirection.vertical;
|
||||||
dismissDirection = DismissDirection.right;
|
dismissDirection = DismissDirection.right;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -193,7 +193,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.horizontal;
|
scrollDirection = ScrollDirection.horizontal;
|
||||||
dismissDirection = DismissDirection.up;
|
dismissDirection = DismissDirection.up;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -212,7 +212,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.horizontal;
|
scrollDirection = ScrollDirection.horizontal;
|
||||||
dismissDirection = DismissDirection.down;
|
dismissDirection = DismissDirection.down;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
expect(dismissedItems, isEmpty);
|
expect(dismissedItems, isEmpty);
|
||||||
@ -233,7 +233,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
scrollDirection = ScrollDirection.horizontal;
|
scrollDirection = ScrollDirection.horizontal;
|
||||||
dismissDirection = DismissDirection.down;
|
dismissDirection = DismissDirection.down;
|
||||||
dismissedItems = [];
|
dismissedItems = <int>[];
|
||||||
|
|
||||||
tester.pumpWidget(widgetBuilder());
|
tester.pumpWidget(widgetBuilder());
|
||||||
Element itemElement = tester.findText('0');
|
Element itemElement = tester.findText('0');
|
||||||
@ -261,7 +261,7 @@ void main() {
|
|||||||
child: new Container(
|
child: new Container(
|
||||||
width: 100.0,
|
width: 100.0,
|
||||||
height: 1000.0,
|
height: 1000.0,
|
||||||
child: new Column([
|
child: new Column(<Widget>[
|
||||||
new Test1215DismissableComponent('1'),
|
new Test1215DismissableComponent('1'),
|
||||||
new Test1215DismissableComponent('2')
|
new Test1215DismissableComponent('2')
|
||||||
])
|
])
|
||||||
|
@ -12,8 +12,8 @@ void main() {
|
|||||||
List accepted = [];
|
List accepted = [];
|
||||||
|
|
||||||
tester.pumpWidget(new Navigator(
|
tester.pumpWidget(new Navigator(
|
||||||
routes: {
|
routes: <String, RouteBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column([
|
'/': (RouteArguments args) { return new Column(<Widget>[
|
||||||
new Draggable(
|
new Draggable(
|
||||||
navigator: args.navigator,
|
navigator: args.navigator,
|
||||||
data: 1,
|
data: 1,
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
NavigatorState navigator;
|
NavigatorState navigator;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
routes: {
|
routes: <String, RouteBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (RouteArguments args) {
|
||||||
navigator = args.navigator;
|
navigator = args.navigator;
|
||||||
new Container();
|
new Container();
|
||||||
@ -40,7 +40,7 @@ void main() {
|
|||||||
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
routes: {
|
routes: <String, RouteBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (RouteArguments args) {
|
||||||
navigator = args.navigator;
|
navigator = args.navigator;
|
||||||
new Container();
|
new Container();
|
||||||
|
@ -8,7 +8,7 @@ class Item {
|
|||||||
GlobalKey key2 = new GlobalKey();
|
GlobalKey key2 = new GlobalKey();
|
||||||
String toString() => "Item($key1, $key2)";
|
String toString() => "Item($key1, $key2)";
|
||||||
}
|
}
|
||||||
List<Item> items = [new Item(), new Item()];
|
List<Item> items = <Item>[new Item(), new Item()];
|
||||||
|
|
||||||
class StatefulLeaf extends StatefulComponent {
|
class StatefulLeaf extends StatefulComponent {
|
||||||
StatefulLeaf({ GlobalKey key }) : super(key: key);
|
StatefulLeaf({ GlobalKey key }) : super(key: key);
|
||||||
@ -34,7 +34,7 @@ class KeyedWrapper extends StatelessComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget builder() {
|
Widget builder() {
|
||||||
return new Column([
|
return new Column(<Widget>[
|
||||||
new KeyedWrapper(items[1].key1, items[1].key2),
|
new KeyedWrapper(items[1].key1, items[1].key2),
|
||||||
new KeyedWrapper(items[0].key1, items[0].key2)
|
new KeyedWrapper(items[0].key1, items[0].key2)
|
||||||
]);
|
]);
|
||||||
|
@ -12,11 +12,11 @@ void main() {
|
|||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
backgroundColor: const Color(0xFF00FF00)
|
backgroundColor: const Color(0xFF00FF00)
|
||||||
),
|
),
|
||||||
child: new Stack([
|
child: new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 10.0,
|
top: 10.0,
|
||||||
left: 10.0,
|
left: 10.0,
|
||||||
child: new Column([
|
child: new Column(<Widget>[
|
||||||
new GestureDetector(
|
new GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
didReceiveTap = true;
|
didReceiveTap = true;
|
||||||
|
@ -23,7 +23,7 @@ void main() {
|
|||||||
GlobalKey keyB = new GlobalKey();
|
GlobalKey keyB = new GlobalKey();
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Focus(
|
new Focus(
|
||||||
child: new Column([
|
child: new Column(<Widget>[
|
||||||
// reverse these when you fix https://github.com/flutter/engine/issues/1495
|
// reverse these when you fix https://github.com/flutter/engine/issues/1495
|
||||||
new TestFocusable('b', 'B FOCUSED', keyB),
|
new TestFocusable('b', 'B FOCUSED', keyB),
|
||||||
new TestFocusable('a', 'A FOCUSED', keyA),
|
new TestFocusable('a', 'A FOCUSED', keyA),
|
||||||
|
@ -36,7 +36,7 @@ void main() {
|
|||||||
|
|
||||||
tester.pumpWidget(builder());
|
tester.pumpWidget(builder());
|
||||||
|
|
||||||
StatefulComponentElement element = tester.findElement((element) => element.widget is FlipComponent);
|
StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
|
||||||
FlipComponentState testComponent = element.state;
|
FlipComponentState testComponent = element.state;
|
||||||
|
|
||||||
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
|
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
|
||||||
|
@ -37,7 +37,7 @@ void main() {
|
|||||||
child: new Input(
|
child: new Input(
|
||||||
key: inputKey,
|
key: inputKey,
|
||||||
placeholder: 'Placeholder',
|
placeholder: 'Placeholder',
|
||||||
onChanged: (value) { inputValue = value; }
|
onChanged: (String value) { inputValue = value; }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void main() {
|
|||||||
|
|
||||||
tester.pumpWidget(builder());
|
tester.pumpWidget(builder());
|
||||||
|
|
||||||
StatefulComponentElement element = tester.findElement((element) => element.widget is FlipComponent);
|
StatefulComponentElement element = tester.findElement((Element element) => element.widget is FlipComponent);
|
||||||
FlipComponentState testComponent = element.state;
|
FlipComponentState testComponent = element.state;
|
||||||
|
|
||||||
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
|
expect(callbackTracker, equals([0, 1, 2, 3, 4, 5]));
|
||||||
|
@ -7,7 +7,7 @@ import 'widget_tester.dart';
|
|||||||
|
|
||||||
void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
|
void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
|
||||||
MultiChildRenderObjectElement element =
|
MultiChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is MultiChildRenderObjectElement);
|
tester.findElement((Element element) => element is MultiChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderStack, isTrue);
|
expect(element.renderObject is RenderStack, isTrue);
|
||||||
RenderStack renderObject = element.renderObject;
|
RenderStack renderObject = element.renderObject;
|
||||||
@ -17,7 +17,8 @@ void checkTree(WidgetTester tester, List<BoxDecoration> expectedDecorations) {
|
|||||||
expect(child is RenderDecoratedBox, isTrue);
|
expect(child is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox decoratedBox = child;
|
RenderDecoratedBox decoratedBox = child;
|
||||||
expect(decoratedBox.decoration, equals(decoration));
|
expect(decoratedBox.decoration, equals(decoration));
|
||||||
child = decoratedBox.parentData.nextSibling;
|
final StackParentData decoratedBoxParentData = decoratedBox.parentData;
|
||||||
|
child = decoratedBoxParentData.nextSibling;
|
||||||
}
|
}
|
||||||
expect(child, isNull);
|
expect(child, isNull);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -31,67 +32,67 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(decoration: kBoxDecorationB),
|
new DecoratedBox(decoration: kBoxDecorationB),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
|
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationC, kBoxDecorationA]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC, kBoxDecorationA]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
|
new DecoratedBox(key: new Key('a'), decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
new DecoratedBox(key: new Key('b'), decoration: kBoxDecorationB),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationC, kBoxDecorationB]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC, kBoxDecorationB]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([])
|
new Stack(<Widget>[])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, []);
|
checkTree(tester, <BoxDecoration>[]);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -100,17 +101,17 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(decoration: kBoxDecorationB),
|
new DecoratedBox(decoration: kBoxDecorationB),
|
||||||
new DecoratedBox(decoration: kBoxDecorationC),
|
new DecoratedBox(decoration: kBoxDecorationC),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new Container(
|
new Container(
|
||||||
child: new DecoratedBox(decoration: kBoxDecorationB)
|
child: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
@ -119,10 +120,10 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new Container(
|
new Container(
|
||||||
child: new Container(
|
child: new Container(
|
||||||
@ -133,10 +134,10 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
child: new Container(
|
child: new Container(
|
||||||
child: new DecoratedBox(decoration: kBoxDecorationB)
|
child: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
@ -149,10 +150,10 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
child: new DecoratedBox(decoration: kBoxDecorationB)
|
child: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
),
|
),
|
||||||
@ -163,10 +164,10 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
key: new Key('b'),
|
key: new Key('b'),
|
||||||
child: new DecoratedBox(decoration: kBoxDecorationB)
|
child: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
@ -178,10 +179,10 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationA]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationA]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
key: new Key('a'),
|
key: new Key('a'),
|
||||||
child: new DecoratedBox(decoration: kBoxDecorationA)
|
child: new DecoratedBox(decoration: kBoxDecorationA)
|
||||||
@ -193,29 +194,29 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([ ])
|
new Stack(<Widget>[])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, []);
|
checkTree(tester, <BoxDecoration>[]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('MultiChildRenderObjectElement with stateful components', () {
|
test('MultiChildRenderObjectElement with stateful components', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new DecoratedBox(decoration: kBoxDecorationB),
|
new DecoratedBox(decoration: kBoxDecorationB),
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationB]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationB]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new FlipComponent(
|
new FlipComponent(
|
||||||
left: new DecoratedBox(decoration: kBoxDecorationA),
|
left: new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
right: new DecoratedBox(decoration: kBoxDecorationB)
|
right: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
@ -224,15 +225,15 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA, kBoxDecorationC]);
|
||||||
|
|
||||||
flipStatefulComponent(tester);
|
flipStatefulComponent(tester);
|
||||||
tester.pump();
|
tester.pump();
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new FlipComponent(
|
new FlipComponent(
|
||||||
left: new DecoratedBox(decoration: kBoxDecorationA),
|
left: new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
right: new DecoratedBox(decoration: kBoxDecorationB)
|
right: new DecoratedBox(decoration: kBoxDecorationB)
|
||||||
@ -240,15 +241,15 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB]);
|
||||||
|
|
||||||
flipStatefulComponent(tester);
|
flipStatefulComponent(tester);
|
||||||
tester.pump();
|
tester.pump();
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationA]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationA]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new FlipComponent(
|
new FlipComponent(
|
||||||
key: new Key('flip'),
|
key: new Key('flip'),
|
||||||
left: new DecoratedBox(decoration: kBoxDecorationA),
|
left: new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
@ -258,7 +259,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
|
new DecoratedBox(key: new Key('c'), decoration: kBoxDecorationC),
|
||||||
new FlipComponent(
|
new FlipComponent(
|
||||||
key: new Key('flip'),
|
key: new Key('flip'),
|
||||||
@ -268,15 +269,15 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationC, kBoxDecorationA]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationA]);
|
||||||
|
|
||||||
flipStatefulComponent(tester);
|
flipStatefulComponent(tester);
|
||||||
tester.pump();
|
tester.pump();
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationC, kBoxDecorationB]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationC, kBoxDecorationB]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new FlipComponent(
|
new FlipComponent(
|
||||||
key: new Key('flip'),
|
key: new Key('flip'),
|
||||||
left: new DecoratedBox(decoration: kBoxDecorationA),
|
left: new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
@ -286,7 +287,7 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [kBoxDecorationB, kBoxDecorationC]);
|
checkTree(tester, <BoxDecoration>[kBoxDecorationB, kBoxDecorationC]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class TestParentData {
|
|||||||
|
|
||||||
void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
|
void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
|
||||||
MultiChildRenderObjectElement element =
|
MultiChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is MultiChildRenderObjectElement);
|
tester.findElement((Element element) => element is MultiChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderStack, isTrue);
|
expect(element.renderObject is RenderStack, isTrue);
|
||||||
RenderStack renderObject = element.renderObject;
|
RenderStack renderObject = element.renderObject;
|
||||||
@ -31,7 +31,7 @@ void checkTree(WidgetTester tester, List<TestParentData> expectedParentData) {
|
|||||||
expect(parentData.right, equals(expected.right));
|
expect(parentData.right, equals(expected.right));
|
||||||
expect(parentData.bottom, equals(expected.bottom));
|
expect(parentData.bottom, equals(expected.bottom));
|
||||||
expect(parentData.left, equals(expected.left));
|
expect(parentData.left, equals(expected.left));
|
||||||
child = decoratedBox.parentData.nextSibling;
|
child = (decoratedBox.parentData as StackParentData).nextSibling;
|
||||||
}
|
}
|
||||||
expect(child, isNull);
|
expect(child, isNull);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -61,7 +61,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new DecoratedBox(decoration: kBoxDecorationA),
|
new DecoratedBox(decoration: kBoxDecorationA),
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 10.0,
|
top: 10.0,
|
||||||
@ -72,14 +72,14 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
new TestParentData(top: 10.0, left: 10.0),
|
new TestParentData(top: 10.0, left: 10.0),
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
bottom: 5.0,
|
bottom: 5.0,
|
||||||
right: 7.0,
|
right: 7.0,
|
||||||
@ -94,7 +94,7 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(bottom: 5.0, right: 7.0),
|
new TestParentData(bottom: 5.0, right: 7.0),
|
||||||
new TestParentData(top: 10.0, left: 10.0),
|
new TestParentData(top: 10.0, left: 10.0),
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
@ -105,7 +105,7 @@ void main() {
|
|||||||
DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC);
|
DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
bottom: 5.0,
|
bottom: 5.0,
|
||||||
right: 7.0,
|
right: 7.0,
|
||||||
@ -120,14 +120,14 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(bottom: 5.0, right: 7.0),
|
new TestParentData(bottom: 5.0, right: 7.0),
|
||||||
new TestParentData(top: 10.0, left: 10.0),
|
new TestParentData(top: 10.0, left: 10.0),
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
bottom: 6.0,
|
bottom: 6.0,
|
||||||
right: 8.0,
|
right: 8.0,
|
||||||
@ -142,14 +142,14 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(bottom: 6.0, right: 8.0),
|
new TestParentData(bottom: 6.0, right: 8.0),
|
||||||
new TestParentData(left: 10.0, right: 10.0),
|
new TestParentData(left: 10.0, right: 10.0),
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
kDecoratedBoxA,
|
kDecoratedBoxA,
|
||||||
new Positioned(
|
new Positioned(
|
||||||
left: 11.0,
|
left: 11.0,
|
||||||
@ -160,14 +160,14 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
new TestParentData(left: 11.0, right: 12.0),
|
new TestParentData(left: 11.0, right: 12.0),
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
kDecoratedBoxA,
|
kDecoratedBoxA,
|
||||||
new Positioned(
|
new Positioned(
|
||||||
right: 10.0,
|
right: 10.0,
|
||||||
@ -182,14 +182,14 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
kNonPositioned,
|
kNonPositioned,
|
||||||
new TestParentData(right: 10.0),
|
new TestParentData(right: 10.0),
|
||||||
new TestParentData(top: 8.0),
|
new TestParentData(top: 8.0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
right: 10.0,
|
right: 10.0,
|
||||||
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
|
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
|
||||||
@ -197,19 +197,19 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(right: 10.0),
|
new TestParentData(right: 10.0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
flipStatefulComponent(tester);
|
flipStatefulComponent(tester);
|
||||||
tester.pump();
|
tester.pump();
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(right: 10.0),
|
new TestParentData(right: 10.0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 7.0,
|
top: 7.0,
|
||||||
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
|
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
|
||||||
@ -217,22 +217,22 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(top: 7.0),
|
new TestParentData(top: 7.0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
flipStatefulComponent(tester);
|
flipStatefulComponent(tester);
|
||||||
tester.pump();
|
tester.pump();
|
||||||
|
|
||||||
checkTree(tester, [
|
checkTree(tester, <TestParentData>[
|
||||||
new TestParentData(top: 7.0),
|
new TestParentData(top: 7.0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([])
|
new Stack(<Widget>[])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, []);
|
checkTree(tester, <TestParentData>[]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ void main() {
|
|||||||
expect(cachedException, isNull);
|
expect(cachedException, isNull);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 5.0,
|
top: 5.0,
|
||||||
bottom: 8.0,
|
bottom: 8.0,
|
||||||
@ -257,14 +257,14 @@ void main() {
|
|||||||
expect(cachedException, isNotNull);
|
expect(cachedException, isNotNull);
|
||||||
cachedException = null;
|
cachedException = null;
|
||||||
|
|
||||||
tester.pumpWidget(new Stack([]));
|
tester.pumpWidget(new Stack(<Widget>[]));
|
||||||
|
|
||||||
checkTree(tester, []);
|
checkTree(tester, <TestParentData>[]);
|
||||||
expect(cachedException, isNull);
|
expect(cachedException, isNull);
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Container(
|
new Container(
|
||||||
child: new Flex([
|
child: new Flex(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 6.0,
|
top: 6.0,
|
||||||
left: 7.0,
|
left: 7.0,
|
||||||
@ -278,10 +278,10 @@ void main() {
|
|||||||
cachedException = null;
|
cachedException = null;
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([])
|
new Stack(<Widget>[])
|
||||||
);
|
);
|
||||||
|
|
||||||
checkTree(tester, []);
|
checkTree(tester, <TestParentData>[]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@ import 'widget_tester.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
test('LinearProgressIndicator changes when its value changes', () {
|
test('LinearProgressIndicator changes when its value changes', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new Block([new LinearProgressIndicator(value: 0.0)]));
|
tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.0)]));
|
||||||
|
|
||||||
List<Layer> layers1 = tester.layers;
|
List<Layer> layers1 = tester.layers;
|
||||||
|
|
||||||
tester.pumpWidget(new Block([new LinearProgressIndicator(value: 0.5)]));
|
tester.pumpWidget(new Block(<Widget>[new LinearProgressIndicator(value: 0.5)]));
|
||||||
|
|
||||||
List<Layer> layers2 = tester.layers;
|
List<Layer> layers2 = tester.layers;
|
||||||
expect(layers1, isNot(equals(layers2)));
|
expect(layers1, isNot(equals(layers2)));
|
||||||
|
@ -19,7 +19,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA));
|
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationA));
|
||||||
OneChildRenderObjectElement element =
|
OneChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox renderObject = element.renderObject;
|
RenderDecoratedBox renderObject = element.renderObject;
|
||||||
@ -27,7 +27,7 @@ void main() {
|
|||||||
expect(renderObject.position, equals(BoxDecorationPosition.background));
|
expect(renderObject.position, equals(BoxDecorationPosition.background));
|
||||||
|
|
||||||
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB));
|
tester.pumpWidget(new DecoratedBox(decoration: kBoxDecorationB));
|
||||||
element = tester.findElement((element) => element is OneChildRenderObjectElement);
|
element = tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
renderObject = element.renderObject;
|
renderObject = element.renderObject;
|
||||||
@ -41,7 +41,7 @@ void main() {
|
|||||||
|
|
||||||
void checkFullTree() {
|
void checkFullTree() {
|
||||||
OneChildRenderObjectElement element =
|
OneChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox renderObject = element.renderObject;
|
RenderDecoratedBox renderObject = element.renderObject;
|
||||||
@ -57,7 +57,7 @@ void main() {
|
|||||||
|
|
||||||
void childBareTree() {
|
void childBareTree() {
|
||||||
OneChildRenderObjectElement element =
|
OneChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox renderObject = element.renderObject;
|
RenderDecoratedBox renderObject = element.renderObject;
|
||||||
@ -136,7 +136,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
OneChildRenderObjectElement element =
|
OneChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox parent = element.renderObject;
|
RenderDecoratedBox parent = element.renderObject;
|
||||||
expect(parent.child is RenderDecoratedBox, isTrue);
|
expect(parent.child is RenderDecoratedBox, isTrue);
|
||||||
@ -152,7 +152,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
element =
|
element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
expect(element.renderObject, equals(parent));
|
expect(element.renderObject, equals(parent));
|
||||||
expect(parent.child, isNull);
|
expect(parent.child, isNull);
|
||||||
|
@ -33,7 +33,7 @@ void main() {
|
|||||||
|
|
||||||
StateMarker grandchild = new StateMarker();
|
StateMarker grandchild = new StateMarker();
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
child: new StateMarker(key: left)
|
child: new StateMarker(key: left)
|
||||||
),
|
),
|
||||||
@ -55,7 +55,7 @@ void main() {
|
|||||||
|
|
||||||
StateMarker newGrandchild = new StateMarker();
|
StateMarker newGrandchild = new StateMarker();
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
child: new StateMarker(
|
child: new StateMarker(
|
||||||
key: right,
|
key: right,
|
||||||
@ -101,7 +101,7 @@ void main() {
|
|||||||
(key.currentState as StateMarkerState).marker = "marked";
|
(key.currentState as StateMarkerState).marker = "marked";
|
||||||
|
|
||||||
tester.pumpWidget(new ScrollableList<int>(
|
tester.pumpWidget(new ScrollableList<int>(
|
||||||
items: [0],
|
items: <int>[0],
|
||||||
itemExtent: 100.0,
|
itemExtent: 100.0,
|
||||||
itemBuilder: (BuildContext context, int item) {
|
itemBuilder: (BuildContext context, int item) {
|
||||||
return new Container(
|
return new Container(
|
||||||
|
@ -27,7 +27,7 @@ class ChangerState extends State<Changer> {
|
|||||||
|
|
||||||
void test() { setState(() { _state = true; }); }
|
void test() { setState(() { _state = true; }); }
|
||||||
|
|
||||||
Widget build(BuildContext) => _state ? new Wrapper(config.child) : config.child;
|
Widget build(BuildContext context) => _state ? new Wrapper(config.child) : config.child;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Wrapper extends StatelessComponent {
|
class Wrapper extends StatelessComponent {
|
||||||
|
@ -10,8 +10,8 @@ ui.Shader createShader(Rect bounds) {
|
|||||||
return new LinearGradient(
|
return new LinearGradient(
|
||||||
begin: Point.origin,
|
begin: Point.origin,
|
||||||
end: new Point(0.0, bounds.height),
|
end: new Point(0.0, bounds.height),
|
||||||
colors: [const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
|
colors: <Color>[const Color(0x00FFFFFF), const Color(0xFFFFFFFF)],
|
||||||
stops: [0.1, 0.35]
|
stops: <double>[0.1, 0.35]
|
||||||
)
|
)
|
||||||
.createShader();
|
.createShader();
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ import 'widget_tester.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
test('SizeObserver notices zero size', () {
|
test('SizeObserver notices zero size', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
List results = [];
|
List<Size> results = <Size>[];
|
||||||
tester.pumpWidget(new Center(
|
tester.pumpWidget(new Center(
|
||||||
child: new SizeObserver(
|
child: new SizeObserver(
|
||||||
callback: (size) { results.add(size); },
|
callback: (Size size) { results.add(size); },
|
||||||
child: new Container(width:0.0, height:0.0)
|
child: new Container(width:0.0, height:0.0)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -20,7 +20,7 @@ void main() {
|
|||||||
expect(results, equals([Size.zero]));
|
expect(results, equals([Size.zero]));
|
||||||
tester.pumpWidget(new Center(
|
tester.pumpWidget(new Center(
|
||||||
child: new SizeObserver(
|
child: new SizeObserver(
|
||||||
callback: (size) { results.add(size); },
|
callback: (Size size) { results.add(size); },
|
||||||
child: new Container(width:100.0, height:0.0)
|
child: new Container(width:100.0, height:0.0)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -29,7 +29,7 @@ void main() {
|
|||||||
expect(results, equals([Size.zero, const Size(100.0, 0.0)]));
|
expect(results, equals([Size.zero, const Size(100.0, 0.0)]));
|
||||||
tester.pumpWidget(new Center(
|
tester.pumpWidget(new Center(
|
||||||
child: new SizeObserver(
|
child: new SizeObserver(
|
||||||
callback: (size) { results.add(size); },
|
callback: (Size size) { results.add(size); },
|
||||||
child: new Container(width:0.0, height:0.0)
|
child: new Container(width:0.0, height:0.0)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -38,7 +38,7 @@ void main() {
|
|||||||
expect(results, equals([Size.zero, const Size(100.0, 0.0), Size.zero]));
|
expect(results, equals([Size.zero, const Size(100.0, 0.0), Size.zero]));
|
||||||
tester.pumpWidget(new Center(
|
tester.pumpWidget(new Center(
|
||||||
child: new SizeObserver(
|
child: new SizeObserver(
|
||||||
callback: (size) { results.add(size); },
|
callback: (Size size) { results.add(size); },
|
||||||
child: new Container(width:0.0, height:0.0)
|
child: new Container(width:0.0, height:0.0)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
Key tapTarget = new Key('tap-target');
|
Key tapTarget = new Key('tap-target');
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: {
|
routes: <String, RouteBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (RouteArguments args) {
|
||||||
return new GestureDetector(
|
return new GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -35,7 +35,7 @@ Widget buildFrame() {
|
|||||||
key: scrollableListKey,
|
key: scrollableListKey,
|
||||||
snapOffsetCallback: snapOffsetCallback,
|
snapOffsetCallback: snapOffsetCallback,
|
||||||
scrollDirection: scrollDirection,
|
scrollDirection: scrollDirection,
|
||||||
items: [0, 1, 2, 3, 4, 5, 7, 8, 9],
|
items: <int>[0, 1, 2, 3, 4, 5, 7, 8, 9],
|
||||||
itemBuilder: buildItem,
|
itemBuilder: buildItem,
|
||||||
itemExtent: itemExtent
|
itemExtent: itemExtent
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
@ -6,13 +7,13 @@ import 'widget_tester.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
test('Can construct an empty Stack', () {
|
test('Can construct an empty Stack', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new Stack([]));
|
tester.pumpWidget(new Stack(<Widget>[]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can construct an empty Centered Stack', () {
|
test('Can construct an empty Centered Stack', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new Center(child: new Stack([])));
|
tester.pumpWidget(new Center(child: new Stack(<Widget>[])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ void main() {
|
|||||||
Key key = new Key('container');
|
Key key = new Key('container');
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
left: 10.0,
|
left: 10.0,
|
||||||
child: new Container(
|
child: new Container(
|
||||||
@ -33,14 +34,18 @@ void main() {
|
|||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
Element container = tester.findElementByKey(key);
|
Element container;
|
||||||
expect(container.renderObject.parentData.top, isNull);
|
StackParentData parentData;
|
||||||
expect(container.renderObject.parentData.right, isNull);
|
|
||||||
expect(container.renderObject.parentData.bottom, isNull);
|
container = tester.findElementByKey(key);
|
||||||
expect(container.renderObject.parentData.left, equals(10.0));
|
parentData = container.renderObject.parentData;
|
||||||
|
expect(parentData.top, isNull);
|
||||||
|
expect(parentData.right, isNull);
|
||||||
|
expect(parentData.bottom, isNull);
|
||||||
|
expect(parentData.left, equals(10.0));
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
right: 10.0,
|
right: 10.0,
|
||||||
child: new Container(
|
child: new Container(
|
||||||
@ -53,10 +58,11 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
container = tester.findElementByKey(key);
|
container = tester.findElementByKey(key);
|
||||||
expect(container.renderObject.parentData.top, isNull);
|
parentData = container.renderObject.parentData;
|
||||||
expect(container.renderObject.parentData.right, equals(10.0));
|
expect(parentData.top, isNull);
|
||||||
expect(container.renderObject.parentData.bottom, isNull);
|
expect(parentData.right, equals(10.0));
|
||||||
expect(container.renderObject.parentData.left, isNull);
|
expect(parentData.bottom, isNull);
|
||||||
|
expect(parentData.left, isNull);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,21 +71,24 @@ void main() {
|
|||||||
Key key = new Key('container');
|
Key key = new Key('container');
|
||||||
Container container = new Container(key: key, width: 10.0, height: 10.0);
|
Container container = new Container(key: key, width: 10.0, height: 10.0);
|
||||||
|
|
||||||
tester.pumpWidget(new Stack([ new Positioned(left: 10.0, child: container) ]));
|
tester.pumpWidget(new Stack(<Widget>[ new Positioned(left: 10.0, child: container) ]));
|
||||||
Element containerElement = tester.findElementByKey(key);
|
Element containerElement = tester.findElementByKey(key);
|
||||||
|
|
||||||
expect(containerElement.renderObject.parentData.top, isNull);
|
StackParentData parentData;
|
||||||
expect(containerElement.renderObject.parentData.right, isNull);
|
parentData = containerElement.renderObject.parentData;
|
||||||
expect(containerElement.renderObject.parentData.bottom, isNull);
|
expect(parentData.top, isNull);
|
||||||
expect(containerElement.renderObject.parentData.left, equals(10.0));
|
expect(parentData.right, isNull);
|
||||||
|
expect(parentData.bottom, isNull);
|
||||||
|
expect(parentData.left, equals(10.0));
|
||||||
|
|
||||||
tester.pumpWidget(new Stack([ container ]));
|
tester.pumpWidget(new Stack(<Widget>[ container ]));
|
||||||
containerElement = tester.findElementByKey(key);
|
containerElement = tester.findElementByKey(key);
|
||||||
|
|
||||||
expect(containerElement.renderObject.parentData.top, isNull);
|
parentData = containerElement.renderObject.parentData;
|
||||||
expect(containerElement.renderObject.parentData.right, isNull);
|
expect(parentData.top, isNull);
|
||||||
expect(containerElement.renderObject.parentData.bottom, isNull);
|
expect(parentData.right, isNull);
|
||||||
expect(containerElement.renderObject.parentData.left, isNull);
|
expect(parentData.bottom, isNull);
|
||||||
|
expect(parentData.left, isNull);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -90,7 +99,7 @@ void main() {
|
|||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Center(
|
new Center(
|
||||||
child: new Stack([
|
child: new Stack(<Widget>[
|
||||||
new Container(key: child0Key, width: 20.0, height: 20.0),
|
new Container(key: child0Key, width: 20.0, height: 20.0),
|
||||||
new Container(key: child1Key, width: 10.0, height: 10.0)
|
new Container(key: child1Key, width: 10.0, height: 10.0)
|
||||||
],
|
],
|
||||||
@ -101,22 +110,24 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Element child0 = tester.findElementByKey(child0Key);
|
Element child0 = tester.findElementByKey(child0Key);
|
||||||
expect(child0.renderObject.parentData.position, equals(const Point(0.0, 0.0)));
|
final StackParentData child0RenderObjectParentData = child0.renderObject.parentData;
|
||||||
|
expect(child0RenderObjectParentData.position, equals(const Point(0.0, 0.0)));
|
||||||
|
|
||||||
Element child1 = tester.findElementByKey(child1Key);
|
Element child1 = tester.findElementByKey(child1Key);
|
||||||
expect(child1.renderObject.parentData.position, equals(const Point(5.0, 5.0)));
|
final StackParentData child1RenderObjectParentData = child1.renderObject.parentData;
|
||||||
|
expect(child1RenderObjectParentData.position, equals(const Point(5.0, 5.0)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can construct an empty IndexedStack', () {
|
test('Can construct an empty IndexedStack', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new IndexedStack([]));
|
tester.pumpWidget(new IndexedStack(<Widget>[]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can construct an empty Centered IndexedStack', () {
|
test('Can construct an empty Centered IndexedStack', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
tester.pumpWidget(new Center(child: new IndexedStack([])));
|
tester.pumpWidget(new Center(child: new IndexedStack(<Widget>[])));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -126,9 +137,9 @@ void main() {
|
|||||||
List<int> itemsPainted;
|
List<int> itemsPainted;
|
||||||
|
|
||||||
Widget buildFrame(int index) {
|
Widget buildFrame(int index) {
|
||||||
itemsPainted = [];
|
itemsPainted = <int>[];
|
||||||
List<Widget> items = new List.generate(itemCount, (i) {
|
List<Widget> items = new List<Widget>.generate(itemCount, (i) {
|
||||||
return new CustomPaint(child: new Text('$i'), callback: (_0, _1) { itemsPainted.add(i); });
|
return new CustomPaint(child: new Text('$i'), callback: (_, __) { itemsPainted.add(i); });
|
||||||
});
|
});
|
||||||
return new Center(child: new IndexedStack(items, index: index));
|
return new Center(child: new IndexedStack(items, index: index));
|
||||||
}
|
}
|
||||||
@ -154,8 +165,8 @@ void main() {
|
|||||||
List<int> itemsTapped;
|
List<int> itemsTapped;
|
||||||
|
|
||||||
Widget buildFrame(int index) {
|
Widget buildFrame(int index) {
|
||||||
itemsTapped = [];
|
itemsTapped = <int>[];
|
||||||
List<Widget> items = new List.generate(itemCount, (i) {
|
List<Widget> items = new List<Widget>.generate(itemCount, (i) {
|
||||||
return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); });
|
return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); });
|
||||||
});
|
});
|
||||||
return new Center(child: new IndexedStack(items, key: key, index: index));
|
return new Center(child: new IndexedStack(items, key: key, index: index));
|
||||||
|
@ -11,7 +11,7 @@ void main() {
|
|||||||
|
|
||||||
void checkTree(BoxDecoration expectedDecoration) {
|
void checkTree(BoxDecoration expectedDecoration) {
|
||||||
OneChildRenderObjectElement element =
|
OneChildRenderObjectElement element =
|
||||||
tester.findElement((element) => element is OneChildRenderObjectElement);
|
tester.findElement((Element element) => element is OneChildRenderObjectElement);
|
||||||
expect(element, isNotNull);
|
expect(element, isNotNull);
|
||||||
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
expect(element.renderObject is RenderDecoratedBox, isTrue);
|
||||||
RenderDecoratedBox renderObject = element.renderObject;
|
RenderDecoratedBox renderObject = element.renderObject;
|
||||||
|
@ -112,13 +112,13 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple'));
|
Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple'));
|
||||||
Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana'));
|
Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana'));
|
||||||
tester.pumpWidget(new Column([]));
|
tester.pumpWidget(new Column(<Widget>[]));
|
||||||
|
|
||||||
GlobalKey keyA = new GlobalKey();
|
GlobalKey keyA = new GlobalKey();
|
||||||
GlobalKey keyB = new GlobalKey();
|
GlobalKey keyB = new GlobalKey();
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Column([
|
new Column(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
key: keyA,
|
key: keyA,
|
||||||
child: a
|
child: a
|
||||||
@ -143,7 +143,7 @@ void main() {
|
|||||||
expect(second.syncedState, equals(0x42));
|
expect(second.syncedState, equals(0x42));
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Column([
|
new Column(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
key: keyA,
|
key: keyA,
|
||||||
child: a
|
child: a
|
||||||
@ -170,7 +170,7 @@ void main() {
|
|||||||
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike
|
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike
|
||||||
|
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Column([
|
new Column(<Widget>[
|
||||||
new Container(
|
new Container(
|
||||||
key: keyA,
|
key: keyA,
|
||||||
child: b
|
child: b
|
||||||
|
@ -49,7 +49,7 @@ class TestBuildCounter extends StatelessComponent {
|
|||||||
|
|
||||||
void flipStatefulComponent(WidgetTester tester) {
|
void flipStatefulComponent(WidgetTester tester) {
|
||||||
StatefulComponentElement stateElement =
|
StatefulComponentElement stateElement =
|
||||||
tester.findElement((element) => element is StatefulComponentElement);
|
tester.findElement((Element element) => element is StatefulComponentElement);
|
||||||
expect(stateElement, isNotNull);
|
expect(stateElement, isNotNull);
|
||||||
expect(stateElement.state is FlipComponentState, isTrue);
|
expect(stateElement.state is FlipComponentState, isTrue);
|
||||||
FlipComponentState state = stateElement.state;
|
FlipComponentState state = stateElement.state;
|
||||||
|
@ -8,7 +8,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
bool didReceiveTap = false;
|
bool didReceiveTap = false;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 100.0,
|
top: 100.0,
|
||||||
left: 100.0,
|
left: 100.0,
|
||||||
@ -53,7 +53,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
bool didReceiveTap = false;
|
bool didReceiveTap = false;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 100.0,
|
top: 100.0,
|
||||||
left: 100.0,
|
left: 100.0,
|
||||||
@ -98,7 +98,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
bool didReceiveTap = false;
|
bool didReceiveTap = false;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new Stack([
|
new Stack(<Widget>[
|
||||||
new Positioned(
|
new Positioned(
|
||||||
top: 100.0,
|
top: 100.0,
|
||||||
left: 100.0,
|
left: 100.0,
|
||||||
|
@ -24,11 +24,12 @@ class RootComponentState extends State<RootComponent> {
|
|||||||
Widget build(BuildContext context) => child;
|
Widget build(BuildContext context) => child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef Point SizeToPointFunction(Size size);
|
||||||
|
|
||||||
class WidgetTester {
|
class WidgetTester {
|
||||||
WidgetTester._(FakeAsync async)
|
WidgetTester._(FakeAsync async)
|
||||||
: async = async,
|
: async = async,
|
||||||
clock = async.getClock(new DateTime.utc(2015, 1, 1)) {
|
clock = async.getClock(new DateTime.utc(2015, 1, 1));
|
||||||
}
|
|
||||||
|
|
||||||
final FakeAsync async;
|
final FakeAsync async;
|
||||||
final Clock clock;
|
final Clock clock;
|
||||||
@ -46,7 +47,7 @@ class WidgetTester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Layer> _layers(Layer layer) {
|
List<Layer> _layers(Layer layer) {
|
||||||
List<Layer> result = [layer];
|
List<Layer> result = <Layer>[layer];
|
||||||
if (layer is ContainerLayer) {
|
if (layer is ContainerLayer) {
|
||||||
ContainerLayer root = layer;
|
ContainerLayer root = layer;
|
||||||
Layer child = root.firstChild;
|
Layer child = root.firstChild;
|
||||||
@ -124,7 +125,7 @@ class WidgetTester {
|
|||||||
return _getElementPoint(element, (Size size) => size.bottomRight(Point.origin));
|
return _getElementPoint(element, (Size size) => size.bottomRight(Point.origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
Point _getElementPoint(Element element, Function sizeToPoint) {
|
Point _getElementPoint(Element element, SizeToPointFunction sizeToPoint) {
|
||||||
assert(element != null);
|
assert(element != null);
|
||||||
RenderBox box = element.renderObject as RenderBox;
|
RenderBox box = element.renderObject as RenderBox;
|
||||||
assert(box != null);
|
assert(box != null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user