|
| 1 | +## ADDED Requirements |
| 2 | + |
| 3 | +### Requirement: DataMatrix format selection |
| 4 | + |
| 5 | +The Barcode Generator widget SHALL offer "Data Matrix" as a top-level barcode format alongside the existing Barcode (1D) and QR Code options. |
| 6 | + |
| 7 | +#### Scenario: Data Matrix appears in format list |
| 8 | + |
| 9 | +- **WHEN** a developer configures the Barcode Generator in Studio Pro and opens the Barcode Format property |
| 10 | +- **THEN** "Data Matrix" is available as a selectable format value |
| 11 | + |
| 12 | +#### Scenario: Selecting Data Matrix routes to the DataMatrix renderer |
| 13 | + |
| 14 | +- **WHEN** the Barcode Format is set to "Data Matrix" and a non-empty value is provided |
| 15 | +- **THEN** the widget renders a DataMatrix symbol as inline SVG, and does not invoke the 1D barcode or QR code renderers |
| 16 | + |
| 17 | +### Requirement: Plain DataMatrix generation |
| 18 | + |
| 19 | +The widget SHALL encode the provided string value as a standard (non-GS1) DataMatrix symbol when GS1 mode is off. |
| 20 | + |
| 21 | +#### Scenario: Encode a plain string |
| 22 | + |
| 23 | +- **WHEN** the format is "Data Matrix", GS1 mode is off, and the value is `ABC-12345` |
| 24 | +- **THEN** the widget renders a scannable DataMatrix symbol encoding exactly that string |
| 25 | + |
| 26 | +#### Scenario: Round-trip with the scanner |
| 27 | + |
| 28 | +- **WHEN** a plain DataMatrix generated by the widget is scanned by the Barcode Scanner widget |
| 29 | +- **THEN** the decoded value equals the original input string |
| 30 | + |
| 31 | +### Requirement: GS1 DataMatrix generation |
| 32 | + |
| 33 | +The widget SHALL support GS1 DataMatrix encoding (FNC1 leading character, GS1 Application Identifier data) when GS1 mode is enabled, so pharma serialization data (GTIN, expiry, batch, serial) can be encoded. |
| 34 | + |
| 35 | +#### Scenario: Encode GS1 Application Identifier data |
| 36 | + |
| 37 | +- **WHEN** GS1 mode is enabled and the value is `(01)09501101020917(17)261231(10)ABC123` |
| 38 | +- **THEN** the widget renders a GS1 DataMatrix symbol with the FNC1 indicator and the AI-structured data intact |
| 39 | + |
| 40 | +#### Scenario: GS1 mode toggles the encoder |
| 41 | + |
| 42 | +- **WHEN** the same value is rendered first with GS1 mode off and then on |
| 43 | +- **THEN** the off result is a plain DataMatrix and the on result is a GS1 DataMatrix (distinct symbols) |
| 44 | + |
| 45 | +### Requirement: DataMatrix symbol shape |
| 46 | + |
| 47 | +The widget SHALL allow choosing between square and rectangular DataMatrix symbol shapes. |
| 48 | + |
| 49 | +#### Scenario: Rectangular shape |
| 50 | + |
| 51 | +- **WHEN** the DataMatrix shape option is set to "rectangle" |
| 52 | +- **THEN** the rendered symbol uses a rectangular DataMatrix layout |
| 53 | + |
| 54 | +#### Scenario: Square shape is the default |
| 55 | + |
| 56 | +- **WHEN** no shape is explicitly chosen |
| 57 | +- **THEN** the widget renders a square DataMatrix symbol |
| 58 | + |
| 59 | +### Requirement: DataMatrix value validation |
| 60 | + |
| 61 | +The widget SHALL validate the DataMatrix value and surface errors consistently with existing formats, honoring the configured log level. |
| 62 | + |
| 63 | +#### Scenario: Empty value at design time |
| 64 | + |
| 65 | +- **WHEN** no value is present (design time, before dynamic binding resolves) |
| 66 | +- **THEN** validation passes and no error is shown, matching existing barcode behavior |
| 67 | + |
| 68 | +#### Scenario: Malformed GS1 AI syntax |
| 69 | + |
| 70 | +- **WHEN** GS1 mode is on and the value has unbalanced or malformed Application Identifier syntax |
| 71 | +- **THEN** the widget reports a validation error and, when the log level permits, displays the generic "unable to generate" message and logs detail to the console |
| 72 | + |
| 73 | +#### Scenario: Encoding failure |
| 74 | + |
| 75 | +- **WHEN** the DataMatrix encoder throws for an invalid input |
| 76 | +- **THEN** the error is caught, the error UI is shown per log level, and the widget does not crash |
| 77 | + |
| 78 | +### Requirement: DataMatrix download |
| 79 | + |
| 80 | +The widget SHALL allow downloading a generated DataMatrix as a PNG using the existing download control, when downloads are enabled. |
| 81 | + |
| 82 | +#### Scenario: Download a DataMatrix as PNG |
| 83 | + |
| 84 | +- **WHEN** downloads are enabled and the user activates the download button on a DataMatrix |
| 85 | +- **THEN** a PNG file of the rendered DataMatrix is downloaded, using the configured or an auto-generated filename |
| 86 | + |
| 87 | +### Requirement: DataMatrix editor preview |
| 88 | + |
| 89 | +The widget SHALL show a representative DataMatrix preview in the Studio Pro editor when the Data Matrix format is selected. |
| 90 | + |
| 91 | +#### Scenario: Preview in Studio Pro |
| 92 | + |
| 93 | +- **WHEN** the Data Matrix format is selected in the Studio Pro page editor |
| 94 | +- **THEN** the widget preview displays a DataMatrix-style glyph rather than a 1D barcode or QR preview |
0 commit comments