treewide: dart format + analyze + some other fixes
This commit is contained in:
@@ -6,16 +6,17 @@ import 'package:kanimaji/svg/path.dart';
|
||||
void main() {
|
||||
group("Examples from the SVG spec", () {
|
||||
test(
|
||||
"[Path 1]: MLLz",
|
||||
() => expect(
|
||||
parsePath("M 100 100 L 300 100 L 200 300 z"),
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(100, 100)),
|
||||
Line(start: Point(100, 100), end: Point(300, 100)),
|
||||
Line(start: Point(300, 100), end: Point(200, 300)),
|
||||
Close(start: Point(200, 300), end: Point(100, 100)),
|
||||
]),
|
||||
));
|
||||
"[Path 1]: MLLz",
|
||||
() => expect(
|
||||
parsePath("M 100 100 L 300 100 L 200 300 z"),
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(100, 100)),
|
||||
Line(start: Point(100, 100), end: Point(300, 100)),
|
||||
Line(start: Point(300, 100), end: Point(200, 300)),
|
||||
Close(start: Point(200, 300), end: Point(100, 100)),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
//
|
||||
test(
|
||||
@@ -160,10 +161,11 @@ void main() {
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(600, 800)),
|
||||
CubicBezier(
|
||||
start: Point(600, 800),
|
||||
control1: Point(625, 700),
|
||||
control2: Point(725, 700),
|
||||
end: Point(750, 800)),
|
||||
start: Point(600, 800),
|
||||
control1: Point(625, 700),
|
||||
control2: Point(725, 700),
|
||||
end: Point(750, 800),
|
||||
),
|
||||
CubicBezier(
|
||||
start: Point(750, 800),
|
||||
control1: Point(775, 900),
|
||||
@@ -347,9 +349,10 @@ void main() {
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(100, 200)),
|
||||
QuadraticBezier(
|
||||
start: Point(100, 200),
|
||||
control: Point(100, 200),
|
||||
end: Point(250, 200)),
|
||||
start: Point(100, 200),
|
||||
control: Point(100, 200),
|
||||
end: Point(250, 200),
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
@@ -361,9 +364,10 @@ void main() {
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(100, 200)),
|
||||
QuadraticBezier(
|
||||
start: Point(100, 200),
|
||||
control: Point(100, 200),
|
||||
end: Point(250, 200)),
|
||||
start: Point(100, 200),
|
||||
control: Point(100, 200),
|
||||
end: Point(250, 200),
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
@@ -382,12 +386,12 @@ void main() {
|
||||
() =>
|
||||
// It can be e or E, the plus is optional, and a minimum of +/-3.4e38 must be supported.
|
||||
expect(
|
||||
parsePath("M-3.4e38 3.4E+38L-3.4E-38,3.4e-38"),
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(-3.4e38, 3.4e38)),
|
||||
Line(start: Point(-3.4e38, 3.4e38), end: Point(-3.4e-38, 3.4e-38))
|
||||
]),
|
||||
),
|
||||
parsePath("M-3.4e38 3.4E+38L-3.4E-38,3.4e-38"),
|
||||
Path.fromSegments(const [
|
||||
Move(to: Point(-3.4e38, 3.4e38)),
|
||||
Line(start: Point(-3.4e38, 3.4e38), end: Point(-3.4e-38, 3.4e-38)),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
||||
test(
|
||||
@@ -405,15 +409,17 @@ void main() {
|
||||
);
|
||||
|
||||
test('svg.path library, issue 45', () {
|
||||
final path = parsePath("m 1672.2372,-54.8161 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3152,23.6652 "
|
||||
"l 27.2573,27.2572 27.2572,-27.2572 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3012,-23.634 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.414,5.4625 "
|
||||
"l -4.542,4.5420 "
|
||||
"l -4.5437,-4.5420 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3984,-5.4937 "
|
||||
"z");
|
||||
final path = parsePath(
|
||||
"m 1672.2372,-54.8161 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3152,23.6652 "
|
||||
"l 27.2573,27.2572 27.2572,-27.2572 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3012,-23.634 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.414,5.4625 "
|
||||
"l -4.542,4.5420 "
|
||||
"l -4.5437,-4.5420 "
|
||||
"a 14.5445,14.5445 0 0 0 -11.3984,-5.4937 "
|
||||
"z",
|
||||
);
|
||||
expect(path.d(), contains("A 14.5445,14.5445 0 0,0 1672.2372,-54.8161 Z"));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user