mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
Added integration-tests for all decoders; Split up integration and unit tests
This commit is contained in:
@@ -29,7 +29,7 @@ define(
|
||||
error = 0,
|
||||
singleError = 0,
|
||||
modulo = this.MODULO,
|
||||
maxSingleError = this.SINGLE_CODE_ERROR || 0.9;
|
||||
maxSingleError = this.SINGLE_CODE_ERROR || 1;
|
||||
|
||||
for (i = 0; i < counter.length; i++) {
|
||||
singleError = Math.abs(code[i] - counter[i]);
|
||||
|
||||
@@ -130,7 +130,9 @@ define(
|
||||
[2, 1, 1, 2, 1, 4],
|
||||
[2, 1, 1, 2, 3, 2],
|
||||
[2, 3, 3, 1, 1, 1, 2]
|
||||
]}
|
||||
]},
|
||||
SINGLE_CODE_ERROR: {value: 1},
|
||||
AVG_CODE_ERROR: {value: 0.5}
|
||||
};
|
||||
|
||||
Code128Reader.prototype = Object.create(BarcodeReader.prototype, properties);
|
||||
@@ -207,7 +209,7 @@ define(
|
||||
}
|
||||
normalized = self._normalize(counter, 13);
|
||||
error = self._matchPattern(normalized, self.CODE_PATTERN[self.STOP_CODE]);
|
||||
if (error < 3) {
|
||||
if (error < self.AVG_CODE_ERROR) {
|
||||
bestMatch.error = error;
|
||||
bestMatch.start = i - sum;
|
||||
bestMatch.end = i;
|
||||
@@ -266,7 +268,7 @@ define(
|
||||
bestMatch.error = error;
|
||||
}
|
||||
}
|
||||
if (bestMatch.error < 3) {
|
||||
if (bestMatch.error < self.AVG_CODE_ERROR) {
|
||||
bestMatch.start = i - sum;
|
||||
bestMatch.end = i;
|
||||
return bestMatch;
|
||||
|
||||
+1
-1
@@ -452,7 +452,7 @@ function(Code128Reader,
|
||||
}
|
||||
}, config);
|
||||
this.init(config, function() {
|
||||
Events.once("detected", function(result) {
|
||||
Events.once("processed", function(result) {
|
||||
_stopped = true;
|
||||
resultCallback.call(null, result);
|
||||
}, true);
|
||||
|
||||
Reference in New Issue
Block a user