From fa78c454cc6c9045a539c2518a25adde00eee27a Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Thu, 25 Mar 2021 18:36:58 +0100 Subject: - additional test on LayoutElement with utf-8 --- src/org/uic/barcode/test/TicketLayoutTest.java | 27 ++++++++++++++++++++++ .../barcode/test/utils/SimpleTestTicketLayout.java | 15 ++++++++++++ 2 files changed, 42 insertions(+) (limited to 'src/org/uic/barcode/test') diff --git a/src/org/uic/barcode/test/TicketLayoutTest.java b/src/org/uic/barcode/test/TicketLayoutTest.java index 089c87d..3d053e7 100644 --- a/src/org/uic/barcode/test/TicketLayoutTest.java +++ b/src/org/uic/barcode/test/TicketLayoutTest.java @@ -6,6 +6,7 @@ import java.io.IOException; import org.junit.Test; import org.uic.barcode.staticFrame.UTLAYDataRecord; +import org.uic.barcode.staticFrame.ticketLayoutBarcode.LayoutElement; import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout; import org.uic.barcode.test.utils.SimpleTestTicketLayout; import org.uic.barcode.test.utils.TestUtils; @@ -40,6 +41,32 @@ public class TicketLayoutTest { assertEquals(tl1.toString(),tl2.toString()); + compare(layout, tl2.getLayout()); + + } + + public static void compare(TicketLayout layout1, TicketLayout layout2) { + + assert(layout1.getLayoutStandard().equals(layout2.getLayoutStandard())); + + for (LayoutElement e1: layout1.getElements() ) { + + for (LayoutElement e2 :layout2.getElements()) { + + boolean found = false; + if (e1.getLine() == e2.getLine() && e1.getColumn() == e2.getColumn()) { + found = true; + assert(e1.getText().equals(e2.getText())); + } + assert(found == true); + + } + + } + } + + + } diff --git a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java index b1b6422..7b9ae1b 100644 --- a/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java +++ b/src/org/uic/barcode/test/utils/SimpleTestTicketLayout.java @@ -28,6 +28,21 @@ public class SimpleTestTicketLayout { assert(layout1.getLayoutStandard().equals(layout2.getLayoutStandard())); + for (LayoutElement e1: layout1.getElements() ) { + + for (LayoutElement e2 :layout2.getElements()) { + + boolean found = false; + if (e1.getLine() == e2.getLine() && e1.getColumn() == e2.getColumn()) { + found = true; + assert(e1.getText().equals(e2.getText())); + } + assert(found == true); + + } + + } + } } -- cgit v1.2.3