mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
cargo fmt
This commit is contained in:
@@ -76,7 +76,7 @@ impl<T: Reader> GenericMultipleBarcodeReader<T> {
|
|||||||
xOffset: u32,
|
xOffset: u32,
|
||||||
yOffset: u32,
|
yOffset: u32,
|
||||||
currentDepth: u32,
|
currentDepth: u32,
|
||||||
) -> Result<(),Exceptions>{
|
) -> Result<(), Exceptions> {
|
||||||
if currentDepth > Self::MAX_DEPTH {
|
if currentDepth > Self::MAX_DEPTH {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -89,8 +89,8 @@ impl<T: Reader> GenericMultipleBarcodeReader<T> {
|
|||||||
//}
|
//}
|
||||||
if let Err(Exceptions::ReaderException(_)) = result {
|
if let Err(Exceptions::ReaderException(_)) = result {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}else if result.is_err(){
|
} else if result.is_err() {
|
||||||
return Err(result.err().unwrap())
|
return Err(result.err().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = result.expect("must exist");
|
let result = result.expect("must exist");
|
||||||
|
|||||||
@@ -16,7 +16,10 @@
|
|||||||
|
|
||||||
use std::{path::PathBuf, rc::Rc};
|
use std::{path::PathBuf, rc::Rc};
|
||||||
|
|
||||||
use crate::{BufferedImageLuminanceSource, BinaryBitmap, common::HybridBinarizer, MultiFormatReader, BarcodeFormat};
|
use crate::{
|
||||||
|
common::HybridBinarizer, BarcodeFormat, BinaryBitmap, BufferedImageLuminanceSource,
|
||||||
|
MultiFormatReader,
|
||||||
|
};
|
||||||
|
|
||||||
use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader};
|
use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader};
|
||||||
|
|
||||||
@@ -24,20 +27,20 @@ use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader};
|
|||||||
* Tests {@link MultipleBarcodeReader}.
|
* Tests {@link MultipleBarcodeReader}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn testMulti() {
|
fn testMulti() {
|
||||||
// Very basic test for now
|
// Very basic test for now
|
||||||
let mut testBase = PathBuf::from("test_resources/blackbox/multi-1");
|
let mut testBase = PathBuf::from("test_resources/blackbox/multi-1");
|
||||||
|
|
||||||
testBase.push("1.png");
|
testBase.push("1.png");
|
||||||
let image = image::io::Reader::open(testBase)
|
let image = image::io::Reader::open(testBase)
|
||||||
.expect("image must open")
|
.expect("image must open")
|
||||||
.decode()
|
.decode()
|
||||||
.expect("must decode");
|
.expect("must decode");
|
||||||
let source = BufferedImageLuminanceSource::new(image);
|
let source = BufferedImageLuminanceSource::new(image);
|
||||||
let bitmap = BinaryBitmap::new( Rc::new(HybridBinarizer::new(Box::new(source))));
|
let bitmap = BinaryBitmap::new(Rc::new(HybridBinarizer::new(Box::new(source))));
|
||||||
|
|
||||||
let mut reader = GenericMultipleBarcodeReader::new( MultiFormatReader::default());
|
let mut reader = GenericMultipleBarcodeReader::new(MultiFormatReader::default());
|
||||||
let results = reader.decodeMultiple(&bitmap).expect("must decode multi");
|
let results = reader.decodeMultiple(&bitmap).expect("must decode multi");
|
||||||
// assertNotNull(results);
|
// assertNotNull(results);
|
||||||
assert_eq!(2, results.len());
|
assert_eq!(2, results.len());
|
||||||
@@ -47,4 +50,4 @@ use super::{GenericMultipleBarcodeReader, MultipleBarcodeReader};
|
|||||||
|
|
||||||
assert_eq!("www.airtable.com/jobs", results[1].getText());
|
assert_eq!("www.airtable.com/jobs", results[1].getText());
|
||||||
assert_eq!(&BarcodeFormat::QR_CODE, results[1].getBarcodeFormat());
|
assert_eq!(&BarcodeFormat::QR_CODE, results[1].getBarcodeFormat());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ impl Reader for MultiFormatReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MultiFormatReader {
|
impl MultiFormatReader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode an image using the state set up by calling setHints() previously. Continuous scan
|
* Decode an image using the state set up by calling setHints() previously. Continuous scan
|
||||||
* clients will get a <b>large</b> speed increase by using this instead of decode().
|
* clients will get a <b>large</b> speed increase by using this instead of decode().
|
||||||
|
|||||||
Reference in New Issue
Block a user