use of com.bilibili.boxing.model.config.BoxingCropOption in project boxing by Bilibili.
the class PickerActivityTest method testCreateMultiImageIntent.
@Test
public void testCreateMultiImageIntent() {
Intent intent = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.MULTI_IMG);
assertEquals(config.isNeedCamera(), false);
BoxingCropOption cropOptions = config.getCropOption();
assertNull(cropOptions);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, null);
Intent intent1 = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class, new ArrayList<ImageMedia>()).getIntent();
assertNotNull(intent1);
ArrayList<BaseMedia> list1 = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list1, null);
ArrayList<ImageMedia> medias = new ArrayList<>();
medias.add(new ImageMedia("test", "test"));
Intent intent2 = Boxing.of(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needGif()).withIntent(mContext, BoxingActivity.class, medias).getIntent();
assertNotNull(intent2);
ArrayList<BaseMedia> list2 = intent2.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list2, medias);
}
use of com.bilibili.boxing.model.config.BoxingCropOption in project boxing by Bilibili.
the class PickerActivityTest method testCreateCustomIntent.
@Test
public void testCreateCustomIntent() {
BoxingConfig pickerConfig = new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).needCamera();
Uri destUri = new Uri.Builder().scheme("file").appendPath("test").appendPath(String.format(Locale.US, "%s.jpg", System.currentTimeMillis())).build();
BoxingCropOption cropOptions = new BoxingCropOption(destUri);
ArrayList<ImageMedia> medias = new ArrayList<>();
medias.add(new ImageMedia("test", "test"));
medias.add(new ImageMedia("test1", "test1"));
pickerConfig.withCropOption(cropOptions);
Intent intent = Boxing.of(pickerConfig).withIntent(mContext, BoxingActivity.class, medias).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.MULTI_IMG);
assertEquals(config.isNeedCamera(), true);
assertEquals(config.isNeedGif(), false);
BoxingCropOption cropOptionsResult = pickerConfig.getCropOption();
assertEquals(cropOptions, cropOptionsResult);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, medias);
}
Aggregations