Added integration-tests for all decoders; Split up integration and unit tests

This commit is contained in:
Christoph Oberhofer
2015-05-18 23:01:55 +02:00
parent d4ba4ccaae
commit e2f3d693dd
10 changed files with 234 additions and 96 deletions
+1 -1
View File
@@ -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]);
+5 -3
View File
@@ -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
View File
@@ -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);