use of i2p.bote.android.util.ContentAttachment in project i2p.i2p-bote by i2p.
the class AttachmentProviderTests method queryWithValidTextUri.
@Test
public void queryWithValidTextUri() throws Exception {
ContentAttachment attachment = createTextAttachment();
Uri uri = createEmailWithAttachment(attachment);
Cursor c = getMockContentResolver().query(uri, null, null, null, null);
assertThat(c.getCount(), is(1));
int nameIndex = c.getColumnIndex(OpenableColumns.DISPLAY_NAME);
int sizeIndex = c.getColumnIndex(OpenableColumns.SIZE);
c.moveToFirst();
assertThat(c.getString(nameIndex), is(equalTo(attachment.getFileName())));
assertThat(c.getLong(sizeIndex), is(equalTo(attachment.getSize())));
}
use of i2p.bote.android.util.ContentAttachment in project i2p.i2p-bote by i2p.
the class AttachmentProviderTests method getTypeWithValidTextUri.
@Test
public void getTypeWithValidTextUri() throws Exception {
ContentAttachment attachment = createTextAttachment();
Uri uri = createEmailWithAttachment(attachment);
String type = getMockContentResolver().getType(uri);
assertThat("Type was not correct", type, is("text/plain"));
}
use of i2p.bote.android.util.ContentAttachment in project i2p.i2p-bote by i2p.
the class AttachmentProviderTests method getTypeWithValidImageUri.
@Test
public void getTypeWithValidImageUri() throws Exception {
ContentAttachment attachment = createImageAttachment();
Uri uri = createEmailWithAttachment(attachment);
String type = getMockContentResolver().getType(uri);
assertThat("Type was not correct", type, is("image/png"));
}
use of i2p.bote.android.util.ContentAttachment in project i2p.i2p-bote by i2p.
the class AttachmentProviderTests method openFileWithValidTextUri.
@Test
public void openFileWithValidTextUri() throws Exception {
ContentAttachment attachment = createTextAttachment();
Uri uri = createEmailWithAttachment(attachment);
openFileWithValidUri(attachment, uri);
}
use of i2p.bote.android.util.ContentAttachment in project i2p.i2p-bote by i2p.
the class AttachmentProviderTests method openFileWithValidImageUri.
@Test
public void openFileWithValidImageUri() throws Exception {
ContentAttachment attachment = createImageAttachment();
Uri uri = createEmailWithAttachment(attachment);
openFileWithValidUri(attachment, uri);
assertThat("Image could not be decoded", BitmapFactory.decodeStream(getMockContentResolver().openInputStream(uri)), is(notNullValue()));
}
Aggregations