Esempio n. 1
0
        public virtual void Barcode10Test()
        {
            BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();

            barcodeDataMatrix.SetWidth(26);
            barcodeDataMatrix.SetHeight(12);
            int result = barcodeDataMatrix.SetCode("AbcdFFghijklmnopqrstuWXSQ");

            NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG, result);
        }
Esempio n. 2
0
        public virtual void Barcode09Test()
        {
            BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();

            barcodeDataMatrix.SetWidth(17);
            barcodeDataMatrix.SetHeight(17);
            int result = barcodeDataMatrix.SetCode("AbcdFFghijklmnopqrstuWXSQ");

            NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_ERROR_INVALID_SQUARE, result);
        }
        private static void DoWork()
        {
            BarcodeDataMatrix bc = new BarcodeDataMatrix();

            bc.SetOptions(BarcodeDataMatrix.DM_AUTO);
            bc.SetWidth(10);
            bc.SetHeight(10);
            int result = bc.SetCode("AB01");

            Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
        }
Esempio n. 4
0
        public virtual void Barcode15Test()
        {
            BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();

            barcodeDataMatrix.SetWidth(18);
            barcodeDataMatrix.SetHeight(18);
            byte[] str    = "AbcdFFghijklmnop".GetBytes();
            int    result = barcodeDataMatrix.SetCode(str, str.Length, 0);

            NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
        }
Esempio n. 5
0
 public virtual void Barcode14Test()
 {
     NUnit.Framework.Assert.That(() => {
         BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
         barcodeDataMatrix.SetWidth(18);
         barcodeDataMatrix.SetHeight(18);
         byte[] str = "AbcdFFghijklmnop".GetBytes();
         barcodeDataMatrix.SetCode(str, 0, -1);
     }
                                 , NUnit.Framework.Throws.InstanceOf <IndexOutOfRangeException>())
     ;
 }
Esempio n. 6
0
        public virtual void Barcode07Test()
        {
            BarcodeDataMatrix bc = new BarcodeDataMatrix();

            bc.SetOptions(BarcodeDataMatrix.DM_AUTO);
            bc.SetWidth(10);
            bc.SetHeight(10);
            String aCode  = "aBCdeFG12";
            int    result = bc.SetCode(aCode);

            NUnit.Framework.Assert.AreEqual(result, BarcodeDataMatrix.DM_ERROR_TEXT_TOO_BIG);
        }
        public virtual void Barcode02Test()
        {
            String            filename = "barcodeDataMatrix2.pdf";
            PdfWriter         writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument       document = new PdfDocument(writer);
            PdfPage           page1    = document.AddNewPage();
            PdfCanvas         canvas   = new PdfCanvas(page1);
            BarcodeDataMatrix barcode2 = new BarcodeDataMatrix("дима", "UTF-8");

            barcode2.PlaceBarcode(canvas, ColorConstants.GREEN, 10);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }
        public virtual void Barcode16Test()
        {
            String            filename = "barcode16Test.pdf";
            PdfDocument       document = new PdfDocument(new PdfWriter(destinationFolder + filename));
            PdfCanvas         canvas   = new PdfCanvas(document.AddNewPage());
            BarcodeDataMatrix barcode  = new BarcodeDataMatrix();

            barcode.SetCode("999999DILLERT XANG LIMITON 18               000");
            canvas.ConcatMatrix(1, 0, 0, 1, 100, 600);
            barcode.PlaceBarcode(canvas, ColorConstants.BLACK, 3);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder));
        }
        public virtual void Barcode01Test()
        {
            String            filename = "barcodeDataMatrix.pdf";
            PdfWriter         writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument       document = new PdfDocument(writer);
            PdfPage           page     = document.AddNewPage();
            PdfCanvas         canvas   = new PdfCanvas(page);
            BarcodeDataMatrix barcode  = new BarcodeDataMatrix();

            barcode.SetCode("AAAAAAAAAA;BBBBAAAA3;00028;BBBAA05;AAAA;AAAAAA;1234567;AQWXSZ;JEAN;;;;7894561;AQWXSZ;GEO;;;;1;1;1;1;0;0;1;0;1;0;0;0;1;0;1;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1"
                            );
            barcode.PlaceBarcode(canvas, ColorConstants.GREEN, 5);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }
        public virtual void Barcode06Test()
        {
            String            filename = "barcodeDataMatrix6.pdf";
            PdfWriter         writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument       document = new PdfDocument(writer);
            PdfPage           page1    = document.AddNewPage();
            PdfCanvas         canvas   = new PdfCanvas(page1);
            BarcodeDataMatrix barcode3 = new BarcodeDataMatrix();

            barcode3.SetWidth(36);
            barcode3.SetHeight(12);
            barcode3.SetCode(">>>\r>>>THIS VERY TEXT>>\r>");
            barcode3.PlaceBarcode(canvas, ColorConstants.BLACK, 10);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }