|
48 | 48 | import java.io.File; |
49 | 49 | import java.net.URISyntaxException; |
50 | 50 |
|
| 51 | +import org.cip4.jdflib.auto.JDFAutoMedia.EISOPaperSubstrate; |
51 | 52 | import org.cip4.jdflib.auto.JDFAutoMedia.EMediaType; |
52 | 53 | import org.cip4.jdflib.auto.JDFAutoMedia.EMediaUnit; |
| 54 | +import org.cip4.jdflib.auto.JDFAutoPart.EnumSide; |
53 | 55 | import org.cip4.jdflib.core.AttributeName; |
54 | 56 | import org.cip4.jdflib.core.ElementName; |
55 | 57 | import org.cip4.jdflib.core.JDFComment; |
56 | 58 | import org.cip4.jdflib.core.JDFConstants; |
57 | 59 | import org.cip4.jdflib.core.JDFElement; |
| 60 | +import org.cip4.jdflib.core.JDFElement.ESides; |
58 | 61 | import org.cip4.jdflib.core.JDFElement.EnumVersion; |
59 | 62 | import org.cip4.jdflib.core.JDFNodeInfo; |
60 | 63 | import org.cip4.jdflib.core.JDFResourceLink.EnumUsage; |
|
64 | 67 | import org.cip4.jdflib.extensions.AuditHelper; |
65 | 68 | import org.cip4.jdflib.extensions.AuditHelper.eAudit; |
66 | 69 | import org.cip4.jdflib.extensions.AuditPoolHelper; |
| 70 | +import org.cip4.jdflib.extensions.IntentHelper; |
| 71 | +import org.cip4.jdflib.extensions.IntentHelper.EIntentType; |
| 72 | +import org.cip4.jdflib.extensions.ProductHelper; |
| 73 | +import org.cip4.jdflib.extensions.ProductHelper.eProductType; |
67 | 74 | import org.cip4.jdflib.extensions.ResourceHelper; |
68 | 75 | import org.cip4.jdflib.extensions.SetHelper; |
69 | 76 | import org.cip4.jdflib.extensions.XJDFConstants; |
70 | 77 | import org.cip4.jdflib.extensions.XJDFHelper; |
71 | 78 | import org.cip4.jdflib.jmf.JDFDeviceInfo; |
72 | 79 | import org.cip4.jdflib.resource.JDFProcessRun; |
| 80 | +import org.cip4.jdflib.resource.intent.JDFColorIntent; |
73 | 81 | import org.cip4.jdflib.resource.process.JDFAddress; |
| 82 | +import org.cip4.jdflib.resource.process.JDFColor; |
74 | 83 | import org.cip4.jdflib.resource.process.JDFCompany; |
75 | 84 | import org.cip4.jdflib.resource.process.JDFContact; |
76 | 85 | import org.cip4.jdflib.resource.process.JDFMedia; |
@@ -329,6 +338,69 @@ void testMinimal() |
329 | 338 | writeBothJson(h.getRoot(), jsonWriter, "minimal.json", true, false); |
330 | 339 | } |
331 | 340 |
|
| 341 | + /** |
| 342 | + * |
| 343 | + */ |
| 344 | + @Test |
| 345 | + void testProductMinimal() |
| 346 | + { |
| 347 | + final JSONWriter jsonWriter = getXJDFWriter(true); |
| 348 | + |
| 349 | + final XJDFHelper h = getBaseXJDF(); |
| 350 | + h.getRoot().removeChild(null, null, 0); |
| 351 | + |
| 352 | + writeBothJson(h.getRoot(), jsonWriter, "minimalproduct.json", true, true, new File(sm_dirTestData + "schema/Version_2_3/productonly.json")); |
| 353 | + } |
| 354 | + |
| 355 | + /** |
| 356 | + * |
| 357 | + */ |
| 358 | + @Test |
| 359 | + void testProductType() |
| 360 | + { |
| 361 | + final JSONWriter jsonWriter = getXJDFWriter(true); |
| 362 | + |
| 363 | + final XJDFHelper h = getBaseXJDF(); |
| 364 | + h.getRoot().removeChild(null, null, 0); |
| 365 | + final ProductHelper product = h.getCreateRootProduct(0); |
| 366 | + product.setProductType(eProductType.BusinessCard); |
| 367 | + |
| 368 | + writeBothJson(h.getRoot(), jsonWriter, "productType.json", true, true, new File(sm_dirTestData + "schema/Version_2_3/productonly.json")); |
| 369 | + } |
| 370 | + |
| 371 | + /** |
| 372 | + * |
| 373 | + */ |
| 374 | + @Test |
| 375 | + void testProductLayout() |
| 376 | + { |
| 377 | + final JSONWriter jsonWriter = getXJDFWriter(true); |
| 378 | + |
| 379 | + final XJDFHelper h = getBaseXJDF(); |
| 380 | + h.getRoot().removeChild(null, null, 0); |
| 381 | + final ProductHelper product = h.getCreateRootProduct(0); |
| 382 | + product.setProductType(eProductType.BusinessCard); |
| 383 | + final IntentHelper loi = product.appendIntent(EIntentType.LayoutIntent); |
| 384 | + loi.setSpan(AttributeName.DIMENSIONS, "300 200"); |
| 385 | + loi.setSpan(AttributeName.SIDES, ESides.TwoSidedHeadToHead.name()); |
| 386 | + |
| 387 | + final IntentHelper cii = product.appendIntent(EIntentType.ColorIntent); |
| 388 | + final JDFColorIntent ci = (JDFColorIntent) cii.getCreateResource(); |
| 389 | + final KElement sc = ci.getCreateElement(XJDFConstants.SurfaceColor); |
| 390 | + sc.setAttribute(AttributeName.SURFACE, EnumSide.Front, null); |
| 391 | + sc.setAttribute(ElementName.COLORSUSED, JDFColor.getCMYKSeparations(), null); |
| 392 | + final KElement scb = ci.getCreateElement(XJDFConstants.SurfaceColor, null, 1); |
| 393 | + scb.setAttribute(AttributeName.SURFACE, EnumSide.Back, null); |
| 394 | + scb.setAttribute(ElementName.COLORSUSED, "Black", null); |
| 395 | + |
| 396 | + final IntentHelper mi = product.appendIntent(EIntentType.MediaIntent); |
| 397 | + mi.setSpan(AttributeName.MEDIATYPE, EMediaType.Paper.name()); |
| 398 | + mi.setSpan(AttributeName.WEIGHT, "130"); |
| 399 | + mi.setSpan(AttributeName.ISOPAPERSUBSTRATE, EISOPaperSubstrate.PS1.name()); |
| 400 | + |
| 401 | + writeBothJson(h.getRoot(), jsonWriter, "productLayout.json", true, true, new File(sm_dirTestData + "schema/Version_2_3/productonly.json")); |
| 402 | + } |
| 403 | + |
332 | 404 | /** |
333 | 405 | * |
334 | 406 | */ |
|
0 commit comments