public void TestConvertFromDataUriBase64()
        {
            // set up
            var converter = new SvgImageSourceTypeConverter();

            // run
            string dataUri = SvgConstants.DataUriBase64Prefix +
                             SvgTestImages.EncodeBase64(SvgTestImages.TestSvgImageText);
            var imageSource = converter.ConvertFromInvariantString(dataUri);

            // check
            Assert.IsNotNull(imageSource, "non-null ImageSource must have been returned");
            Assert.IsInstanceOf <UriImageSource>(imageSource, "must be an URI image source");
        }
示例#2
0
        public async Task TestUriImageSource_DataUriBase64()
        {
            // set up
            var uri = new Uri(SvgConstants.DataUriBase64Prefix +
                              SvgTestImages.EncodeBase64(SvgTestImages.TestSvgImageText));
            var imageSource = ImageSource.FromUri(uri);

            // run
            var svg = await SvgDataResolver.LoadSvgImage(imageSource);

            // check
            Assert.IsNotNull(svg, "loaded SKSvg object must be non-null");
            Assert.IsNotNull(svg.Picture, "SKPicture object must be non-null");
            Assert.IsNotNull(svg.Picture.CullRect, "CullRect must be non-null");
            Assert.IsFalse(svg.Picture.CullRect.IsEmpty, "CullRect must not be empty");
        }