Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[video_player] Add toString() to Caption #3233

Merged
merged 1 commit into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.11.1+4

* Add `toString()` to `Caption`.

## 0.11.1+3

* Android: Upgrade ExoPlayer to 2.12.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,13 @@ class Caption {
/// The actual text that should appear on screen to be read between [start]
/// and [end].
final String text;

@override
String toString() {
return '$runtimeType('
'number: $number, '
'start: $start, '
'end: $end, '
'text: $text)';
}
}
2 changes: 1 addition & 1 deletion packages/video_player/video_player/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Flutter plugin for displaying inline video with other Flutter
# 0.10.y+z is compatible with 1.0.0, if you land a breaking change bump
# the version to 2.0.0.
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
version: 0.11.1+3
version: 0.11.1+4
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player

flutter:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter_test/flutter_test.dart';
import 'package:video_player/src/closed_caption_file.dart';

void main() {
group('ClosedCaptionFile', () {
test('toString()', () {
final Caption caption = const Caption(
number: 1,
start: Duration(seconds: 1),
end: Duration(seconds: 2),
text: 'caption',
);

expect(
caption.toString(),
'Caption('
'number: 1, '
'start: 0:00:01.000000, '
'end: 0:00:02.000000, '
'text: caption'
')');
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ void main() {
'VideoPlayerValue(duration: 0:00:05.000000, '
'size: Size(400.0, 300.0), '
'position: 0:00:01.000000, '
'caption: Instance of \'Caption\', '
'caption: Caption(number: null, start: null, end: null, text: foo), '
'buffered: [DurationRange(start: 0:00:00.000000, end: 0:00:04.000000)], '
'isPlaying: true, '
'isLooping: true, '
Expand Down