当前位置: 首页>>代码示例>>Java>>正文


Java ShadowBitmap.createBitmap方法代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:AttributeStrategyTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:TransformationUtilsTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:AttributeStrategyTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:AttributeStrategyTest.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:GlideTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AttributeStrategyTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AttributeStrategyTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AttributeStrategyTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AttributeStrategyTest.java

示例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));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AttributeStrategyTest.java

示例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;

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:LruBitmapPoolTest.java


注:本文中的org.robolectric.shadows.ShadowBitmap.createBitmap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。