Exemplo n.º 1
0
 public void TestGetBucketedSizeForValue()
 {
     using (SoftwareBitmap bitmap1 = _pool.Alloc(12),
            bitmap2 = _pool.Alloc(56),
            bitmap3 = MockBitmapFactory.Create(7, 8, BitmapPixelFormat.Rgba8),
            bitmap4 = MockBitmapFactory.Create(7, 8, BitmapPixelFormat.Rgba16))
     {
         Assert.AreEqual(12, _pool.GetBucketedSizeForValue(bitmap1));
         Assert.AreEqual(56, _pool.GetBucketedSizeForValue(bitmap2));
         Assert.AreEqual(224, _pool.GetBucketedSizeForValue(bitmap3));
         Assert.AreEqual(448, _pool.GetBucketedSizeForValue(bitmap4));
     }
 }
Exemplo n.º 2
0
 public void TestIsReusable()
 {
     using (SoftwareBitmap b1 = _pool.Alloc(12),
            b2 = MockBitmapFactory.Create(3, 4, BitmapPixelFormat.Bgra8),
            b3 = MockBitmapFactory.Create(3, 4, BitmapPixelFormat.Gray16),
            b5 = MockBitmapFactory.Create(3, 4, BitmapPixelFormat.Bgra8).GetReadOnlyView())
     {
         SoftwareBitmap b4 = MockBitmapFactory.Create(3, 4, BitmapPixelFormat.Bgra8);
         Assert.IsTrue(_pool.IsReusable(b1));
         Assert.IsTrue(_pool.IsReusable(b2));
         Assert.IsTrue(_pool.IsReusable(b3));
         b4.Dispose();
         Assert.IsFalse(_pool.IsReusable(b4));
         Assert.IsFalse(_pool.IsReusable(b5));
     }
 }
Exemplo n.º 3
0
 private SoftwareBitmap BitmapForSize(int size)
 {
     return(MockBitmapFactory.Create(size, 1, BitmapPixelFormat.Gray8));
 }