@Test public void noLogAfterSetLoggable() { PrintStream old = ShadowLog.stream; ShadowLog.stream = new PrintStream(new ByteArrayOutputStream()); ShadowLog.setLoggable("Foo", Log.DEBUG); assertFalse(Log.isLoggable("Foo", Log.VERBOSE)); ShadowLog.stream = old; }
@Test public void logsAfterSetLoggable() { ShadowLog.setLoggable("Foo", Log.VERBOSE); assertTrue(Log.isLoggable("Foo", Log.DEBUG)); }
@Test public void allocate_whenBitmapPoolIsAtCapacity_doesNotLogWithRecycledBitmap() { ShadowLog.setLoggable(BitmapPreFillRunner.TAG, Log.VERBOSE); int dimensions = 10; Bitmap.Config config = Bitmap.Config.ARGB_8888; int bitmapByteSize = Util.getBitmapByteSize(dimensions, dimensions, config); PreFillType preFillType = new PreFillType.Builder(dimensions).setConfig(config).build(); Map<PreFillType, Integer> allocationOrder = new HashMap<>(); allocationOrder.put(preFillType, 1); PreFillQueue queue = new PreFillQueue(allocationOrder); BitmapPreFillRunner runner = new BitmapPreFillRunner( new LruBitmapPool(bitmapByteSize - 1), new MemoryCacheAdapter(), queue); runner.allocate(); }