Search in sources :

Example 1 with ImageCompressor

use of com.bilibili.boxing.utils.ImageCompressor in project boxing by Bilibili.

the class PickerUtilTest method testCompressTask.

@Test
public void testCompressTask() {
    ImageCompressor illegalCompressor = new ImageCompressor(new File("///"));
    ImageMedia media = new ImageMedia("123", "44");
    ImageCompressor compressor = new ImageCompressor(new File("src/main/res/"));
    ImageMedia media1 = new ImageMedia("1223", "../boxing-impl/src/main/res/drawable-hdpi/ic_camera.png");
    media1.setSize("233");
    boolean result1 = CompressTask.compress(null, null, 0);
    assertTrue(!result1);
    result1 = CompressTask.compress(null, media, 0);
    assertTrue(!result1);
    result1 = CompressTask.compress(illegalCompressor, media, 0);
    assertTrue(!result1);
    result1 = CompressTask.compress(illegalCompressor, media, 1000);
    assertTrue(!result1);
    result1 = CompressTask.compress(compressor, media1, 1000);
    assertTrue(result1);
}
Also used : ImageCompressor(com.bilibili.boxing.utils.ImageCompressor) ImageMedia(com.bilibili.boxing.model.entity.impl.ImageMedia) File(java.io.File) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test) PrepareOnlyThisForTest(org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)

Aggregations

ImageMedia (com.bilibili.boxing.model.entity.impl.ImageMedia)1 ImageCompressor (com.bilibili.boxing.utils.ImageCompressor)1 File (java.io.File)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 PrepareOnlyThisForTest (org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)1