mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
update for shared state and improved performance
This commit is contained in:
@@ -37,7 +37,7 @@ use std::collections::HashMap;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use crate::{
|
||||
common::{BitArray, BitMatrix, BitMatrixTestCase},
|
||||
common::{BitMatrix, BitMatrixTestCase},
|
||||
oned::{Code128Reader, OneDReader},
|
||||
BarcodeFormat, EncodeHintType, EncodeHintValue, EncodingHintDictionary, Exceptions, Writer,
|
||||
};
|
||||
@@ -483,18 +483,18 @@ fn encode(toEncode: &str, compact: bool, expectedLoopback: &str) -> Result<BitMa
|
||||
let encRXingResult =
|
||||
WRITER.encode_with_hints(toEncode, &BarcodeFormat::CODE_128, 0, 0, &hints)?;
|
||||
if !expectedLoopback.is_empty() {
|
||||
let row = encRXingResult.getRow(0, BitArray::new());
|
||||
let row = encRXingResult.getRow(0);
|
||||
let rtRXingResult = reader.decodeRow(0, &row, &HashMap::new())?;
|
||||
let actual = rtRXingResult.getText();
|
||||
assert_eq!(expectedLoopback, actual);
|
||||
}
|
||||
if compact {
|
||||
//check that what is encoded compactly yields the same on loopback as what was encoded fast.
|
||||
let row = encRXingResult.getRow(0, BitArray::new());
|
||||
let row = encRXingResult.getRow(0);
|
||||
let rtRXingResult = reader.decodeRow(0, &row, &HashMap::new())?;
|
||||
let actual = rtRXingResult.getText();
|
||||
let encRXingResultFast = WRITER.encode(toEncode, &BarcodeFormat::CODE_128, 0, 0)?;
|
||||
let row = encRXingResultFast.getRow(0, BitArray::new());
|
||||
let row = encRXingResultFast.getRow(0);
|
||||
let rtRXingResult = reader.decodeRow(0, &row, &HashMap::new())?;
|
||||
assert_eq!(rtRXingResult.getText(), actual);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user