Example #1
0
        public void BitmapFromDecodeRes_ShouldContainNinePatchChunk(int resId, string name)
        {
            Bitmap bm = BitmapFactory.DecodeResource(Application.Context.Resources, resId);

            byte[] chunk = bm.GetNinePatchChunk();
            Assert.IsTrue(NinePatch.IsNinePatchChunk(chunk),
                          $"Bitmap decoded from resource `{name}` did not contain a valid NinePatch chunk.");
        }
Example #2
0
        public void BitmapFromDecodeResStream_ShouldContainNinePatchChunk(int resId, string name)
        {
            var value             = new Android.Util.TypedValue();
            InputStreamInvoker si = GetResourceStream(resId, value);
            Bitmap             bm = BitmapFactory.DecodeResourceStream(Application.Context.Resources, value, si, null, null);

            byte[] chunk = bm.GetNinePatchChunk();
            Assert.IsTrue(NinePatch.IsNinePatchChunk(chunk),
                          $"Bitmap decoded from resource stream with id `{name}` did not contain a valid NinePatch chunk.");
        }