本文整理汇总了Java中org.robolectric.shadows.ShadowBitmap.createBitmap方法的典型用法代码示例。如果您正苦于以下问题:Java ShadowBitmap.createBitmap方法的具体用法?Java ShadowBitmap.createBitmap怎么用?Java ShadowBitmap.createBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.shadows.ShadowBitmap
的用法示例。
在下文中一共展示了ShadowBitmap.createBitmap方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLeastRecentlyUsedAttributeSetIsRemovedFirst
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testLeastRecentlyUsedAttributeSetIsRemovedFirst() {
final Bitmap leastRecentlyUsed = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ALPHA_8);
final Bitmap other = ShadowBitmap.createBitmap(1000, 1000, Bitmap.Config.RGB_565);
final Bitmap mostRecentlyUsed = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.get(100, 100, Bitmap.Config.ALPHA_8);
strategy.get(1000, 1000, Bitmap.Config.RGB_565);
strategy.get(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(other);
strategy.put(leastRecentlyUsed);
strategy.put(mostRecentlyUsed);
Bitmap removed = strategy.removeLast();
assertEquals(
"Expected=" + strategy.logBitmap(leastRecentlyUsed) + " got=" + strategy.logBitmap(removed),
leastRecentlyUsed, removed);
}
示例2: createBitmap
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Implementation
public static Bitmap createBitmap(int width, int height, Bitmap.Config config) {
// Robolectric doesn't match the framework behavior with null configs, so we have to do so
// here.
Preconditions.checkNotNull("Config must not be null");
return ShadowBitmap.createBitmap(width, height, config);
}
示例3: testICanAddAndGetABitmapOfTheSameSizeAndDimensions
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICanAddAndGetABitmapOfTheSameSizeAndDimensions() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(bitmap);
assertEquals(bitmap,
strategy.get(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888));
}
示例4: testMultipleBitmapsOfDifferentAttributesCanBeAddedAtOnce
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testMultipleBitmapsOfDifferentAttributesCanBeAddedAtOnce() {
Bitmap first = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.RGB_565);
Bitmap second = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
Bitmap third = ShadowBitmap.createBitmap(120, 120, Bitmap.Config.RGB_565);
strategy.put(first);
strategy.put(second);
strategy.put(third);
assertEquals(first, strategy.get(100, 100, Bitmap.Config.RGB_565));
assertEquals(second, strategy.get(100, 100, Bitmap.Config.ARGB_8888));
assertEquals(third, strategy.get(120, 120, Bitmap.Config.RGB_565));
}
示例5: createBitmap
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Implementation
public static Bitmap createBitmap(int width, int height, Bitmap.Config config) {
Bitmap bitmap = ShadowBitmap.createBitmap(width, height, config);
Shadows.shadowOf(bitmap).setMutable(true);
return bitmap;
}
示例6: testICantGetABitmapOfTheSameDimensionsButDifferentConfigs
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICantGetABitmapOfTheSameDimensionsButDifferentConfigs() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(bitmap);
assertNull(strategy.get(100, 100, Bitmap.Config.RGB_565));
}
示例7: testICantGetABitmapOfTheSameDimensionsAndSizeButDifferentConfigs
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICantGetABitmapOfTheSameDimensionsAndSizeButDifferentConfigs() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_4444);
strategy.put(bitmap);
assertNull(strategy.get(100, 100, Bitmap.Config.RGB_565));
}
示例8: testICantGetABitmapOfDifferentWidths
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICantGetABitmapOfDifferentWidths() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(bitmap);
assertNull(strategy.get(99, 100, Bitmap.Config.ARGB_8888));
}
示例9: testICantGetABitmapOfDifferentHeights
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICantGetABitmapOfDifferentHeights() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(bitmap);
assertNull(strategy.get(100, 99, Bitmap.Config.ARGB_8888));
}
示例10: testICantGetABitmapOfDifferentDimensionsButTheSameSize
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
@Test
public void testICantGetABitmapOfDifferentDimensionsButTheSameSize() {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
strategy.put(bitmap);
assertNull(strategy.get(50, 200, Bitmap.Config.ARGB_8888));
}
示例11: createMutableBitmap
import org.robolectric.shadows.ShadowBitmap; //导入方法依赖的package包/类
private Bitmap createMutableBitmap(Bitmap.Config config) {
Bitmap bitmap = ShadowBitmap.createBitmap(100, 100, config);
Shadows.shadowOf(bitmap).setMutable(true);
return bitmap;
}