Switches DMRE version to 12x64. Fixes failing unit test.
This commit is contained in:
parent
fa86d296f6
commit
7934fff316
|
@ -1,10 +1,14 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {defaultOptions, labelLayouts} from '../config/defaults';
|
||||
import {AppDefaults} from '../models/appDefaults.interface';
|
||||
import {LabelLayout} from '../models/labelLayout.interface';
|
||||
|
||||
import { BarcodeDataMatrixComponent } from './barcode-data-matrix.component';
|
||||
|
||||
describe('BarcodeDataMatrixComponent', () => {
|
||||
let component: BarcodeDataMatrixComponent;
|
||||
let fixture: ComponentFixture<BarcodeDataMatrixComponent>;
|
||||
const settings = new AppDefaults(defaultOptions);
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
|
@ -16,6 +20,10 @@ describe('BarcodeDataMatrixComponent', () => {
|
|||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BarcodeDataMatrixComponent);
|
||||
component = fixture.componentInstance;
|
||||
settings.labelLayout = labelLayouts.rectangular_lg;
|
||||
component.settings = settings;
|
||||
component.format = settings.labelLayout.barcodeType;
|
||||
component.value = '987654321-202101231122-ABCDE-0123';
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
|
|
@ -20,16 +20,18 @@ export class BarcodeDataMatrixComponent implements OnInit {
|
|||
}
|
||||
|
||||
renderBarcode(): void {
|
||||
bwipjs.toCanvas('barcodeCanvas', {
|
||||
bcid: this.format,
|
||||
text: this.value,
|
||||
scale: 2,
|
||||
width: this.settings.labelLayout.labelWidth,
|
||||
height: this.settings.labelLayout.labelHeight,
|
||||
includetext: false,
|
||||
textalign: 'center',
|
||||
version: '8x96',
|
||||
padding: this.settings.labelLayout.marginSize,
|
||||
});
|
||||
if (bwipjs && bwipjs.toCanvas && this.settings && this.format) {
|
||||
bwipjs.toCanvas('barcodeCanvas', {
|
||||
bcid: this.format,
|
||||
text: this.value,
|
||||
scale: 2,
|
||||
width: this.settings.labelLayout.labelWidth,
|
||||
height: this.settings.labelLayout.labelHeight,
|
||||
includetext: false,
|
||||
textalign: 'center',
|
||||
version: '12x64',
|
||||
padding: this.settings.labelLayout.marginSize,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,13 @@ export const labelLayouts = {
|
|||
}),
|
||||
rectangular_lg: new LabelLayout({
|
||||
name: '2in x 1.25in Rectangular Label',
|
||||
barcodeType: 'qrcode',
|
||||
barcodeType: 'datamatrixrectangularextension',
|
||||
type: 'rectangular_lg',
|
||||
numCols: 1,
|
||||
columnGap: 0,
|
||||
labelWidth: 38,
|
||||
labelHeight: 38,
|
||||
labelWidth: 47,
|
||||
labelHeight: 8,
|
||||
marginSize: 3,
|
||||
}),
|
||||
rectangular_sm: new LabelLayout({
|
||||
name: '96mm x 15mm Rectangular Label',
|
||||
|
@ -31,9 +32,9 @@ export const labelLayouts = {
|
|||
type: 'rectangular_sm',
|
||||
numCols: 1,
|
||||
columnGap: 0,
|
||||
labelWidth: 96,
|
||||
labelHeight: 8,
|
||||
marginSize: 4,
|
||||
labelWidth: 32,
|
||||
labelHeight: 6,
|
||||
marginSize: 3,
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue