Merge "Fix Wi-Fi QR code decode fail" into qt-dev

This commit is contained in:
Arc Wang
2019-05-24 01:56:42 +00:00
committed by Android (Google) Code Review
2 changed files with 36 additions and 1 deletions

View File

@@ -128,4 +128,23 @@ public class QrCameraTest {
assertThat(mQrCode).isEqualTo(googleUrl);
}
@Test
public void testDecode_unicodePictureCaptured_QrCodeCorrectValue() {
final String unicodeTest = "中文測試";
try {
final Bitmap bmp = QrCodeGenerator.encodeQrCode(unicodeTest, 320);
final int[] intArray = new int[bmp.getWidth() * bmp.getHeight()];
bmp.getPixels(intArray, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());
LuminanceSource source = new RGBLuminanceSource(bmp.getWidth(), bmp.getHeight(),
intArray);
final BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
mCamera.decodeImage(bitmap);
bmp.recycle();
} catch (WriterException e) {
}
assertThat(mQrCode).isEqualTo(unicodeTest);
}
}