Merge "Fix Wi-Fi QR code decode fail" into qt-dev am: 27d09aeb0c
am: 3e39f94880
am: 842b421420
Change-Id: I1dba808a58d55e72259a048d6cb760fe286df054
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user