public void can_render_svg_qrcode_with_svg_logo_image_tag() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909361 var logoSvg = File.ReadAllText(GetAssemblyPath() + "\\assets\\noun_Scientist_2909361.svg"); var logoObj = new SvgQRCode.SvgLogo(logoSvg, 20, iconEmbedded: false); var svg = new SvgQRCode(data).GetGraphic(10, Color.DarkGray, Color.White, logo: logoObj); var result = HelperFunctions.StringToHash(svg); result.ShouldBe("bd442ea77d45a41a4f490b8d41591e04"); }
public void can_render_svg_qrcode_with_svg_logo() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909361 var logoSvg = File.ReadAllText(GetAssemblyPath() + "\\assets\\noun_Scientist_2909361.svg"); var logoObj = new SvgQRCode.SvgLogo(logoSvg, 30); var svg = new SvgQRCode(data).GetGraphic(10, Color.DarkGray, Color.White, logo: logoObj); var md5 = new MD5CryptoServiceProvider(); var hash = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(svg)); var result = BitConverter.ToString(hash).Replace("-", "").ToLower(); result.ShouldBe("b4ded3964e2e640b6b6c74d1c89d71fa"); }
public void can_render_svg_qrcode_with_png_logo() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var logoBitmap = (Bitmap)Bitmap.FromFile(GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png"); var logoObj = new SvgQRCode.SvgLogo(logoBitmap, 15); var svg = new SvgQRCode(data).GetGraphic(10, Color.DarkGray, Color.White, logo: logoObj); var md5 = new MD5CryptoServiceProvider(); var hash = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(svg)); var result = BitConverter.ToString(hash).Replace("-", "").ToLower(); result.ShouldBe("4ff45872787f321524cc4d071239c25e"); }
public void can_render_svg_qrcode_with_svg_logo_embedded() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909361 var logoSvg = File.ReadAllText(GetAssemblyPath() + "\\assets\\noun_Scientist_2909361.svg"); var logoObj = new SvgQRCode.SvgLogo(logoSvg, 20); logoObj.GetMediaType().ShouldBe <SvgQRCode.SvgLogo.MediaType>(SvgQRCode.SvgLogo.MediaType.SVG); var svg = new SvgQRCode(data).GetGraphic(10, Color.DarkGray, Color.White, logo: logoObj); var result = HelperFunctions.StringToHash(svg); result.ShouldBe("855eb988d3af035abd273ed1629aa952"); }
public void can_render_svg_qrcode_with_png_logo() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var logoBitmap = (Bitmap)Image.FromFile(GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png"); var logoObj = new SvgQRCode.SvgLogo(iconRasterized: logoBitmap, 15); logoObj.GetMediaType().ShouldBe <SvgQRCode.SvgLogo.MediaType>(SvgQRCode.SvgLogo.MediaType.PNG); var svg = new SvgQRCode(data).GetGraphic(10, Color.DarkGray, Color.White, logo: logoObj); var result = HelperFunctions.StringToHash(svg); result.ShouldBe("78e02e8ba415f15817d5ed88c4afca31"); }