diff --git a/src/client/result/AddressBookParsedResult.rs b/src/client/result/AddressBookParsedResult.rs index 142727c..86a09fe 100644 --- a/src/client/result/AddressBookParsedResult.rs +++ b/src/client/result/AddressBookParsedResult.rs @@ -26,7 +26,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser}; * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct AddressBookParsedRXingResult { names: Vec, nicknames: Vec, diff --git a/src/client/result/CalendarParsedResult.rs b/src/client/result/CalendarParsedResult.rs index fe629c9..1a1203e 100644 --- a/src/client/result/CalendarParsedResult.rs +++ b/src/client/result/CalendarParsedResult.rs @@ -367,8 +367,18 @@ impl CalendarParsedRXingResult { impl PartialEq for CalendarParsedRXingResult { fn eq(&self, other: &Self) -> bool { - self.summary == other.summary && self.start == other.start && self.startAllDay == other.startAllDay && self.end == other.end && self.endAllDay == other.endAllDay && self.location == other.location && self.organizer == other.organizer && self.attendees == other.attendees && self.description == other.description && self.latitude == other.latitude && self.longitude == other.longitude + self.summary == other.summary + && self.start == other.start + && self.startAllDay == other.startAllDay + && self.end == other.end + && self.endAllDay == other.endAllDay + && self.location == other.location + && self.organizer == other.organizer + && self.attendees == other.attendees + && self.description == other.description + && self.latitude == other.latitude + && self.longitude == other.longitude } } -impl Eq for CalendarParsedRXingResult {} \ No newline at end of file +impl Eq for CalendarParsedRXingResult {} diff --git a/src/client/result/EmailAddressParsedResult.rs b/src/client/result/EmailAddressParsedResult.rs index afda562..98e5389 100644 --- a/src/client/result/EmailAddressParsedResult.rs +++ b/src/client/result/EmailAddressParsedResult.rs @@ -24,7 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser}; * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct EmailAddressParsedRXingResult { tos: Vec, ccs: Vec, diff --git a/src/client/result/ExpandedProductParsedResult.rs b/src/client/result/ExpandedProductParsedResult.rs index 0040900..955408a 100644 --- a/src/client/result/ExpandedProductParsedResult.rs +++ b/src/client/result/ExpandedProductParsedResult.rs @@ -40,7 +40,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType}; * @author Antonio Manuel Benjumea Conde, Servinform, S.A. * @author Agustín Delgado, Servinform, S.A. */ -#[derive(PartialEq, Eq,Debug)] +#[derive(PartialEq, Eq, Debug)] pub struct ExpandedProductParsedRXingResult { rawText: String, productID: String, @@ -71,7 +71,7 @@ impl ParsedRXingResult for ExpandedProductParsedRXingResult { impl ExpandedProductParsedRXingResult { pub const KILOGRAM: &'static str = "KG"; -pub const POUND: &'static str = "LB"; + pub const POUND: &'static str = "LB"; pub fn new( rawText: String, diff --git a/src/client/result/GeoParsedResult.rs b/src/client/result/GeoParsedResult.rs index 80846af..fc14a27 100644 --- a/src/client/result/GeoParsedResult.rs +++ b/src/client/result/GeoParsedResult.rs @@ -120,7 +120,10 @@ impl GeoParsedRXingResult { impl PartialEq for GeoParsedRXingResult { fn eq(&self, other: &Self) -> bool { - self.latitude == other.latitude && self.longitude == other.longitude && self.altitude == other.altitude && self.query == other.query + self.latitude == other.latitude + && self.longitude == other.longitude + && self.altitude == other.altitude + && self.query == other.query } } -impl Eq for GeoParsedRXingResult{} \ No newline at end of file +impl Eq for GeoParsedRXingResult {} diff --git a/src/client/result/ISBNParsedResult.rs b/src/client/result/ISBNParsedResult.rs index 5344455..057ccf5 100644 --- a/src/client/result/ISBNParsedResult.rs +++ b/src/client/result/ISBNParsedResult.rs @@ -23,7 +23,7 @@ use super::ParsedRXingResult; * * @author jbreiden@google.com (Jeff Breidenbach) */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct ISBNParsedRXingResult { isbn: String, } diff --git a/src/client/result/ProductParsedResult.rs b/src/client/result/ProductParsedResult.rs index 498c1e6..5ed54d1 100644 --- a/src/client/result/ProductParsedResult.rs +++ b/src/client/result/ProductParsedResult.rs @@ -23,7 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType}; * * @author dswitkin@google.com (Daniel Switkin) */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct ProductParsedRXingResult { product_id: String, normalized_product_id: String, diff --git a/src/client/result/SMSParsedResult.rs b/src/client/result/SMSParsedResult.rs index 380a1bd..bafe330 100644 --- a/src/client/result/SMSParsedResult.rs +++ b/src/client/result/SMSParsedResult.rs @@ -24,7 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser}; * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct SMSParsedRXingResult { numbers: Vec, vias: Vec, diff --git a/src/client/result/TelParsedResult.rs b/src/client/result/TelParsedResult.rs index fdb61bc..ce9ca43 100644 --- a/src/client/result/TelParsedResult.rs +++ b/src/client/result/TelParsedResult.rs @@ -23,7 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType}; * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct TelParsedRXingResult { number: String, telURI: String, diff --git a/src/client/result/TextParsedResult.rs b/src/client/result/TextParsedResult.rs index 6986fd3..d7bae0c 100644 --- a/src/client/result/TextParsedResult.rs +++ b/src/client/result/TextParsedResult.rs @@ -24,7 +24,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType}; * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash, Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct TextParsedRXingResult { text: String, language: String, diff --git a/src/client/result/URIParsedResult.rs b/src/client/result/URIParsedResult.rs index fa144b2..dc76340 100644 --- a/src/client/result/URIParsedResult.rs +++ b/src/client/result/URIParsedResult.rs @@ -23,7 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser, URIResultPar * * @author Sean Owen */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct URIParsedRXingResult { uri: String, title: String, diff --git a/src/client/result/VINParsedResult.rs b/src/client/result/VINParsedResult.rs index 21e56a4..8486956 100644 --- a/src/client/result/VINParsedResult.rs +++ b/src/client/result/VINParsedResult.rs @@ -21,7 +21,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType}; /** * Represents a parsed result that encodes a Vehicle Identification Number (VIN). */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct VINParsedRXingResult { vin: String, world_manufacturer_id: String, diff --git a/src/client/result/WifiParsedResult.rs b/src/client/result/WifiParsedResult.rs index 82cf65d..1032fb1 100644 --- a/src/client/result/WifiParsedResult.rs +++ b/src/client/result/WifiParsedResult.rs @@ -23,7 +23,7 @@ use super::{ParsedRXingResult, ParsedRXingResultType, ResultParser}; * * @author Vikram Aggarwal */ -#[derive(PartialEq, Eq,Hash,Debug)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct WifiParsedRXingResult { ssid: String, networkEncryption: String, diff --git a/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs b/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs index e90155c..31fa2ff 100644 --- a/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs +++ b/src/oned/rss/expanded/rss_expanded_image_2_result_test_case.rs @@ -29,52 +29,69 @@ * */ -use std::{rc::Rc, collections::HashMap}; +use std::{collections::HashMap, rc::Rc}; -use crate::{client::result::{ExpandedProductParsedRXingResult, ParsedClientResult}, common::{BitArray, GlobalHistogramBinarizer}, BinaryBitmap, BufferedImageLuminanceSource, BarcodeFormat, oned::{rss::expanded::RSSExpandedReader, OneDReader}}; +use crate::{ + client::result::{ExpandedProductParsedRXingResult, ParsedClientResult}, + common::{BitArray, GlobalHistogramBinarizer}, + oned::{rss::expanded::RSSExpandedReader, OneDReader}, + BarcodeFormat, BinaryBitmap, BufferedImageLuminanceSource, +}; /** * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) */ - - #[test] - fn testDecodeRow2result2() { +#[test] +fn testDecodeRow2result2() { // (01)90012345678908(3103)001750 - let expected = - ExpandedProductParsedRXingResult::new("(01)90012345678908(3103)001750".to_owned(), - "90012345678908".to_owned(), - "".to_owned(), "".to_owned(), "".to_owned(), "".to_owned(), "".to_owned(), "".to_owned(), - "001750".to_owned(), - ExpandedProductParsedRXingResult::KILOGRAM.to_owned(), - "3".to_owned(), "".to_owned(), "".to_owned(), "".to_owned(), HashMap::new()); + let expected = ExpandedProductParsedRXingResult::new( + "(01)90012345678908(3103)001750".to_owned(), + "90012345678908".to_owned(), + "".to_owned(), + "".to_owned(), + "".to_owned(), + "".to_owned(), + "".to_owned(), + "".to_owned(), + "001750".to_owned(), + ExpandedProductParsedRXingResult::KILOGRAM.to_owned(), + "3".to_owned(), + "".to_owned(), + "".to_owned(), + "".to_owned(), + HashMap::new(), + ); assertCorrectImage2result("2.png", expected); - } +} - fn assertCorrectImage2result( fileName:&str, expected:ExpandedProductParsedRXingResult) - { - let path = format!("test_resources/blackbox/rssexpanded-1/{}",fileName); +fn assertCorrectImage2result(fileName: &str, expected: ExpandedProductParsedRXingResult) { + let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName); let image = image::open(path).expect("image must exist"); - let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(Box::new(BufferedImageLuminanceSource::new(image))))); + let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(Box::new( + BufferedImageLuminanceSource::new(image), + )))); let rowNumber = binaryMap.getHeight() as usize / 2; - let row = binaryMap.getBlackRow(rowNumber, &mut BitArray::new()).expect("get row"); + let row = binaryMap + .getBlackRow(rowNumber, &mut BitArray::new()) + .expect("get row"); - let mut rssExpandedReader = RSSExpandedReader::new(); - let theRXingResult= rssExpandedReader.decodeRow(rowNumber as u32, &row, &HashMap::new()).expect("must decode"); - - - + let mut rssExpandedReader = RSSExpandedReader::new(); + let theRXingResult = rssExpandedReader + .decodeRow(rowNumber as u32, &row, &HashMap::new()) + .expect("must decode"); - assert_eq!(&BarcodeFormat::RSS_EXPANDED, theRXingResult.getBarcodeFormat()); + assert_eq!( + &BarcodeFormat::RSS_EXPANDED, + theRXingResult.getBarcodeFormat() + ); let ParsedClientResult::ExpandedProductResult(result) = crate::client::result::parseRXingResult(&theRXingResult) else { panic!("incorrect result type found"); }; assert_eq!(expected, result); - } - - +} diff --git a/tests/codabar_blackbox_1_test_case.rs b/tests/codabar_blackbox_1_test_case.rs index 156da9d..e7c3e81 100644 --- a/tests/codabar_blackbox_1_test_case.rs +++ b/tests/codabar_blackbox_1_test_case.rs @@ -14,10 +14,7 @@ * limitations under the License. */ -use rxing::{ - oned::{CodaBarReader}, - BarcodeFormat, -}; +use rxing::{oned::CodaBarReader, BarcodeFormat}; mod common; diff --git a/tests/code_128_blackbox.rs b/tests/code_128_blackbox.rs index f2dece1..dcf17e5 100644 --- a/tests/code_128_blackbox.rs +++ b/tests/code_128_blackbox.rs @@ -1,6 +1,4 @@ -use rxing::{ - BarcodeFormat, MultiFormatReader, -}; +use rxing::{BarcodeFormat, MultiFormatReader}; mod common; diff --git a/tests/code_39_blackbox_reader.rs b/tests/code_39_blackbox_reader.rs index 2d5ddba..ce70a40 100644 --- a/tests/code_39_blackbox_reader.rs +++ b/tests/code_39_blackbox_reader.rs @@ -5,10 +5,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -use rxing::{ - oned::{Code39Reader}, - BarcodeFormat, MultiFormatReader, -}; +use rxing::{oned::Code39Reader, BarcodeFormat, MultiFormatReader}; mod common; diff --git a/tests/code_93_blackbox_1_testcase.rs b/tests/code_93_blackbox_1_testcase.rs index 9621cbd..db2feb7 100644 --- a/tests/code_93_blackbox_1_testcase.rs +++ b/tests/code_93_blackbox_1_testcase.rs @@ -14,9 +14,7 @@ * limitations under the License. */ -use rxing::{ - BarcodeFormat, MultiFormatReader, -}; +use rxing::{BarcodeFormat, MultiFormatReader}; mod common; diff --git a/tests/itf_blackbox.rs b/tests/itf_blackbox.rs index 6334254..9bfbb0f 100644 --- a/tests/itf_blackbox.rs +++ b/tests/itf_blackbox.rs @@ -14,9 +14,7 @@ * limitations under the License. */ -use rxing::{ - BarcodeFormat, MultiFormatReader, -}; +use rxing::{BarcodeFormat, MultiFormatReader}; mod common; diff --git a/tests/upc_a_blackbox_tests.rs b/tests/upc_a_blackbox_tests.rs index faad6f7..d206ff2 100644 --- a/tests/upc_a_blackbox_tests.rs +++ b/tests/upc_a_blackbox_tests.rs @@ -14,9 +14,7 @@ * limitations under the License. */ -use rxing::{ - BarcodeFormat, MultiFormatReader, -}; +use rxing::{BarcodeFormat, MultiFormatReader}; mod common; diff --git a/tests/upc_e_blackbox_tests.rs b/tests/upc_e_blackbox_tests.rs index 9cdb96e..f8a29e9 100644 --- a/tests/upc_e_blackbox_tests.rs +++ b/tests/upc_e_blackbox_tests.rs @@ -14,9 +14,7 @@ * limitations under the License. */ -use rxing::{ - BarcodeFormat, MultiFormatReader, -}; +use rxing::{BarcodeFormat, MultiFormatReader}; mod common;