Search in sources :

Example 81 with Result

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());
}
Also used : Result(com.google.zxing.Result)

Example 82 with Result

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());
}
Also used : Result(com.google.zxing.Result)

Example 83 with Result

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());
}
Also used : Result(com.google.zxing.Result)

Example 84 with Result

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());
}
Also used : Result(com.google.zxing.Result)

Example 85 with Result

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);
}
Also used : ResultPoint(com.google.zxing.ResultPoint) AbstractExpandedDecoder(com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder) BitArray(com.google.zxing.common.BitArray) Result(com.google.zxing.Result)

Aggregations

Result (com.google.zxing.Result)117 ResultPoint (com.google.zxing.ResultPoint)43 BinaryBitmap (com.google.zxing.BinaryBitmap)37 ReaderException (com.google.zxing.ReaderException)35 HybridBinarizer (com.google.zxing.common.HybridBinarizer)30 Bundle (android.os.Bundle)19 Message (android.os.Message)17 DecoderResult (com.google.zxing.common.DecoderResult)14 ArrayList (java.util.ArrayList)14 MultiFormatReader (com.google.zxing.MultiFormatReader)11 NotFoundException (com.google.zxing.NotFoundException)11 PlanarYUVLuminanceSource (com.google.zxing.PlanarYUVLuminanceSource)11 Cursor (android.database.Cursor)9 LuminanceSource (com.google.zxing.LuminanceSource)9 BitArray (com.google.zxing.common.BitArray)8 DetectorResult (com.google.zxing.common.DetectorResult)8 BufferedImage (java.awt.image.BufferedImage)8 Test (org.junit.Test)8 Bitmap (android.graphics.Bitmap)7 Handler (android.os.Handler)7