def test_fig23_best_mask(): # ISO/IEC 18004:2015(E) - 7.8.2 Data mask patterns # Figure 23 matrix = read_matrix('fig-23-unmasked') mask = encoder.find_and_apply_best_mask(matrix, 1, is_micro=False) assert 0 == mask ref_matrix = read_matrix('fig-23-mask-0') assert ref_matrix == matrix
def test_fig23_best_mask(): # ISO/IEC 18004:2015(E) - 7.8.2 Data mask patterns # Figure 23 matrix = read_matrix('fig-23-unmasked') mask, matrix = encoder.find_and_apply_best_mask(matrix, 1, is_micro=False) assert 0 == mask ref_matrix = read_matrix('fig-23-mask-0') assert ref_matrix == matrix
def test_figure22_mask3(): # ISO/IEC 18004:2015(E) - 7.8.2 Data mask patterns # Figure 22 - Mask 3 version = consts.VERSION_M4 matrix = _make_figure22_matrix() mask = encoder.find_and_apply_best_mask(matrix, version, True, proposed_mask=3) assert 3 == mask # Format info = dark modules for i in range(9): matrix[8][i] = 0x1 matrix[i][8] = 0x1 ref_matrix = read_matrix('fig-22-mask-3') assert len(ref_matrix) == len(matrix) assert ref_matrix == matrix
def test_figure22_mask3(): # ISO/IEC 18004:2015(E) - 7.8.2 Data mask patterns # Figure 22 - Mask 3 version = consts.VERSION_M4 matrix = _make_figure22_matrix() mask, matrix = encoder.find_and_apply_best_mask(matrix, version, True, proposed_mask=3) assert 3 == mask # Format info = dark modules for i in range(9): matrix[8][i] = 0x1 matrix[i][8] = 0x1 ref_matrix = read_matrix('fig-22-mask-3') assert len(ref_matrix) == len(matrix) assert ref_matrix == matrix