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 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_"));
        }