@@ -46,6 +46,8 @@ public async Task UpdatesMoveProgress()
46
46
// create
47
47
var source = new SKFileLottieImageSource { File = TrophyJson } ;
48
48
var lottie = new WaitingLottieView { Source = source } ;
49
+ var animationCompleted = 0 ;
50
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
49
51
await lottie . LoadedTask ;
50
52
51
53
// update
@@ -54,6 +56,7 @@ public async Task UpdatesMoveProgress()
54
56
// test
55
57
Assert . Equal ( TimeSpan . FromSeconds ( 1 ) , lottie . Progress ) ;
56
58
Assert . False ( lottie . IsComplete ) ;
59
+ Assert . Equal ( 0 , animationCompleted ) ;
57
60
}
58
61
59
62
[ Fact ]
@@ -62,22 +65,27 @@ public async Task MultipleUpdatesMoveProgressUntilDurationMax()
62
65
// create
63
66
var source = new SKFileLottieImageSource { File = TrophyJson } ;
64
67
var lottie = new WaitingLottieView { Source = source } ;
68
+ var animationCompleted = 0 ;
69
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
65
70
await lottie . LoadedTask ;
66
71
67
72
// update & test
68
73
lottie . CallUpdate ( TimeSpan . FromSeconds ( 1 ) ) ;
69
74
Assert . Equal ( TimeSpan . FromSeconds ( 1 ) , lottie . Progress ) ;
70
75
Assert . False ( lottie . IsComplete ) ;
76
+ Assert . Equal ( 0 , animationCompleted ) ;
71
77
72
78
// update & test
73
79
lottie . CallUpdate ( TimeSpan . FromSeconds ( 1 ) ) ;
74
80
Assert . Equal ( TimeSpan . FromSeconds ( 2 ) , lottie . Progress ) ;
75
81
Assert . False ( lottie . IsComplete ) ;
82
+ Assert . Equal ( 0 , animationCompleted ) ;
76
83
77
84
// update & test
78
85
lottie . CallUpdate ( TimeSpan . FromSeconds ( 1 ) ) ;
79
86
Assert . Equal ( TimeSpan . FromSeconds ( 2.3666665 ) , lottie . Progress ) ;
80
87
Assert . True ( lottie . IsComplete ) ;
88
+ Assert . Equal ( 1 , animationCompleted ) ;
81
89
}
82
90
83
91
[ Fact ]
@@ -86,6 +94,8 @@ public async Task UpdatesLargerThanDurationHasMax()
86
94
// create
87
95
var source = new SKFileLottieImageSource { File = TrophyJson } ;
88
96
var lottie = new WaitingLottieView { Source = source } ;
97
+ var animationCompleted = 0 ;
98
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
89
99
await lottie . LoadedTask ;
90
100
91
101
// update
@@ -94,6 +104,7 @@ public async Task UpdatesLargerThanDurationHasMax()
94
104
// test
95
105
Assert . Equal ( TimeSpan . FromSeconds ( 2.3666665 ) , lottie . Progress ) ;
96
106
Assert . True ( lottie . IsComplete ) ;
107
+ Assert . Equal ( 1 , animationCompleted ) ;
97
108
}
98
109
99
110
[ Fact ]
@@ -102,6 +113,8 @@ public async Task NegativeUpdatesDoesNothing()
102
113
// create
103
114
var source = new SKFileLottieImageSource { File = TrophyJson } ;
104
115
var lottie = new WaitingLottieView { Source = source } ;
116
+ var animationCompleted = 0 ;
117
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
105
118
await lottie . LoadedTask ;
106
119
107
120
// update
@@ -110,6 +123,7 @@ public async Task NegativeUpdatesDoesNothing()
110
123
// test
111
124
Assert . Equal ( TimeSpan . Zero , lottie . Progress ) ;
112
125
Assert . False ( lottie . IsComplete ) ;
126
+ Assert . Equal ( 0 , animationCompleted ) ;
113
127
}
114
128
115
129
[ Fact ]
@@ -118,6 +132,8 @@ public async Task NegativeUpdatesAfterPositiveGoesBack()
118
132
// create
119
133
var source = new SKFileLottieImageSource { File = TrophyJson } ;
120
134
var lottie = new WaitingLottieView { Source = source } ;
135
+ var animationCompleted = 0 ;
136
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
121
137
await lottie . LoadedTask ;
122
138
123
139
// update
@@ -128,6 +144,7 @@ public async Task NegativeUpdatesAfterPositiveGoesBack()
128
144
// test
129
145
Assert . Equal ( TimeSpan . FromSeconds ( 1 ) , lottie . Progress ) ;
130
146
Assert . False ( lottie . IsComplete ) ;
147
+ Assert . Equal ( 0 , animationCompleted ) ;
131
148
}
132
149
133
150
[ Theory ]
@@ -150,6 +167,8 @@ public async Task ReachingTheEndAndThenMoreWithRepeat(SKLottieRepeatMode repeatM
150
167
// create
151
168
var source = new SKFileLottieImageSource { File = TrophyJson } ;
152
169
var lottie = new WaitingLottieView { Source = source , RepeatMode = repeatMode , RepeatCount = - 1 } ;
170
+ var animationCompleted = 0 ;
171
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
153
172
await lottie . LoadedTask ;
154
173
155
174
// update
@@ -159,6 +178,7 @@ public async Task ReachingTheEndAndThenMoreWithRepeat(SKLottieRepeatMode repeatM
159
178
// test
160
179
Assert . Equal ( TimeSpan . FromSeconds ( progress ) , lottie . Progress ) ;
161
180
Assert . False ( lottie . IsComplete ) ;
181
+ Assert . Equal ( 0 , animationCompleted ) ;
162
182
}
163
183
164
184
[ Theory ]
@@ -180,6 +200,8 @@ public async Task ReachingTheEndAndThenMoreWithRepeatModeButZeroCount(SKLottieRe
180
200
// create
181
201
var source = new SKFileLottieImageSource { File = TrophyJson } ;
182
202
var lottie = new WaitingLottieView { Source = source , RepeatMode = repeatMode , RepeatCount = 0 } ;
203
+ var animationCompleted = 0 ;
204
+ lottie . AnimationCompleted += ( s , e ) => animationCompleted ++ ;
183
205
await lottie . LoadedTask ;
184
206
185
207
// update
@@ -189,5 +211,9 @@ public async Task ReachingTheEndAndThenMoreWithRepeatModeButZeroCount(SKLottieRe
189
211
// test
190
212
Assert . Equal ( TimeSpan . FromSeconds ( progress ) , lottie . Progress ) ;
191
213
Assert . Equal ( isComplete , lottie . IsComplete ) ;
214
+ if ( isComplete )
215
+ Assert . Equal ( 1 , animationCompleted ) ;
216
+ else
217
+ Assert . Equal ( 0 , animationCompleted ) ;
192
218
}
193
219
}
0 commit comments