mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
consolidate integration for qr and aztec
This commit is contained in:
@@ -1,39 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{aztec::AztecReader, BarcodeFormat};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A test of Aztec barcodes under real world lighting conditions, taken with a mobile phone.
|
|
||||||
*
|
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
|
||||||
*/
|
|
||||||
#[test]
|
|
||||||
fn AztecBlackBox2TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new(
|
|
||||||
"test_resources/blackbox/aztec-2",
|
|
||||||
Box::new(AztecReader{}),
|
|
||||||
BarcodeFormat::AZTEC);
|
|
||||||
// super(, new AztecReader(), BarcodeFormat.AZTEC);
|
|
||||||
tester.addTest(5, 5, 0.0);
|
|
||||||
tester.addTest(4, 4, 90.0);
|
|
||||||
tester.addTest(6, 6, 180.0);
|
|
||||||
tester.addTest(3, 3, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
@@ -1,219 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::qrcode::QRCodeReader;
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sean Owen
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox1TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new(
|
|
||||||
"test_resources/blackbox/qrcode-1",
|
|
||||||
Box::new(QRCodeReader {}),
|
|
||||||
rxing::BarcodeFormat::QR_CODE,
|
|
||||||
);
|
|
||||||
// super("src/test/resources/blackbox/qrcode-1", new MultiFormatReader(), BarcodeFormat.QR_CODE);
|
|
||||||
tester.addTest(17, 17, 0.0);
|
|
||||||
tester.addTest(14, 14, 90.0);
|
|
||||||
tester.addTest(17, 17, 180.0);
|
|
||||||
tester.addTest(14, 14, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 16 - 0
|
|
||||||
|
|
||||||
// TEST CASE 15 FAILING AT allignment patter finder! (line 88) FROM detector 486
|
|
||||||
|
|
||||||
/*
|
|
||||||
JAVA RESULTS::::
|
|
||||||
|
|
||||||
Atul Starting src/test/resources/blackbox/qrcode-1/2.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/9.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/16.png
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/11.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/5.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/3.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/6.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/14.png
|
|
||||||
could not read at rotation 0.000000
|
|
||||||
could not read at rotation 0.000000 w/TH
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
could not read at rotation 180.000000
|
|
||||||
could not read at rotation 180.000000 w/TH
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/8.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/13.png
|
|
||||||
could not read at rotation 0.000000
|
|
||||||
could not read at rotation 0.000000 w/TH
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
could not read at rotation 180.000000
|
|
||||||
could not read at rotation 180.000000 w/TH
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/17.png
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/12.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/7.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/4.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/19.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/18.png
|
|
||||||
could not read at rotation 0.000000
|
|
||||||
could not read at rotation 0.000000 w/TH
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
could not read at rotation 180.000000
|
|
||||||
could not read at rotation 180.000000 w/TH
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/1.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/15.png
|
|
||||||
could not read at rotation 90.000000
|
|
||||||
could not read at rotation 90.000000 w/TH
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/10.png
|
|
||||||
Starting src/test/resources/blackbox/qrcode-1/20.png
|
|
||||||
could not read at rotation 270.000000
|
|
||||||
could not read at rotation 270.000000 w/TH
|
|
||||||
Rotation 0 degrees:
|
|
||||||
17 of 20 images passed (17 required)
|
|
||||||
0 failed due to misreads, 3 not detected
|
|
||||||
17 of 20 images passed with try harder (17 required)
|
|
||||||
0 failed due to misreads, 3 not detected
|
|
||||||
Rotation 90 degrees:
|
|
||||||
14 of 20 images passed (14 required)
|
|
||||||
0 failed due to misreads, 6 not detected
|
|
||||||
14 of 20 images passed with try harder (14 required)
|
|
||||||
0 failed due to misreads, 6 not detected
|
|
||||||
Rotation 180 degrees:
|
|
||||||
17 of 20 images passed (17 required)
|
|
||||||
0 failed due to misreads, 3 not detected
|
|
||||||
17 of 20 images passed with try harder (17 required)
|
|
||||||
0 failed due to misreads, 3 not detected
|
|
||||||
Rotation 270 degrees:
|
|
||||||
14 of 20 images passed (14 required)
|
|
||||||
0 failed due to misreads, 6 not detected
|
|
||||||
14 of 20 images passed with try harder (14 required)
|
|
||||||
0 failed due to misreads, 6 not detected
|
|
||||||
Decoded 124 images out of 160 (77%, 124 required)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
rxing TEST RESULTS::::
|
|
||||||
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/1.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/10.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/11.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/12.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/13.png
|
|
||||||
FINE :: could not read at rotation 0
|
|
||||||
FINE :: could not read at rotation 0 w/TH
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 180
|
|
||||||
FINE :: could not read at rotation 180 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/14.png
|
|
||||||
FINE :: could not read at rotation 0
|
|
||||||
FINE :: could not read at rotation 0 w/TH
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 180
|
|
||||||
FINE :: could not read at rotation 180 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/15.png
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 180
|
|
||||||
FINE :: could not read at rotation 180 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/16.png
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/17.png
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/18.png
|
|
||||||
FINE :: could not read at rotation 0
|
|
||||||
FINE :: could not read at rotation 0 w/TH
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 180
|
|
||||||
FINE :: could not read at rotation 180 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/19.png
|
|
||||||
FINE :: could not read at rotation 180
|
|
||||||
FINE :: could not read at rotation 180 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/2.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/20.png
|
|
||||||
FINE :: could not read at rotation 90
|
|
||||||
FINE :: could not read at rotation 90 w/TH
|
|
||||||
FINE :: could not read at rotation 270
|
|
||||||
FINE :: could not read at rotation 270 w/TH
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/3.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/4.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/5.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/6.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/7.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/8.png
|
|
||||||
INFO :: Starting test_resources/blackbox/qrcode-1/9.png
|
|
||||||
INFO :: Rotation 0 degrees:
|
|
||||||
INFO :: 17 of 20 images passed (17 required)
|
|
||||||
INFO :: 0 failed due to misreads, 3 not detected
|
|
||||||
INFO :: 17 of 20 images passed with try harder (17 required)
|
|
||||||
INFO :: 0 failed due to misreads, 3 not detected
|
|
||||||
INFO :: Rotation 90 degrees:
|
|
||||||
INFO :: 13 of 20 images passed (14 required)
|
|
||||||
INFO :: 0 failed due to misreads, 7 not detected
|
|
||||||
INFO :: 13 of 20 images passed with try harder (14 required)
|
|
||||||
INFO :: 0 failed due to misreads, 7 not detected
|
|
||||||
INFO :: Rotation 180 degrees:
|
|
||||||
INFO :: 15 of 20 images passed (17 required)
|
|
||||||
INFO :: 0 failed due to misreads, 5 not detected
|
|
||||||
INFO :: 15 of 20 images passed with try harder (17 required)
|
|
||||||
INFO :: 0 failed due to misreads, 5 not detected
|
|
||||||
INFO :: Rotation 270 degrees:
|
|
||||||
INFO :: 14 of 20 images passed (14 required)
|
|
||||||
INFO :: 0 failed due to misreads, 6 not detected
|
|
||||||
INFO :: 14 of 20 images passed with try harder (14 required)
|
|
||||||
INFO :: 0 failed due to misreads, 6 not detected
|
|
||||||
INFO :: Decoded 118 images out of 160 (73, 124 required)
|
|
||||||
WARN :: --- Test failed by 6 images
|
|
||||||
|
|
||||||
*/
|
|
||||||
@@ -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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{qrcode::QRCodeReader, BarcodeFormat};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Sean Owen
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox2TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new("test_resources/blackbox/qrcode-2", Box::new(QRCodeReader{}), BarcodeFormat::QR_CODE);
|
|
||||||
tester.addTest(31, 31, 0.0);
|
|
||||||
tester.addTest(30, 30, 90.0);
|
|
||||||
tester.addTest(30, 30, 180.0);
|
|
||||||
tester.addTest(30, 30, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 24
|
|
||||||
@@ -1,37 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{qrcode::QRCodeReader, BarcodeFormat};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox3TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new("test_resources/blackbox/qrcode-3", Box::new(QRCodeReader{}), BarcodeFormat::QR_CODE);
|
|
||||||
tester.addTest(38, 38, 0.0);
|
|
||||||
tester.addTest(39, 39, 90.0);
|
|
||||||
tester.addTest(36, 36, 180.0);
|
|
||||||
tester.addTest(39, 39, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 11 - 90
|
|
||||||
// 13 - 90
|
|
||||||
@@ -1,37 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{qrcode::QRCodeReader, BarcodeFormat};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests of various QR Codes from t-shirts, which are notoriously not flat.
|
|
||||||
*
|
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox4TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new("test_resources/blackbox/qrcode-4", Box::new(QRCodeReader{}), BarcodeFormat::QR_CODE);
|
|
||||||
tester.addTest(36, 36, 0.0);
|
|
||||||
tester.addTest(35, 35, 90.0);
|
|
||||||
tester.addTest(35, 35, 180.0);
|
|
||||||
tester.addTest(35, 35, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,39 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{BarcodeFormat, qrcode::QRCodeReader};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some very difficult exposure conditions including self-shadowing, which happens a lot when
|
|
||||||
* pointing down at a barcode (i.e. the phone's shadow falls across part of the image).
|
|
||||||
* The global histogram gets about 5/15, where the local one gets 15/15.
|
|
||||||
*
|
|
||||||
* @author dswitkin@google.com (Daniel Switkin)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox5TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new("test_resources/blackbox/qrcode-5", Box::new(QRCodeReader{}), BarcodeFormat::QR_CODE);
|
|
||||||
tester.addTest(19, 19, 0.0);
|
|
||||||
tester.addTest(19, 19, 90.0);
|
|
||||||
tester.addTest(19, 19, 180.0);
|
|
||||||
tester.addTest(19, 19, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
use rxing::{qrcode::QRCodeReader, BarcodeFormat};
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These tests are supplied by Tim Gernat and test finder pattern detection at small size and under
|
|
||||||
* rotation, which was a weak spot.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn QRCodeBlackBox6TestCase() {
|
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new("test_resources/blackbox/qrcode-6", Box::new(QRCodeReader{}), BarcodeFormat::QR_CODE);
|
|
||||||
tester.addTest(15, 15, 0.0);
|
|
||||||
tester.addTest(14, 14, 90.0);
|
|
||||||
tester.addTest(13, 13, 180.0);
|
|
||||||
tester.addTest(14, 14, 270.0);
|
|
||||||
|
|
||||||
tester.testBlackBox();
|
|
||||||
}
|
|
||||||
@@ -21,8 +21,6 @@ mod common;
|
|||||||
/**
|
/**
|
||||||
* @author David Olivier
|
* @author David Olivier
|
||||||
*/
|
*/
|
||||||
// public final class AztecBlackBox1TestCase extends AbstractBlackBoxTestCase {
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn aztec_black_box1_test_case() {
|
fn aztec_black_box1_test_case() {
|
||||||
let mut tester = common::AbstractBlackBoxTestCase::new(
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
@@ -40,4 +38,23 @@ fn aztec_black_box1_test_case() {
|
|||||||
tester.testBlackBox();
|
tester.testBlackBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
// }
|
/**
|
||||||
|
* A test of Aztec barcodes under real world lighting conditions, taken with a mobile phone.
|
||||||
|
*
|
||||||
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
|
*/
|
||||||
|
#[test]
|
||||||
|
fn aztec_black_box2_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/aztec-2",
|
||||||
|
Box::new(AztecReader {}),
|
||||||
|
BarcodeFormat::AZTEC,
|
||||||
|
);
|
||||||
|
// super(, new AztecReader(), BarcodeFormat.AZTEC);
|
||||||
|
tester.addTest(5, 5, 0.0);
|
||||||
|
tester.addTest(4, 4, 90.0);
|
||||||
|
tester.addTest(6, 6, 180.0);
|
||||||
|
tester.addTest(3, 3, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
141
tests/qr_code_blackbox_tests.rs
Normal file
141
tests/qr_code_blackbox_tests.rs
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
* 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::{qrcode::QRCodeReader, BarcodeFormat};
|
||||||
|
|
||||||
|
mod common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sean Owen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box1_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-1",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
rxing::BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
// super("src/test/resources/blackbox/qrcode-1", new MultiFormatReader(), BarcodeFormat.QR_CODE);
|
||||||
|
tester.addTest(17, 17, 0.0);
|
||||||
|
tester.addTest(14, 14, 90.0);
|
||||||
|
tester.addTest(17, 17, 180.0);
|
||||||
|
tester.addTest(14, 14, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sean Owen
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box2_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-2",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
tester.addTest(31, 31, 0.0);
|
||||||
|
tester.addTest(30, 30, 90.0);
|
||||||
|
tester.addTest(30, 30, 180.0);
|
||||||
|
tester.addTest(30, 30, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box3_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-3",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
tester.addTest(38, 38, 0.0);
|
||||||
|
tester.addTest(39, 39, 90.0);
|
||||||
|
tester.addTest(36, 36, 180.0);
|
||||||
|
tester.addTest(39, 39, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests of various QR Codes from t-shirts, which are notoriously not flat.
|
||||||
|
*
|
||||||
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box4_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-4",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
tester.addTest(36, 36, 0.0);
|
||||||
|
tester.addTest(35, 35, 90.0);
|
||||||
|
tester.addTest(35, 35, 180.0);
|
||||||
|
tester.addTest(35, 35, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some very difficult exposure conditions including self-shadowing, which happens a lot when
|
||||||
|
* pointing down at a barcode (i.e. the phone's shadow falls across part of the image).
|
||||||
|
* The global histogram gets about 5/15, where the local one gets 15/15.
|
||||||
|
*
|
||||||
|
* @author dswitkin@google.com (Daniel Switkin)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box5_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-5",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
tester.addTest(19, 19, 0.0);
|
||||||
|
tester.addTest(19, 19, 90.0);
|
||||||
|
tester.addTest(19, 19, 180.0);
|
||||||
|
tester.addTest(19, 19, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These tests are supplied by Tim Gernat and test finder pattern detection at small size and under
|
||||||
|
* rotation, which was a weak spot.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn qrcode_black_box6_test_case() {
|
||||||
|
let mut tester = common::AbstractBlackBoxTestCase::new(
|
||||||
|
"test_resources/blackbox/qrcode-6",
|
||||||
|
Box::new(QRCodeReader {}),
|
||||||
|
BarcodeFormat::QR_CODE,
|
||||||
|
);
|
||||||
|
tester.addTest(15, 15, 0.0);
|
||||||
|
tester.addTest(14, 14, 90.0);
|
||||||
|
tester.addTest(13, 13, 180.0);
|
||||||
|
tester.addTest(14, 14, 270.0);
|
||||||
|
|
||||||
|
tester.testBlackBox();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user