|
|
|
@ -12,60 +12,57 @@ void main() {
|
|
|
|
|
center: Vector2.zero(),
|
|
|
|
|
arcRadius: 10,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: 0,
|
|
|
|
|
),
|
|
|
|
|
isNotNull,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
group('copyWith', () {
|
|
|
|
|
test(
|
|
|
|
|
'copies correctly '
|
|
|
|
|
'when no argument specified', () {
|
|
|
|
|
final arcShape = ArcShape(
|
|
|
|
|
center: Vector2.zero(),
|
|
|
|
|
arcRadius: 10,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: 0,
|
|
|
|
|
);
|
|
|
|
|
final arcShapeCopied = arcShape.copyWith();
|
|
|
|
|
|
|
|
|
|
for (var index = 0; index < arcShape.vertices.length; index++) {
|
|
|
|
|
expect(
|
|
|
|
|
arcShape.vertices[index],
|
|
|
|
|
equals(arcShapeCopied.vertices[index]),
|
|
|
|
|
group('copyWith', () {
|
|
|
|
|
test(
|
|
|
|
|
'copies correctly '
|
|
|
|
|
'when no argument specified', () {
|
|
|
|
|
final arcShape = ArcShape(
|
|
|
|
|
center: Vector2.zero(),
|
|
|
|
|
arcRadius: 10,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
final arcShapeCopied = arcShape.copyWith();
|
|
|
|
|
|
|
|
|
|
test(
|
|
|
|
|
'copies correctly '
|
|
|
|
|
'when all arguments specified', () {
|
|
|
|
|
final arcShapeExpected = ArcShape(
|
|
|
|
|
center: Vector2.all(10),
|
|
|
|
|
arcRadius: 15,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: math.pi,
|
|
|
|
|
);
|
|
|
|
|
final arcShapeCopied = ArcShape(
|
|
|
|
|
center: Vector2.zero(),
|
|
|
|
|
arcRadius: 10,
|
|
|
|
|
angle: math.pi,
|
|
|
|
|
rotation: 0,
|
|
|
|
|
).copyWith(
|
|
|
|
|
center: Vector2.all(10),
|
|
|
|
|
arcRadius: 15,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: math.pi,
|
|
|
|
|
);
|
|
|
|
|
for (var index = 0; index < arcShape.vertices.length; index++) {
|
|
|
|
|
expect(
|
|
|
|
|
arcShape.vertices[index],
|
|
|
|
|
equals(arcShapeCopied.vertices[index]),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (var index = 0; index < arcShapeCopied.vertices.length; index++) {
|
|
|
|
|
expect(
|
|
|
|
|
arcShapeCopied.vertices[index],
|
|
|
|
|
equals(arcShapeExpected.vertices[index]),
|
|
|
|
|
test(
|
|
|
|
|
'copies correctly '
|
|
|
|
|
'when all arguments specified', () {
|
|
|
|
|
final arcShapeExpected = ArcShape(
|
|
|
|
|
center: Vector2.all(10),
|
|
|
|
|
arcRadius: 15,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: math.pi,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
final arcShapeCopied = ArcShape(
|
|
|
|
|
center: Vector2.zero(),
|
|
|
|
|
arcRadius: 10,
|
|
|
|
|
angle: math.pi,
|
|
|
|
|
).copyWith(
|
|
|
|
|
center: Vector2.all(10),
|
|
|
|
|
arcRadius: 15,
|
|
|
|
|
angle: 2 * math.pi,
|
|
|
|
|
rotation: math.pi,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (var index = 0; index < arcShapeCopied.vertices.length; index++) {
|
|
|
|
|
expect(
|
|
|
|
|
arcShapeCopied.vertices[index],
|
|
|
|
|
equals(arcShapeExpected.vertices[index]),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|