use of com.google.zxing.Result in project zxing by zxing.
the class ISBNParsedResultTestCase method doTest.
private static void doTest(String contents) {
Result fakeResult = new Result(contents, null, null, BarcodeFormat.EAN_13);
ParsedResult result = ResultParser.parseResult(fakeResult);
assertSame(ParsedResultType.ISBN, result.getType());
ISBNParsedResult isbnResult = (ISBNParsedResult) result;
assertEquals(contents, isbnResult.getISBN());
}
use of com.google.zxing.Result in project zxing by zxing.
the class ProductParsedResultTestCase method doTest.
private static void doTest(String contents, String normalized, BarcodeFormat format) {
Result fakeResult = new Result(contents, null, null, format);
ParsedResult result = ResultParser.parseResult(fakeResult);
assertSame(ParsedResultType.PRODUCT, result.getType());
ProductParsedResult productResult = (ProductParsedResult) result;
assertEquals(contents, productResult.getProductID());
assertEquals(normalized, productResult.getNormalizedProductID());
}
use of com.google.zxing.Result in project zxing by zxing.
the class SMSMMSParsedResultTestCase method doTest.
private static void doTest(String contents, String number, String subject, String body, String via, String parsedURI) {
Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
ParsedResult result = ResultParser.parseResult(fakeResult);
assertSame(ParsedResultType.SMS, result.getType());
SMSParsedResult smsResult = (SMSParsedResult) result;
assertArrayEquals(new String[] { number }, smsResult.getNumbers());
assertEquals(subject, smsResult.getSubject());
assertEquals(body, smsResult.getBody());
assertArrayEquals(new String[] { via }, smsResult.getVias());
assertEquals(parsedURI, smsResult.getSMSURI());
}
use of com.google.zxing.Result in project zxing by zxing.
the class TelParsedResultTestCase method doTest.
private static void doTest(String contents, String number, String title) {
Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
ParsedResult result = ResultParser.parseResult(fakeResult);
assertSame(ParsedResultType.TEL, result.getType());
TelParsedResult telResult = (TelParsedResult) result;
assertEquals(number, telResult.getNumber());
assertEquals(title, telResult.getTitle());
assertEquals("tel:" + number, telResult.getTelURI());
}
use of com.google.zxing.Result in project zxing by zxing.
the class RSSExpandedReader method constructResult.
// Not private for unit testing
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
return new Result(resultingString, null, new ResultPoint[] { firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1] }, BarcodeFormat.RSS_EXPANDED);
}
Aggregations