@@ -191,6 +191,32 @@ void main() {
191
191
));
192
192
});
193
193
194
+ test ('LinearGradient lerp test with transforms' , () {
195
+ const LinearGradient testGradient1 = LinearGradient (
196
+ transform: GradientRotation (math.pi/ 4 ),
197
+ colors: < Color > [
198
+ Color (0x33333333 ),
199
+ Color (0x66666666 ),
200
+ ],
201
+ stops: < double > [0 , 1 ],
202
+ );
203
+ const LinearGradient testGradient2 = LinearGradient (
204
+ transform: GradientRotation (math.pi/ 2 ),
205
+ colors: < Color > [
206
+ Color (0x33333333 ),
207
+ Color (0x66666666 ),
208
+ ],
209
+ stops: < double > [0 , 1 ],
210
+ );
211
+
212
+ final LinearGradient ? actual0 = LinearGradient .lerp (testGradient1, testGradient2, 0.0 );
213
+ final LinearGradient ? actual1 = LinearGradient .lerp (testGradient1, testGradient2, 1.0 );
214
+ final LinearGradient ? actual2 = LinearGradient .lerp (testGradient1, testGradient2, 0.5 );
215
+ expect (testGradient1, equals (actual0));
216
+ expect (testGradient2, equals (actual1));
217
+ expect (testGradient2, equals (actual2));
218
+ });
219
+
194
220
test ('LinearGradient toString' , () {
195
221
expect (
196
222
const LinearGradient (
@@ -481,6 +507,32 @@ void main() {
481
507
));
482
508
});
483
509
510
+ test ('RadialGradient lerp test with transforms' , () {
511
+ const RadialGradient testGradient1 = RadialGradient (
512
+ transform: GradientRotation (math.pi/ 4 ),
513
+ colors: < Color > [
514
+ Color (0x33333333 ),
515
+ Color (0x66666666 ),
516
+ ],
517
+ stops: < double > [0 , 1 ],
518
+ );
519
+ const RadialGradient testGradient2 = RadialGradient (
520
+ transform: GradientRotation (math.pi/ 2 ),
521
+ colors: < Color > [
522
+ Color (0x33333333 ),
523
+ Color (0x66666666 ),
524
+ ],
525
+ stops: < double > [0 , 1 ],
526
+ );
527
+
528
+ final RadialGradient ? actual0 = RadialGradient .lerp (testGradient1, testGradient2, 0.0 );
529
+ final RadialGradient ? actual1 = RadialGradient .lerp (testGradient1, testGradient2, 1.0 );
530
+ final RadialGradient ? actual2 = RadialGradient .lerp (testGradient1, testGradient2, 0.5 );
531
+ expect (testGradient1, equals (actual0));
532
+ expect (testGradient2, equals (actual1));
533
+ expect (testGradient2, equals (actual2));
534
+ });
535
+
484
536
test ('RadialGradient lerp test with focal' , () {
485
537
const RadialGradient testGradient1 = RadialGradient (
486
538
center: Alignment .topLeft,
@@ -706,6 +758,32 @@ void main() {
706
758
));
707
759
});
708
760
761
+ test ('SweepGradient lerp test with transforms' , () {
762
+ const SweepGradient testGradient1 = SweepGradient (
763
+ transform: GradientRotation (math.pi/ 4 ),
764
+ colors: < Color > [
765
+ Color (0x33333333 ),
766
+ Color (0x66666666 ),
767
+ ],
768
+ stops: < double > [0 , 1 ],
769
+ );
770
+ const SweepGradient testGradient2 = SweepGradient (
771
+ transform: GradientRotation (math.pi/ 2 ),
772
+ colors: < Color > [
773
+ Color (0x33333333 ),
774
+ Color (0x66666666 ),
775
+ ],
776
+ stops: < double > [0 , 1 ],
777
+ );
778
+
779
+ final SweepGradient ? actual0 = SweepGradient .lerp (testGradient1, testGradient2, 0.0 );
780
+ final SweepGradient ? actual1 = SweepGradient .lerp (testGradient1, testGradient2, 1.0 );
781
+ final SweepGradient ? actual2 = SweepGradient .lerp (testGradient1, testGradient2, 0.5 );
782
+ expect (testGradient1, equals (actual0));
783
+ expect (testGradient2, equals (actual1));
784
+ expect (testGradient2, equals (actual2));
785
+ });
786
+
709
787
test ('SweepGradient scale test)' , () {
710
788
const SweepGradient testGradient = SweepGradient (
711
789
center: Alignment .topLeft,
0 commit comments