tests.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. function createTests(newTest){
  2. newTest("This has a \nnewline", {width: 1});
  3. newTest("\tHi\nHI", {width: 1});
  4. newTest("Hello", {width: 1, text: "Hi!"});
  5. newTest("A little test!", {format: "CODE128", width: 1});
  6. newTest("ABCDEFG", {format: "CODE39", width: 1, mod43: true});
  7. newTest("A little test", {format: "CODE39", width: 1});
  8. newTest("12345", {format: "EAN5", width: 1});
  9. newTest("52", {format: "EAN2", width: 1});
  10. newTest("423514346455", {format: "UPC", width: 2, textMargin: 0});
  11. newTest("423514346455", {format: "UPC", width: 2, textMargin: 0, flat: true});
  12. newTest("01245714", {format: "UPCE", width: 2, textMargin: 0});
  13. newTest("5901234123457", {format: "EAN13", fontSize: 40, textMargin: 0, lastChar: ">"});
  14. newTest("590123412345", {format: "EAN13", width: 2, fontSize: 16});
  15. newTest("590123412345", {format: "EAN13", width: 3});
  16. newTest("590123412345", {format: "EAN13", flat: true});
  17. newTest("96385074", {format: "EAN8", width: 1});
  18. newTest("9638507", {format: "EAN8", width: 1});
  19. newTest("98765432109213", {format: "ITF14", width: 1});
  20. newTest("12345", {format: "pharmacode", width: 1});
  21. newTest("133742", {format: "CODE128C", width: 1});
  22. newTest("12345674", {format: "MSI", width: 1});
  23. newTest("1234567890", {format: "codabar", width: 1});
  24. newTest("A1234567890A", {format: "codabar", width: 1});
  25. newTest("C1234567890D", {format: "codabar", width: 1});
  26. newTest("12345674", {format: "GenericBarcode", width: 1});
  27. newTest("Such customize!", {
  28. width: 1,
  29. height: 50,
  30. format: "CODE128",
  31. displayValue: true,
  32. fontOptions: "bold",
  33. font: "cursive",
  34. textAlign: "right",
  35. textMargin: 20,
  36. fontSize: 28,
  37. background: "#f00",
  38. lineColor: "#0ff",
  39. margin: 10,
  40. marginTop: 60,
  41. marginBottom: 5,
  42. marginLeft: 60,
  43. marginRight: 30
  44. });
  45. }