Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
135eb3f8
authored
Jul 19, 2021
by
samrobinson
Committed by
Ian Baker
Jul 20, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Split some MediaMetadataTest cases into TextInformationFrameTest.
PiperOrigin-RevId: 385562351
parent
5bc080fd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
67 deletions
library/common/src/test/java/com/google/android/exoplayer2/MediaMetadataTest.java
library/common/src/test/java/com/google/android/exoplayer2/metadata/id3/TextInformationFrameTest.java
library/common/src/test/java/com/google/android/exoplayer2/MediaMetadataTest.java
View file @
135eb3f8
...
@@ -22,11 +22,8 @@ import android.os.Bundle;
...
@@ -22,11 +22,8 @@ import android.os.Bundle;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.id3.ApicFrame
;
import
com.google.android.exoplayer2.metadata.id3.ApicFrame
;
import
com.google.android.exoplayer2.metadata.id3.TextInformationFrame
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.common.collect.ImmutableList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -134,70 +131,6 @@ public class MediaMetadataTest {
...
@@ -134,70 +131,6 @@ public class MediaMetadataTest {
}
}
@Test
@Test
public
void
builderPopulatedFromTextInformationFrameEntry_setsValues
()
{
String
title
=
"the title"
;
String
artist
=
"artist"
;
String
albumTitle
=
"album title"
;
String
albumArtist
=
"album Artist"
;
String
trackNumberInfo
=
"11/17"
;
String
recordingYear
=
"2000"
;
String
recordingMonth
=
"07"
;
String
recordingDay
=
"10"
;
String
releaseDate
=
"2001-01-02T00:00:00"
;
String
composer
=
"composer"
;
String
conductor
=
"conductor"
;
String
writer
=
"writer"
;
List
<
Metadata
.
Entry
>
entries
=
ImmutableList
.
of
(
new
TextInformationFrame
(
/* id= */
"TT2"
,
/* description= */
null
,
/* value= */
title
),
new
TextInformationFrame
(
/* id= */
"TP1"
,
/* description= */
null
,
/* value= */
artist
),
new
TextInformationFrame
(
/* id= */
"TAL"
,
/* description= */
null
,
/* value= */
albumTitle
),
new
TextInformationFrame
(
/* id= */
"TP2"
,
/* description= */
null
,
/* value= */
albumArtist
),
new
TextInformationFrame
(
/* id= */
"TRK"
,
/* description= */
null
,
/* value= */
trackNumberInfo
),
new
TextInformationFrame
(
/* id= */
"TYE"
,
/* description= */
null
,
/* value= */
recordingYear
),
new
TextInformationFrame
(
/* id= */
"TDA"
,
/* description= */
null
,
/* value= */
recordingDay
+
recordingMonth
),
new
TextInformationFrame
(
/* id= */
"TDRL"
,
/* description= */
null
,
/* value= */
releaseDate
),
new
TextInformationFrame
(
/* id= */
"TCM"
,
/* description= */
null
,
/* value= */
composer
),
new
TextInformationFrame
(
/* id= */
"TP3"
,
/* description= */
null
,
/* value= */
conductor
),
new
TextInformationFrame
(
/* id= */
"TXT"
,
/* description= */
null
,
/* value= */
writer
));
MediaMetadata
.
Builder
builder
=
MediaMetadata
.
EMPTY
.
buildUpon
();
for
(
Metadata
.
Entry
entry
:
entries
)
{
entry
.
populateMediaMetadata
(
builder
);
}
MediaMetadata
mediaMetadata
=
builder
.
build
();
assertThat
(
mediaMetadata
.
title
.
toString
()).
isEqualTo
(
title
);
assertThat
(
mediaMetadata
.
artist
.
toString
()).
isEqualTo
(
artist
);
assertThat
(
mediaMetadata
.
albumTitle
.
toString
()).
isEqualTo
(
albumTitle
);
assertThat
(
mediaMetadata
.
albumArtist
.
toString
()).
isEqualTo
(
albumArtist
);
assertThat
(
mediaMetadata
.
trackNumber
).
isEqualTo
(
11
);
assertThat
(
mediaMetadata
.
totalTrackCount
).
isEqualTo
(
17
);
assertThat
(
mediaMetadata
.
recordingYear
).
isEqualTo
(
2000
);
assertThat
(
mediaMetadata
.
recordingMonth
).
isEqualTo
(
7
);
assertThat
(
mediaMetadata
.
recordingDay
).
isEqualTo
(
10
);
assertThat
(
mediaMetadata
.
releaseYear
).
isEqualTo
(
2001
);
assertThat
(
mediaMetadata
.
releaseMonth
).
isEqualTo
(
1
);
assertThat
(
mediaMetadata
.
releaseDay
).
isEqualTo
(
2
);
assertThat
(
mediaMetadata
.
composer
.
toString
()).
isEqualTo
(
composer
);
assertThat
(
mediaMetadata
.
conductor
.
toString
()).
isEqualTo
(
conductor
);
assertThat
(
mediaMetadata
.
writer
.
toString
()).
isEqualTo
(
writer
);
}
@Test
public
void
builderPopulatedFromApicFrameEntry_setsArtwork
()
{
public
void
builderPopulatedFromApicFrameEntry_setsArtwork
()
{
byte
[]
pictureData
=
new
byte
[]
{-
12
,
52
,
33
,
85
,
34
,
22
,
1
,
-
55
};
byte
[]
pictureData
=
new
byte
[]
{-
12
,
52
,
33
,
85
,
34
,
22
,
1
,
-
55
};
Metadata
.
Entry
entry
=
Metadata
.
Entry
entry
=
...
...
library/common/src/test/java/com/google/android/exoplayer2/metadata/id3/TextInformationFrameTest.java
0 → 100644
View file @
135eb3f8
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
id3
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
android.os.Parcel
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.MediaMetadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.common.collect.ImmutableList
;
import
java.util.List
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
/** Unit test for {@link TextInformationFrame}. */
@RunWith
(
AndroidJUnit4
.
class
)
public
class
TextInformationFrameTest
{
@Test
public
void
parcelable
()
{
TextInformationFrame
textInformationFrameToParcel
=
new
TextInformationFrame
(
""
,
""
,
""
);
Parcel
parcel
=
Parcel
.
obtain
();
textInformationFrameToParcel
.
writeToParcel
(
parcel
,
0
);
parcel
.
setDataPosition
(
0
);
TextInformationFrame
textInformationFrameFromParcel
=
TextInformationFrame
.
CREATOR
.
createFromParcel
(
parcel
);
assertThat
(
textInformationFrameFromParcel
).
isEqualTo
(
textInformationFrameToParcel
);
parcel
.
recycle
();
}
@Test
public
void
populateMediaMetadata_setsBuilderValues
()
{
String
title
=
"the title"
;
String
artist
=
"artist"
;
String
albumTitle
=
"album title"
;
String
albumArtist
=
"album Artist"
;
String
trackNumberInfo
=
"11/17"
;
String
recordingYear
=
"2000"
;
String
recordingMonth
=
"07"
;
String
recordingDay
=
"10"
;
String
releaseDate
=
"2001-01-02T00:00:00"
;
String
composer
=
"composer"
;
String
conductor
=
"conductor"
;
String
writer
=
"writer"
;
List
<
Metadata
.
Entry
>
entries
=
ImmutableList
.
of
(
new
TextInformationFrame
(
/* id= */
"TT2"
,
/* description= */
null
,
/* value= */
title
),
new
TextInformationFrame
(
/* id= */
"TP1"
,
/* description= */
null
,
/* value= */
artist
),
new
TextInformationFrame
(
/* id= */
"TAL"
,
/* description= */
null
,
/* value= */
albumTitle
),
new
TextInformationFrame
(
/* id= */
"TP2"
,
/* description= */
null
,
/* value= */
albumArtist
),
new
TextInformationFrame
(
/* id= */
"TRK"
,
/* description= */
null
,
/* value= */
trackNumberInfo
),
new
TextInformationFrame
(
/* id= */
"TYE"
,
/* description= */
null
,
/* value= */
recordingYear
),
new
TextInformationFrame
(
/* id= */
"TDA"
,
/* description= */
null
,
/* value= */
recordingDay
+
recordingMonth
),
new
TextInformationFrame
(
/* id= */
"TDRL"
,
/* description= */
null
,
/* value= */
releaseDate
),
new
TextInformationFrame
(
/* id= */
"TCM"
,
/* description= */
null
,
/* value= */
composer
),
new
TextInformationFrame
(
/* id= */
"TP3"
,
/* description= */
null
,
/* value= */
conductor
),
new
TextInformationFrame
(
/* id= */
"TXT"
,
/* description= */
null
,
/* value= */
writer
));
MediaMetadata
.
Builder
builder
=
MediaMetadata
.
EMPTY
.
buildUpon
();
for
(
Metadata
.
Entry
entry
:
entries
)
{
entry
.
populateMediaMetadata
(
builder
);
}
MediaMetadata
mediaMetadata
=
builder
.
build
();
assertThat
(
mediaMetadata
.
title
.
toString
()).
isEqualTo
(
title
);
assertThat
(
mediaMetadata
.
artist
.
toString
()).
isEqualTo
(
artist
);
assertThat
(
mediaMetadata
.
albumTitle
.
toString
()).
isEqualTo
(
albumTitle
);
assertThat
(
mediaMetadata
.
albumArtist
.
toString
()).
isEqualTo
(
albumArtist
);
assertThat
(
mediaMetadata
.
trackNumber
).
isEqualTo
(
11
);
assertThat
(
mediaMetadata
.
totalTrackCount
).
isEqualTo
(
17
);
assertThat
(
mediaMetadata
.
recordingYear
).
isEqualTo
(
2000
);
assertThat
(
mediaMetadata
.
recordingMonth
).
isEqualTo
(
7
);
assertThat
(
mediaMetadata
.
recordingDay
).
isEqualTo
(
10
);
assertThat
(
mediaMetadata
.
releaseYear
).
isEqualTo
(
2001
);
assertThat
(
mediaMetadata
.
releaseMonth
).
isEqualTo
(
1
);
assertThat
(
mediaMetadata
.
releaseDay
).
isEqualTo
(
2
);
assertThat
(
mediaMetadata
.
composer
.
toString
()).
isEqualTo
(
composer
);
assertThat
(
mediaMetadata
.
conductor
.
toString
()).
isEqualTo
(
conductor
);
assertThat
(
mediaMetadata
.
writer
.
toString
()).
isEqualTo
(
writer
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment