From 010ba0d15c09eae9dc445330e0ef4583af5aec7e Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 19 May 2023 14:49:15 -0400 Subject: [PATCH] Use table specs in ReplayGain tests. Also use test.mp3 file from Release Date PR, trying to fix a conflict. --- scanner/metadata/metadata_test.go | 2 +- scanner/metadata/taglib/taglib_test.go | 25 ++++++++----------------- tests/fixtures/test.mp3 | Bin 52050 -> 51876 bytes 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/scanner/metadata/metadata_test.go b/scanner/metadata/metadata_test.go index 98d2d8306..de1935ce1 100644 --- a/scanner/metadata/metadata_test.go +++ b/scanner/metadata/metadata_test.go @@ -40,7 +40,7 @@ var _ = Describe("Tags", func() { Expect(m.Channels()).To(Equal(2)) Expect(m.FilePath()).To(Equal("tests/fixtures/test.mp3")) Expect(m.Suffix()).To(Equal("mp3")) - Expect(m.Size()).To(Equal(int64(52050))) + Expect(m.Size()).To(Equal(int64(51876))) Expect(m.RGAlbumGain()).To(Equal(3.21518)) Expect(m.RGAlbumPeak()).To(Equal(0.9125)) Expect(m.RGTrackGain()).To(Equal(-1.48)) diff --git a/scanner/metadata/taglib/taglib_test.go b/scanner/metadata/taglib/taglib_test.go index 6bf7d3b51..87287fb4c 100644 --- a/scanner/metadata/taglib/taglib_test.go +++ b/scanner/metadata/taglib/taglib_test.go @@ -41,7 +41,7 @@ var _ = Describe("Extractor", func() { Expect(m).To(HaveKeyWithValue("albumartist", []string{"Album Artist"})) Expect(m).To(HaveKeyWithValue("tcmp", []string{"1"})) // Compilation Expect(m).To(HaveKeyWithValue("genre", []string{"Rock"})) - Expect(m).To(HaveKeyWithValue("date", []string{"2014", "2014"})) + Expect(m).To(HaveKeyWithValue("date", []string{"2014-05-21", "2014"})) Expect(m).To(HaveKeyWithValue("discnumber", []string{"1/2"})) Expect(m).To(HaveKeyWithValue("has_picture", []string{"true"})) Expect(m).To(HaveKeyWithValue("duration", []string{"1.02"})) @@ -68,8 +68,8 @@ var _ = Describe("Extractor", func() { Expect(m["bitrate"][0]).To(BeElementOf("18", "39", "40")) }) - Context("ReplayGain", func() { - testGain := func(file, albumGain, albumPeak, trackGain, trackPeak string) { + DescribeTable("ReplayGain", + func(file, albumGain, albumPeak, trackGain, trackPeak string) { file = "tests/fixtures/" + file mds, err := e.Parse(file) Expect(err).NotTo(HaveOccurred()) @@ -81,20 +81,11 @@ var _ = Describe("Extractor", func() { Expect(m).To(HaveKeyWithValue("replaygain_album_peak", []string{albumPeak})) Expect(m).To(HaveKeyWithValue("replaygain_track_gain", []string{trackGain})) Expect(m).To(HaveKeyWithValue("replaygain_track_peak", []string{trackPeak})) - } - - It("Correctly parses m4a (aac) gain tags", func() { - testGain("01 Invisible (RED) Edit Version.m4a", "0.37", "0.48", "0.37", "0.48") - }) - - It("correctly parses mp3 tags", func() { - testGain("test.mp3", "+3.21518 dB", "0.9125", "-1.48 dB", "0.4512") - }) - - It("correctly parses ogg (vorbis) tags", func() { - testGain("test.ogg", "+7.64 dB", "0.11772506", "+7.64 dB", "0.11772506") - }) - }) + }, + Entry("Correctly parses m4a (aac) gain tags", "01 Invisible (RED) Edit Version.m4a", "0.37", "0.48", "0.37", "0.48"), + Entry("correctly parses mp3 tags", "test.mp3", "+3.21518 dB", "0.9125", "-1.48 dB", "0.4512"), + Entry("correctly parses ogg (vorbis) tags", "test.ogg", "+7.64 dB", "0.11772506", "+7.64 dB", "0.11772506"), + ) }) Context("Error Checking", func() { diff --git a/tests/fixtures/test.mp3 b/tests/fixtures/test.mp3 index 610156f9a1de4f952a46b44f3125e2fdb2fa9bfa..1e40de9eb04efffa8a6cdf6572c6779c059ad517 100644 GIT binary patch delta 477 zcmXw#%}&BV6oqG6QH+7a#27aQ{M(omI#V$raZ^e|2!)PiNa~6NBuzzH!_UGMChpu$ z^a*?e)^1$7#Z*Qf2Y}Hw%I^>p-gCLV-rK1ODB*M0-tQ)RD9v{bTa--{NjrZ1mZ{u6Tn!! wDX)vHdUJmXXLMll`ixZ92-OV2tFD)bq+Gt%2!Y!!Zi7E%(R=vrisjGCKcLxV8vporHX^gYYe5diI4ONaVo7XwQ5^!>mUv-xH!24 zog5te1JZxs=p^p`2>*b1UrZ|qUU-jt&OImZyd+O|q4)bxH?ymc0DvM~kr5QTF@R9M z*{FixCP6%bn6)~!b_axGWCI1=AQ}jkOCcVYiqq0X9W8r#Bu0@S8x+K@V+`~fNrEu; z>;OB>!xO|-mm?99dJrjY4a`)RVhJNSGn)0YX1mgokz~YaX