Skip to content

Commit

Permalink
没什么用
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Mar 8, 2022
1 parent b9abe81 commit 5455eb2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/src/datamatrix/encoder/ascii_encoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class ASCIIEncoder implements Encoder {
} else {
int c = context.currentChar;
int newMode = HighLevelEncoder.lookAheadTest(
context.message, context.pos, encodingMode);
context.message,
context.pos,
encodingMode,
);
if (newMode != encodingMode) {
switch (newMode) {
case HighLevelEncoder.BASE256_ENCODATION:
Expand Down
13 changes: 12 additions & 1 deletion lib/src/datamatrix/encoder/high_level_encoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,18 @@ class HighLevelEncoder {
return ASCII_ENCODATION;
}
if (minCount == 1) {
return intCharCounts.indexOf(min);
if (mins[BASE256_ENCODATION] > 0) {
return BASE256_ENCODATION;
}
if (mins[EDIFACT_ENCODATION] > 0) {
return EDIFACT_ENCODATION;
}
if (mins[TEXT_ENCODATION] > 0) {
return TEXT_ENCODATION;
}
if (mins[X12_ENCODATION] > 0) {
return X12_ENCODATION;
}
}

// to fix result
Expand Down
10 changes: 7 additions & 3 deletions test/core/datamatrix/encoder/high_level_encode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ void main() {

visualized = encodeHighLevel("aimaimaim{txt}\u0004");
expect(
"239 91 11 91 11 91 11 254 124 117 121 117 126 5 129 237", visualized);
"239 91 11 91 11 91 11 254 124 117 121 117 126 5 129 237",
visualized,
);
});

test('testX12Encodation', () {
Expand Down Expand Up @@ -339,8 +341,10 @@ void main() {
//of an encoding problem of the character 0x0060 in Java source code.

String visualized = encodeHighLevel("fiykmj*Rh2`,e6");
expect("103 106 122 108 110 107 43 83 105 51 97 45 102 55 129 237",
visualized);
expect(
"103 106 122 108 110 107 43 83 105 51 97 45 102 55 129 237",
visualized,
);
});

test('testMacroCharacters', () {
Expand Down

0 comments on commit 5455eb2

Please sign in to comment.