public void LocaleIndependence()
        {
            CultureInfo savedCurrentCulture   = CultureInfo.CurrentCulture;
            CultureInfo savedCurrentUiCulture = CultureInfo.CurrentUICulture;

            CultureInfo culture = CultureInfo.CreateSpecificCulture("de-DE");

            Bill bill = SampleData.CreateExample4();

            using (PDFCanvas canvas =
                       new PDFCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight))
            {
                try
                {
                    CultureInfo.CurrentCulture   = culture;
                    CultureInfo.CurrentUICulture = culture;

                    QRBill.Draw(bill, canvas);
                    FileComparison.AssertFileContentsEqual(canvas.ToByteArray(), "pdfcanvas-locale-1.pdf");
                }
                finally
                {
                    CultureInfo.CurrentCulture   = savedCurrentCulture;
                    CultureInfo.CurrentUICulture = savedCurrentUiCulture;
                }
            }
        }
示例#2
0
 private void GenerateAndCompareBill(Bill bill, string expectedFileName)
 {
     bill.Format.OutputSize     = OutputSize.A4PortraitSheet;
     bill.Format.GraphicsFormat = GraphicsFormat.SVG;
     byte[] imageData = QRBill.Generate(bill);
     FileComparison.AssertFileContentsEqual(imageData, expectedFileName);
 }
示例#3
0
 private void GenerateAndCompareBill(Bill bill, OutputSize outputSize, GraphicsFormat graphicsFormat,
                                     string expectedFileName)
 {
     bill.Format.OutputSize     = outputSize;
     bill.Format.GraphicsFormat = graphicsFormat;
     byte[] imageData = QRBill.Generate(bill);
     FileComparison.AssertFileContentsEqual(imageData, expectedFileName);
 }
 private void GenerateAndCompareBill(Bill bill, GraphicsFormat graphicsFormat, SeparatorType separatorType,
                                     string expectedFileName)
 {
     bill.Format.GraphicsFormat = graphicsFormat;
     bill.Format.SeparatorType  = separatorType;
     byte[] imageData = QRBill.Generate(bill);
     FileComparison.AssertFileContentsEqual(imageData, expectedFileName);
 }
示例#5
0
        public void CreateQrBillFrench()
        {
            Bill bill = SampleData.CreateExample1();

            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            bill.Format.Language       = Language.FR;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrbill_fr.svg");
        }
示例#6
0
        public void CreateQrBill5()
        {
            Bill bill = SampleData.CreateExample3();

            bill.Format.OutputSize     = OutputSize.QrBillWithHorizontalLine;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrbill_ex5.svg");
        }
示例#7
0
        public void CreateQrBill4()
        {
            Bill bill = SampleData.CreateExample4();

            bill.Format.OutputSize     = OutputSize.QrBillOnly;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrbill_ex4.svg");
        }
示例#8
0
        private void QrCodeAsSvg4()
        {
            Bill bill = SampleData.CreateExample4();

            bill.Format.OutputSize     = OutputSize.QrCodeOnly;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrcode_ex4.svg");
        }
示例#9
0
        public void SvgWithChallengingCharacters()
        {
            Bill bill = SampleData.CreateExample1();

            bill.UnstructuredMessage   = "<h1>&&\"ff\"'t'";
            bill.Format.OutputSize     = OutputSize.QrBillOnly;
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrbill_sc1.svg");
        }
示例#10
0
 private void GenerateAndComparePngBill(Bill bill, SeparatorType separatorType,
                                        string expectedFileName)
 {
     bill.Format.SeparatorType = separatorType;
     using (PNGCanvas canvas =
                new PNGCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight, 288, "Arial,Helvetica"))
     {
         QRBill.Draw(bill, canvas);
         FileComparison.AssertGrayscaleImageContentsEqual(canvas.ToByteArray(), expectedFileName);
     }
 }
示例#11
0
        public void CreateQrBill5b()
        {
            Bill bill = SampleData.CreateExample3();

#pragma warning disable CS0618 // Type or member is obsolete
            bill.Format.OutputSize = OutputSize.QrBillWithHorizontalLine;
#pragma warning restore CS0618 // Type or member is obsolete
            bill.Format.GraphicsFormat = GraphicsFormat.SVG;
            byte[] svg = QRBill.Generate(bill);
            FileComparison.AssertFileContentsEqual(svg, "qrbill_ex5.svg");
        }
        private void PngBillQrBill()
        {
            Bill bill = SampleData.CreateExample1();

            byte[] svg;
            using (PNGCanvas canvas = new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 300, "Arial"))
            {
                bill.Format.OutputSize = OutputSize.QrBillOnly;
                QRBill.Draw(bill, canvas);
                svg = canvas.ToByteArray();
            }

            FileComparison.AssertGrayscaleImageContentsEqual(svg, "qrbill_ex1.png");
        }
        private void PngBillA4()
        {
            Bill bill = SampleData.CreateExample3();

            byte[] png;
            using (PNGCanvas canvas =
                       new PNGCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight, 144, "Arial,Helvetica"))
            {
                bill.Format.OutputSize = OutputSize.A4PortraitSheet;
                QRBill.Draw(bill, canvas);
                png = canvas.ToByteArray();
            }

            FileComparison.AssertGrayscaleImageContentsEqual(png, "a4bill_ex3.png");
        }
        public void AddVerticalSeparator()
        {
            var bill = SampleData.CreateExample1();

            bill.Format.SeparatorType = SeparatorType.None;
            using (PDFCanvas canvas =
                       new PDFCanvas(QRBill.A4PortraitWidth, QRBill.A4PortraitHeight))
            {
                QRBill.Draw(bill, canvas);

                QRBill.DrawSeparators(SeparatorType.DashedLineWithScissors, false, canvas);

                MemoryStream ms = new MemoryStream();
                canvas.WriteTo(ms);

                FileComparison.AssertFileContentsEqual(ms.ToArray(), "a4bill_postproc2.pdf");
            }
        }
示例#15
0
        private void GenerateQRBill(string locale, string expectedFileName)
        {
            CultureInfo savedCurrentCulture   = CultureInfo.CurrentCulture;
            CultureInfo savedCurrentUiCulture = CultureInfo.CurrentUICulture;

            CultureInfo culture = CultureInfo.CreateSpecificCulture(locale);

            try
            {
                CultureInfo.CurrentCulture   = culture;
                CultureInfo.CurrentUICulture = culture;

                Bill bill = SampleData.CreateExample3();
                bill.Format.OutputSize     = OutputSize.QrBillOnly;
                bill.Format.GraphicsFormat = GraphicsFormat.SVG;
                byte[] svg = QRBill.Generate(bill);
                FileComparison.AssertFileContentsEqual(svg, expectedFileName);
            }
            finally
            {
                CultureInfo.CurrentCulture   = savedCurrentCulture;
                CultureInfo.CurrentUICulture = savedCurrentUiCulture;
            }
        }