ean13 passes integration

This commit is contained in:
Henry Schimke
2022-12-09 18:37:27 -06:00
parent 81f2298dd0
commit 42e5312e4c
12 changed files with 304 additions and 330 deletions

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class EAN13BlackBox1TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox1TestCase() {
super("src/test/resources/blackbox/ean13-1", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(30, 32, 0.0f);
addTest(27, 32, 180.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* This is a set of mobile image taken at 480x360 with difficult lighting.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox2TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox2TestCase() {
super("src/test/resources/blackbox/ean13-2", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(12, 17, 0, 1, 0.0f);
addTest(11, 17, 0, 1, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox3TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox3TestCase() {
super("src/test/resources/blackbox/ean13-3", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(53, 55, 0.0f);
addTest(55, 55, 180.0f);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A very difficult set of images taken with extreme shadows and highlights.
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox4TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox4TestCase() {
super("src/test/resources/blackbox/ean13-4", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(6, 13, 1, 1, 0.0f);
addTest(7, 13, 1, 1, 180.0f);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2011 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A set of blurry images taken with a fixed-focus device.
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox5BlurryTestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox5BlurryTestCase() {
super("src/test/resources/blackbox/ean13-5", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(0, 0, 0.0f);
addTest(0, 0, 180.0f);
}
}

View File

@@ -14,9 +14,7 @@
* limitations under the License.
*/
use rxing::{
BarcodeFormat, MultiFormatReader, oned::EAN8Reader,
};
use rxing::{oned::EAN8Reader, BarcodeFormat, MultiFormatReader};
mod common;
@@ -24,18 +22,17 @@ mod common;
* @author Sean Owen
*/
#[test]
fn ean8_black_box1_test_case() {
fn ean8_black_box1_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean8-1",
// MultiFormatReader::default(),
EAN8Reader{},
BarcodeFormat::EAN_8,
);
"test_resources/blackbox/ean8-1",
// MultiFormatReader::default(),
EAN8Reader {},
BarcodeFormat::EAN_8,
);
// super("src/test/resources/blackbox/ean8-1", new MultiFormatReader(), BarcodeFormat.EAN_8);
tester.add_test(8, 8, 0.0);
tester.add_test(8, 8, 180.0);
tester.test_black_box()
}
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use rxing::{oned::EAN13Reader, BarcodeFormat, MultiFormatReader};
mod common;
/**
* @author Sean Owen
*/
#[test]
fn ean13_black_box1_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean13-1",
// MultiFormatReader::default(),
EAN13Reader {},
BarcodeFormat::EAN_13,
);
// super("src/test/resources/blackbox/ean13-1", new MultiFormatReader(), BarcodeFormat.EAN_13);
tester.add_test(30, 32, 0.0);
tester.add_test(27, 32, 180.0);
tester.test_black_box()
}
/**
* This is a set of mobile image taken at 480x360 with difficult lighting.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
#[test]
fn ean13_black_box2_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean13-2",
// MultiFormatReader::default(),
EAN13Reader {},
BarcodeFormat::EAN_13,
);
// super("src/test/resources/blackbox/ean13-2", new MultiFormatReader(), BarcodeFormat.EAN_13);
tester.add_test_complex(12, 17, 0, 1, 0.0);
tester.add_test_complex(11, 17, 0, 1, 180.0);
tester.test_black_box()
}
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
#[test]
fn ean13_black_box3_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean13-3",
// MultiFormatReader::default(),
EAN13Reader {},
BarcodeFormat::EAN_13,
);
// super("src/test/resources/blackbox/ean13-3", new MultiFormatReader(), BarcodeFormat.EAN_13);
tester.add_test(53, 55, 0.0);
tester.add_test(55, 55, 180.0);
tester.test_black_box()
}
/**
* A very difficult set of images taken with extreme shadows and highlights.
* @author dswitkin@google.com (Daniel Switkin)
*/
#[test]
fn ean13_black_box4_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean13-4",
// MultiFormatReader::default(),
EAN13Reader {},
BarcodeFormat::EAN_13,
);
// super("src/test/resources/blackbox/ean13-4", new MultiFormatReader(), BarcodeFormat.EAN_13);
tester.add_test_complex(6, 13, 1, 1, 0.0);
tester.add_test_complex(7, 13, 1, 1, 180.0);
tester.test_black_box()
}
/**
* A set of blurry images taken with a fixed-focus device.
* @author dswitkin@google.com (Daniel Switkin)
*/
#[test]
fn ean13_black_box5_blurry_test_case() {
let mut tester = common::AbstractBlackBoxTestCase::new(
"test_resources/blackbox/ean13-5",
// MultiFormatReader::default(),
EAN13Reader {},
BarcodeFormat::EAN_13,
);
// super("src/test/resources/blackbox/ean13-5", new MultiFormatReader(), BarcodeFormat.EAN_13);
tester.add_test(0, 0, 0.0);
tester.add_test(0, 0, 180.0);
tester.test_black_box()
}