Java Code Examples for org.robolectric.shadows.ShadowBitmapFactory#create()

The following examples show how to use org.robolectric.shadows.ShadowBitmapFactory#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageUtilTest.java    From AndroidGodEye with Apache License 2.0 5 votes vote down vote up
@Test
public void convertToBase64() {
    String base642 = ImageUtil.convertToBase64(null, 5, 5);
    Assert.assertNull(base642);
    Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye-Image", null, new Point(10, 10));
    String base64 = ImageUtil.convertToBase64(bitmap, 5, 5);
    Assert.assertNotNull(base64);
}
 
Example 2
Source File: ImageUtilTest.java    From AndroidGodEye with Apache License 2.0 5 votes vote down vote up
/**
 * width > target && height < target
 */
@Test
public void computeTargetSizeWidth1Height0() {
    Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(100, 20));
    int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30);
    Assert.assertEquals(30, targetSize0[0]);
    Assert.assertEquals(6, targetSize0[1]);
}
 
Example 3
Source File: ImageUtilTest.java    From AndroidGodEye with Apache License 2.0 5 votes vote down vote up
/**
 * width > target && height > target
 */
@Test
public void computeTargetSizeWidth1Height1() {
    Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(100, 50));
    int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30);
    Assert.assertEquals(30, targetSize0[0]);
    Assert.assertEquals(15, targetSize0[1]);
}
 
Example 4
Source File: ImageUtilTest.java    From AndroidGodEye with Apache License 2.0 5 votes vote down vote up
/**
 * width < target && height > target
 */
@Test
public void computeTargetSizeWidth0Height1() {
    Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(25, 50));
    int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30);
    Assert.assertEquals(15, targetSize0[0]);
    Assert.assertEquals(30, targetSize0[1]);
}
 
Example 5
Source File: ImageUtilTest.java    From AndroidGodEye with Apache License 2.0 5 votes vote down vote up
/**
 * width < target && height < target
 */
@Test
public void computeTargetSizeWidth0Height0() {
    Bitmap bitmap = ShadowBitmapFactory.create("AndroidGodEye", null, new Point(20, 10));
    int[] targetSize0 = ImageUtil.computeTargetSize(bitmap, 30, 30);
    Assert.assertEquals(20, targetSize0[0]);
    Assert.assertEquals(10, targetSize0[1]);
}