mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Test overriding resource type in RawResourceDataSource
I couldn't work out a good way to set up a test environment with an asset in a different package, so I'm not adding a test for the package overriding. PiperOrigin-RevId: 573843326
This commit is contained in:
parent
fe1144487a
commit
681eadeb85
2 changed files with 12 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ public final class RawResourceDataSourceContractTest extends DataSourceContractT
|
|||
|
||||
private static final byte[] RESOURCE_1_DATA = Util.getUtf8Bytes("resource1 abc\n");
|
||||
private static final byte[] RESOURCE_2_DATA = Util.getUtf8Bytes("resource2 abcdef\n");
|
||||
private static final byte[] FONT_DATA = Util.getUtf8Bytes("test font data\n");
|
||||
|
||||
@Override
|
||||
protected DataSource createDataSource() {
|
||||
|
|
@ -58,7 +59,7 @@ public final class RawResourceDataSourceContractTest extends DataSourceContractT
|
|||
.build(),
|
||||
// Additional resources using different URI schemes.
|
||||
new TestResource.Builder()
|
||||
.setName("android.resource:// with package, type, and name")
|
||||
.setName("android.resource:// with package, 'raw' type, and name")
|
||||
.setUri(
|
||||
Uri.parse(
|
||||
"android.resource://"
|
||||
|
|
@ -66,6 +67,15 @@ public final class RawResourceDataSourceContractTest extends DataSourceContractT
|
|||
+ "/raw/resource1"))
|
||||
.setExpectedBytes(RESOURCE_1_DATA)
|
||||
.build(),
|
||||
new TestResource.Builder()
|
||||
.setName("android.resource:// with package, 'font' type, and name")
|
||||
.setUri(
|
||||
Uri.parse(
|
||||
"android.resource://"
|
||||
+ ApplicationProvider.getApplicationContext().getPackageName()
|
||||
+ "/font/test_font"))
|
||||
.setExpectedBytes(FONT_DATA)
|
||||
.build(),
|
||||
new TestResource.Builder()
|
||||
.setName("android.resource:// with type and name only")
|
||||
.setUri(Uri.parse("android.resource:///raw/resource1"))
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
test font data
|
||||
Loading…
Reference in a new issue