Skip to content

Commit 49c595d

Browse files
pavel-alayiText-CI
authored andcommitted
DataMatrix. Add test with zero textSize
DEVSIX-1845 Autoported commit. Original commit hash: [1d17ae9c1]
1 parent bfd360a commit 49c595d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeDataMatrixTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,5 +262,15 @@ public virtual void Barcode14Test() {
262262
, NUnit.Framework.Throws.TypeOf<IndexOutOfRangeException>());
263263
;
264264
}
265+
266+
[NUnit.Framework.Test]
267+
public virtual void Barcode15Test() {
268+
BarcodeDataMatrix barcodeDataMatrix = new BarcodeDataMatrix();
269+
barcodeDataMatrix.SetWidth(18);
270+
barcodeDataMatrix.SetHeight(18);
271+
byte[] str = "AbcdFFghijklmnop".GetBytes();
272+
int result = barcodeDataMatrix.SetCode(str, str.Length, 0);
273+
NUnit.Framework.Assert.AreEqual(BarcodeDataMatrix.DM_NO_ERROR, result);
274+
}
265275
}
266276
}

itext/itext.barcodes/itext/barcodes/BarcodeDataMatrix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public virtual int SetCode(byte[] text, int textOffset, int textSize) {
260260
if (textOffset < 0) {
261261
throw new IndexOutOfRangeException("" + textOffset);
262262
}
263-
if (textOffset + textSize > text.Length || textOffset + textSize < 0) {
263+
if (textOffset + textSize > text.Length || textSize < 0) {
264264
throw new IndexOutOfRangeException("" + textSize);
265265
}
266266
int extCount;

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2da3c495c82c4340ff22020ca6667372b8d314ee
1+
1d17ae9c1ee4089010ec2209154296ebe8f53eac

0 commit comments

Comments
 (0)