Skip to content

Commit 4f81ef4

Browse files
committed
VorbisComments: Remove track number test files
1 parent 222c3df commit 4f81ef4

File tree

5 files changed

+55
-36
lines changed

5 files changed

+55
-36
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- **ID3v2**: Support parsing UTF-16 `COMM`/`USLT` frames with a single BOM ([issue](https://github.com/Serial-ATA/lofty-rs/issues/532)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/535))
2323
- Some encoders will only write a BOM to the frame's description, rather than to every string in the frame.
2424
This was previously only supported in `SYLT` frames, and has been extended to `COMM` and `USLT`.
25-
- **Vorbis Comments**: Parse `TRACKNUMBER` with respect to `ParseOptions::implicit_conversions` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/540))
25+
- **Vorbis Comments**: Parse `TRACKNUMBER` with respect to `ParseOptions::implicit_conversions` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/540)) ([PR](https://github.com/Serial-ATA/lofty-rs/issues/542))
2626

2727
### Removed
2828

lofty/src/ogg/tag.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,4 +923,58 @@ mod tests {
923923
assert_eq!(tag.pictures().len(), 0); // Artist, no picture
924924
assert!(tag.artist().is_some());
925925
}
926+
927+
// case TRACKNUMBER=01/05 disable implicit_conversions
928+
#[test_log::test]
929+
fn issue_540_disable_implicit_conversions() {
930+
let mut comments = VorbisComments::new();
931+
comments.insert(String::from("TRACKNUMBER"), String::from("01/05"));
932+
933+
let mut comments_bytes = Vec::new();
934+
comments
935+
.dump_to(&mut comments_bytes, WriteOptions::default())
936+
.unwrap();
937+
938+
let mut reader = Cursor::new(&comments_bytes);
939+
let tag = crate::ogg::read::read_comments(
940+
&mut reader,
941+
comments_bytes.len() as u64,
942+
ParseOptions::new()
943+
.parsing_mode(ParsingMode::Strict)
944+
.implicit_conversions(false)
945+
.read_cover_art(false),
946+
)
947+
.unwrap();
948+
949+
assert_eq!(tag.track(), None);
950+
assert_eq!(tag.track_total(), None);
951+
assert_eq!(tag.get("TRACKNUMBER"), Some("01/05"));
952+
}
953+
954+
// case track number and total with leading 0
955+
#[test_log::test]
956+
fn opus_issue_540_leading_0() {
957+
let mut comments = VorbisComments::new();
958+
comments.insert(String::from("TRACKNUMBER"), String::from("01"));
959+
comments.insert(String::from("TRACKTOTAL"), String::from("05"));
960+
961+
let mut comments_bytes = Vec::new();
962+
comments
963+
.dump_to(&mut comments_bytes, WriteOptions::default())
964+
.unwrap();
965+
966+
let mut reader = Cursor::new(&comments_bytes);
967+
let tag = crate::ogg::read::read_comments(
968+
&mut reader,
969+
comments_bytes.len() as u64,
970+
ParseOptions::new()
971+
.parsing_mode(ParsingMode::Strict)
972+
.implicit_conversions(false)
973+
.read_cover_art(false),
974+
)
975+
.unwrap();
976+
977+
assert_eq!(tag.get("TRACKNUMBER"), Some("01"));
978+
assert_eq!(tag.get("TRACKTOTAL"), Some("05"));
979+
}
926980
}
-226 Bytes
Binary file not shown.
-1.26 KB
Binary file not shown.

lofty/tests/files/ogg.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -181,41 +181,6 @@ fn opus_issue_499() {
181181
assert_eq!(comments.track_total(), Some(22));
182182
}
183183

184-
// case TRACKNUMBER=01/05 disable implicit_conversions
185-
#[test_log::test]
186-
fn opus_issue_540_disable_implicit_conversions() {
187-
use lofty::ogg::OpusFile;
188-
189-
let file = std::fs::read("tests/files/assets/issue_540.opus").unwrap();
190-
let opus_file = OpusFile::read_from(
191-
&mut std::io::Cursor::new(file),
192-
ParseOptions::new().implicit_conversions(false),
193-
)
194-
.unwrap();
195-
196-
let comments = opus_file.vorbis_comments();
197-
assert_eq!(comments.track(), None);
198-
assert_eq!(comments.track_total(), None);
199-
assert_eq!(comments.get("TRACKNUMBER"), Some("01/05"));
200-
}
201-
202-
// case track number and total with leading 0
203-
#[test_log::test]
204-
fn opus_issue_540_leading_0() {
205-
use lofty::ogg::OpusFile;
206-
207-
let file = std::fs::read("tests/files/assets/issue_540_leading_0.opus").unwrap();
208-
let opus_file = OpusFile::read_from(
209-
&mut std::io::Cursor::new(file),
210-
ParseOptions::new().implicit_conversions(false),
211-
)
212-
.unwrap();
213-
214-
let comments = opus_file.vorbis_comments();
215-
assert_eq!(comments.get("TRACKNUMBER"), Some("01"));
216-
assert_eq!(comments.get("TRACKTOTAL"), Some("05"));
217-
}
218-
219184
// case TRACKNUMBER=a5 (vinyl format)
220185
#[test_log::test]
221186
fn opus_issue_499_vinyl_track_number() {

0 commit comments

Comments
 (0)