@@ -224,19 +224,24 @@ void main() {
224
224
FakeVideoPlayerPlatform .registerWith ();
225
225
final platform = FakeVideoPlayerPlatform .instance;
226
226
227
+ /// Find the position shown by the slider, and check the label agrees.
228
+ Duration findSliderPosition (WidgetTester tester) {
229
+ final sliderValue = tester.widget <Slider >(find.byType (Slider )).value;
230
+ final result = Duration (milliseconds: sliderValue.toInt ());
231
+ check (tester.widget <RichText >(
232
+ find.descendant (of: find.bySemanticsLabel ('Current position' ),
233
+ matching: find.byType (RichText ))).text.toPlainText ())
234
+ .equals (VideoDurationLabel .formatDuration (result));
235
+ return result;
236
+ }
237
+
227
238
/// Check the slider and label show position [slider] ,
228
239
/// and the actual position of the video controller is [video] .
229
240
void checkPositions (WidgetTester tester, {
230
241
required Duration slider,
231
242
required Duration video,
232
243
}) {
233
- check (tester.widget <Slider >(find.byType (Slider )).value.toInt ())
234
- .equals (slider.inMilliseconds);
235
- check (tester.widget <RichText >(
236
- find.descendant (of: find.bySemanticsLabel ('Current position' ),
237
- matching: find.byType (RichText ))).text.toPlainText ())
238
- .equals (VideoDurationLabel .formatDuration (slider));
239
-
244
+ check (findSliderPosition (tester)).equals (slider);
240
245
check (platform.position).equals (video);
241
246
}
242
247
0 commit comments