public void testEncodeWithFunc1()
        {
            const string toEncode = "\u00f1" + "123";
            //                                                       "12"                           "3"          check digit 92
            var expected = QUIET_SPACE + START_CODE_C + FNC1 + "10110011100" + SWITCH_CODE_B + "11001011100" + "10101111000" + STOP + QUIET_SPACE;

            var result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);

            var actual = BitMatrixTestCase.matrixToString(result);

            Assert.AreEqual(expected, actual);
        }
        public void testEncodeWithFncsAndNumberInCodesetA()
        {
            String toEncode = "\n" + "\u00f1" + "\u00f4" + "1" + "\n";

            String expected = QUIET_SPACE + START_CODE_A + LF + FNC1 + FNC4A + "10011100110" + LF + "10101111000" + STOP + QUIET_SPACE;

            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);

            String actual = BitMatrixTestCase.matrixToString(result);

            Assert.That(actual, Is.EqualTo(expected));
        }
        public void testEncodeWithFunc4()
        {
            var toEncode = "\u00f4" + "123";
            //                                                       "1"            "2"             "3"          check digit 59
            var expected = QUIET_SPACE + START_CODE_B + FNC4 + "10011100110" + "11001110010" + "11001011100" + "11100011010" + STOP + QUIET_SPACE;

            var result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);

            var actual = BitMatrixTestCase.matrixToString(result);

            Assert.AreEqual(expected, actual);
        }
        private void testEncode(String toEncode, String expected)
        {
            var result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);

            var actual = BitMatrixTestCase.matrixToString(result);

            Assert.AreEqual(expected, actual, toEncode);

            var row      = result.getRow(0, null);
            var rtResult = reader.decodeRow(0, row, null);
            var actualRoundtripResultText = rtResult.Text;

            Assert.AreEqual(toEncode, actualRoundtripResultText);
        }
        public void testEncodeWithForcedCodeSetFailureCodeSetB()
        {
            String toEncode = "1234";
            //                          would default to C           "1"             "2"             "3"             "4"  check digit 88
            String expected = QUIET_SPACE + START_CODE_B + "10011100110" + "11001110010" + "11001011100" + "11001001110" + "11110010010" + STOP + QUIET_SPACE;

            var options = new Code128EncodingOptions();

            options.ForceCodeset = Code128EncodingOptions.Codesets.B;
            BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, options.Hints);

            String actual = BitMatrixTestCase.matrixToString(result);

            Assert.AreEqual(expected, actual);
        }
        public void Should_Encode(string contents)
        {
            var sut       = new Code128Writer();
            var sutDecode = new Code128Reader();

            var result       = sut.encode(contents, BarcodeFormat.CODE_128, 0, 0);
            var resultString = BitMatrixTestCase.matrixToString(result);

            Console.WriteLine(contents);
            Console.WriteLine(resultString);
            Console.WriteLine("");
            var matrix = BitMatrix.parse(resultString, "1", "0");
            var row    = new BitArray(matrix.Width);

            matrix.getRow(0, row);
            var decodingResult = sutDecode.decodeRow(0, row, null);

            Assert.That(decodingResult, Is.Not.Null);
            Assert.That(decodingResult.Text, Is.EqualTo(contents));
        }
Beispiel #7
0
        public void testEncode(String input, String expected)
        {
            var result = new ITFWriter().encode(input, BarcodeFormat.ITF, 0, 0);

            Assert.AreEqual(expected, BitMatrixTestCase.matrixToString(result));
        }
        private static void doTest(String input, String expected)
        {
            var result = encode(input);

            Assert.AreEqual(expected, BitMatrixTestCase.matrixToString(result));
        }
        private static void doTest(String input, String expected)
        {
            var result = new Code39Writer().encode(input, BarcodeFormat.CODE_39, 0, 0);

            Assert.AreEqual(expected, BitMatrixTestCase.matrixToString(result));
        }
Beispiel #10
0
        public void testEncode(string content, string encoding)
        {
            var result = new UPCAWriter().encode(content, BarcodeFormat.UPC_A, encoding.Length, 0);

            Assert.AreEqual(encoding, BitMatrixTestCase.matrixToString(result));
        }