BitmapPreFillerTest.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
@Test
public void testAllocationOrderDoesNotOverFillWithMultipleSizesAndWeights() {
  PreFillQueue allocationOrder = bitmapPreFiller.generateAllocationOrder(new PreFillType[] {
      new PreFillType.Builder(DEFAULT_BITMAP_WIDTH, DEFAULT_BITMAP_HEIGHT)
          .setConfig(defaultBitmapConfig).setWeight(4).build(),
      new PreFillType.Builder(DEFAULT_BITMAP_WIDTH / 2, DEFAULT_BITMAP_HEIGHT)
          .setConfig(defaultBitmapConfig).build(),
      new PreFillType.Builder(DEFAULT_BITMAP_WIDTH, DEFAULT_BITMAP_HEIGHT / 3)
          .setConfig(defaultBitmapConfig).setWeight(3).build() });

  int byteSize = 0;
  while (!allocationOrder.isEmpty()) {
    PreFillType current = allocationOrder.remove();
    byteSize +=
        Util.getBitmapByteSize(current.getWidth(), current.getHeight(), current.getConfig());
  }

  assertThat(byteSize).isIn(Range.atMost(poolSize + cacheSize));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号