public void can_render_pngbyte_qrcode_color_without_quietzones() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.L); var pngCodeGfx = new PngByteQRCode(data).GetGraphic(5, new byte[] { 255, 255, 255, 127 }, new byte[] { 0, 0, 255 }, false); #if NETCOREAPP1_1 var result = HelperFunctions.ByteArrayToHash(pngCodeGfx); result.ShouldBe("07f760b3eb54901840b094d31e299713"); #else File.WriteAllBytes(@"C:\Temp\pngbyte_35.png", pngCodeGfx); using (var mStream = new MemoryStream(pngCodeGfx)) { var bmp = (Bitmap)Image.FromStream(mStream); bmp.MakeTransparent(Color.Transparent); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("75be11d582575617d2490c54b69e844e"); #else result.ShouldBe("fbbc8255ebf3e4f4a1d21f0dd15f76f8"); #endif } #endif }
public void can_render_qrcode_from_helper() { //Create QR code var bmp = QRCodeHelper.GetQRCode("This is a quick test! 123#?", 10, Color.Black, Color.White, QRCodeGenerator.ECCLevel.H); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("e8c61b8f0455924fe08ba68686d0d296"); }
public void can_create_qrcode_standard_graphic_hex() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new QRCode(data).GetGraphic(10, "#000000", "#ffffff"); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("e8c61b8f0455924fe08ba68686d0d296"); }
public void can_render_artqrcode_from_helper() { //Create QR code var bmp = ArtQRCodeHelper.GetQRCode("A", 10, Color.Black, Color.White, Color.Transparent, QRCodeGenerator.ECCLevel.L); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("fea51114bc4ff893542a1c0574c82a07"); #else result.ShouldBe("57ecaa9bdeadcdcbeac8a19d734907ff"); #endif }
public void can_create_qrcode_standard_graphic_without_quietzones() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new QRCode(data).GetGraphic(5, Color.Black, Color.White, false); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("329e1664f57cbe7332d8d4db04c1d480"); #else result.ShouldBe("d703e54a0ba541c6ea69e3d316e394e7"); #endif }
public void can_create_standard_qrcode_graphic() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new ArtQRCode(data).GetGraphic(10); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("11ebdda91b9632d016798cb6de2f5339"); #else result.ShouldBe("cb38c3156eaf13cdfba699bdafc3a84c"); #endif }
public void can_create_standard_qrcode_graphic_without_quietzone() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new ArtQRCode(data).GetGraphic(10, Color.Black, Color.White, Color.Transparent, drawQuietZones: false); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("550f31b988ff12d5f8429ef19d9d5a0c"); #else result.ShouldBe("632315c8695416fc82fe06a202688433"); #endif }
public void can_create_standard_qrcode_graphic_with_background() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new ArtQRCode(data).GetGraphic((Bitmap)Image.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png")); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("2caa9c0ee8fcb4a93841debb58cf41bc"); #else result.ShouldBe("bbea08507282773175cfe7b52f0ddae4"); #endif }
public void can_create_standard_qrcode_graphic_with_custom_finder() { var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var finder = new Bitmap(15, 15); var bmp = new ArtQRCode(data).GetGraphic(10, Color.Black, Color.White, Color.Transparent, finderPatternImage: finder); var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("c54a7389ae995abc838f0d228acc3bad"); #else result.ShouldBe("1102c0c6f235eaf4c3ac639f82f17bfa"); #endif }
public void can_create_qrcode_with_non_transparent_logo_graphic() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.White, icon: (Bitmap)Bitmap.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png")); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("1d718f06f904af4a46748f02af2d4eec"); #else result.ShouldBe("c46a7ec51bf978d7a882059c322ca69d"); #endif }
public void can_create_qrcode_with_transparent_logo_graphic() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.Transparent, icon: (Bitmap)Image.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png")); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("ee65d96c3013f6032b561cc768251eef"); #else result.ShouldBe("150f8fc7dae4487ba2887d2b2bea1c25"); #endif }
public void can_render_pngbyte_qrcode_from_helper() { //Create QR code var pngCodeGfx = PngByteQRCodeHelper.GetQRCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.L, 10); #if NETCOREAPP1_1 var result = HelperFunctions.ByteArrayToHash(pngCodeGfx); result.ShouldBe("c562388f4f3cf13a299b469a3e3b852f"); #else using (var mStream = new MemoryStream(pngCodeGfx)) { var bmp = (Bitmap)Image.FromStream(mStream); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("1978fb11ce26acf9b6cb7490b4c44ef2"); } #endif }
public void can_create_qrcode_with_logo_and_with_standard_border() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var logo = (Bitmap)Image.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png"); var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.White, icon: logo, iconBorderWidth: 6); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("52207bd86ca5a532fb2095dbaa0ae04c"); #else result.ShouldBe("1c926ea1d48f42fdf8e6f1438b774cdd"); #endif }
public void can_create_qrcode_with_logo_and_with_custom_border() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H); var logo = (Bitmap)Image.FromFile(HelperFunctions.GetAssemblyPath() + "\\assets\\noun_software engineer_2909346.png"); var bmp = new QRCode(data).GetGraphic(10, Color.Black, Color.Transparent, icon: logo, iconBorderWidth: 6, iconBackgroundColor: Color.DarkGreen); //Used logo is licensed under public domain. Ref.: https://thenounproject.com/Iconathon1/collection/redefining-women/?i=2909346 var result = HelperFunctions.BitmapToHash(bmp); #if NET35_OR_GREATER || NET40_OR_GREATER result.ShouldBe("d2f20d34a973d92b9c3e05db1393b331"); #else result.ShouldBe("9a06bfbb72df999b6290b5af5c4037cb"); #endif }
public void can_render_pngbyte_qrcode_from_helper_2() { //Create QR code var pngCodeGfx = PngByteQRCodeHelper.GetQRCode("This is a quick test! 123#?", 5, new byte[] { 255, 255, 255, 127 }, new byte[] { 0, 0, 255 }, QRCodeGenerator.ECCLevel.L); #if NETCOREAPP1_1 var result = HelperFunctions.ByteArrayToHash(pngCodeGfx); result.ShouldBe("627ce564fb5e17be42e4a85e907a17b5"); #else using (var mStream = new MemoryStream(pngCodeGfx)) { var bmp = (Bitmap)Image.FromStream(mStream); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("c56c2a9535fd8e9a92a6ac9709d21e67"); } #endif }
public void can_render_pngbyte_qrcode_blackwhite() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.L); var pngCodeGfx = new PngByteQRCode(data).GetGraphic(5); #if NETCOREAPP1_1 var result = HelperFunctions.ByteArrayToHash(pngCodeGfx); result.ShouldBe("1fc35c3bea6fad47427143ce716c83b8"); #else using (var mStream = new MemoryStream(pngCodeGfx)) { var bmp = (Bitmap)Image.FromStream(mStream); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("18b19e6037cff06ae995d8d487b0e46e"); } #endif }
public void can_render_pngbyte_qrcode_color() { //Create QR code var gen = new QRCodeGenerator(); var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.L); var pngCodeGfx = new PngByteQRCode(data).GetGraphic(5, new byte[] { 255, 0, 0 }, new byte[] { 0, 0, 255 }); #if NETCOREAPP1_1 var result = HelperFunctions.ByteArrayToHash(pngCodeGfx); result.ShouldBe("0144b1d40aa6eeb6cb07df42822ea0a7"); #else using (var mStream = new MemoryStream(pngCodeGfx)) { var bmp = (Bitmap)Image.FromStream(mStream); var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("37ae73e90b66beac317b790be3db24cc"); } #endif }