use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerModuleTest method testMaxCount.
@Test
public void testMaxCount() {
mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withMaxCount(10));
BoxingConfig config = mPickerManager.getBoxingConfig();
int count = config.getMaxCount();
assertEquals(count, 10);
mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG).withMaxCount(0));
config = mPickerManager.getBoxingConfig();
count = config.getMaxCount();
assertEquals(count, BoxingConfig.DEFAULT_SELECTED_COUNT);
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerModuleTest method testLoadImage.
@Test
public void testLoadImage() {
assertNotNull(mPickerManager);
mPickerManager.setBoxingConfig(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
BoxingConfig config = mPickerManager.getBoxingConfig();
assertNotNull(config);
Assert.assertEquals(config.getMode(), BoxingConfig.Mode.MULTI_IMG);
ContentResolver cr = RuntimeEnvironment.application.getContentResolver();
assertNotNull(cr);
mPickerManager.loadAlbum(cr, new IAlbumTaskCallback() {
@Override
public void postAlbumList(List<AlbumEntity> list) {
assertNotNull(list);
}
});
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerPresenterTest method loadImages.
@Test
public void loadImages() {
Mockito.when(mPickerManager.getBoxingConfig()).thenReturn(new BoxingConfig(BoxingConfig.Mode.MULTI_IMG));
mPresenter.loadMedias(0, "");
Mockito.verify(mPickerManager).loadMedia(any(ContentResolver.class), ArgumentCaptor.forClass(Integer.class).capture(), ArgumentCaptor.forClass(String.class).capture(), mLoadMediaCallback.capture());
List<ImageMedia> imageMedias = new ArrayList<>();
imageMedias.add(new ImageMedia.Builder("1", "test1").build());
imageMedias.add(new ImageMedia.Builder("2", "test2").build());
imageMedias.add(new ImageMedia.Builder("3", "test3").build());
imageMedias.add(new ImageMedia.Builder("4", "test4").build());
mLoadMediaCallback.getValue().postMedia(imageMedias, 4);
ArgumentCaptor<List> showVideoCaptor = ArgumentCaptor.forClass(List.class);
Mockito.verify(mView).showMedia(showVideoCaptor.capture(), anyInt());
System.out.print("load video count:" + showVideoCaptor.getValue().size());
Assert.assertTrue(showVideoCaptor.getValue().size() == 4);
Assert.assertTrue(showVideoCaptor.getValue().get(0).equals(imageMedias.get(0)));
Assert.assertTrue(showVideoCaptor.getValue().get(1).equals(imageMedias.get(1)));
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerPresenterTest method loadVideo.
@Test
public void loadVideo() {
Mockito.when(mPickerManager.getBoxingConfig()).thenReturn(new BoxingConfig(BoxingConfig.Mode.VIDEO));
mPresenter.loadMedias(1, "");
Mockito.verify(mPickerManager).loadMedia(any(ContentResolver.class), ArgumentCaptor.forClass(Integer.class).capture(), ArgumentCaptor.forClass(String.class).capture(), mLoadMediaCallback.capture());
List<VideoMedia> videoMedias = new ArrayList<>();
videoMedias.add(new VideoMedia.Builder("1", "test1").build());
videoMedias.add(new VideoMedia.Builder("2", "test2").build());
videoMedias.add(new VideoMedia.Builder("3", "test3").build());
mLoadMediaCallback.getValue().postMedia(videoMedias, 3);
ArgumentCaptor<List> showVideoCaptor = ArgumentCaptor.forClass(List.class);
Mockito.verify(mView).showMedia(showVideoCaptor.capture(), anyInt());
System.out.print("load video count:" + showVideoCaptor.getValue().size());
Assert.assertTrue(showVideoCaptor.getValue().size() == 3);
Assert.assertTrue(showVideoCaptor.getValue().get(0).equals(videoMedias.get(0)));
Assert.assertTrue(showVideoCaptor.getValue().get(1).equals(videoMedias.get(1)));
}
use of com.bilibili.boxing.model.config.BoxingConfig in project boxing by Bilibili.
the class PickerActivityTest method testCreateSingleImageIntent.
@Test
public void testCreateSingleImageIntent() {
Intent intent = Boxing.of(new BoxingConfig(BoxingConfig.Mode.SINGLE_IMG).needCamera(R.drawable.ic_boxing_broken_image)).withIntent(mContext, BoxingActivity.class).getIntent();
assertNotNull(intent);
BoxingConfig config = BoxingManager.getInstance().getBoxingConfig();
assertNotNull(config);
assertEquals(config.getMode(), BoxingConfig.Mode.SINGLE_IMG);
assertEquals(config.isNeedCamera(), true);
BoxingCropOption cropOptions = config.getCropOption();
assertEquals(cropOptions, null);
ArrayList<BaseMedia> list = intent.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
assertEquals(list, null);
}
Aggregations