diff --git a/modules/objdetect/misc/java/test/QRCodeDetectorTest.java b/modules/objdetect/misc/java/test/QRCodeDetectorTest.java index 2a4ff81675..225c8c6610 100644 --- a/modules/objdetect/misc/java/test/QRCodeDetectorTest.java +++ b/modules/objdetect/misc/java/test/QRCodeDetectorTest.java @@ -57,28 +57,25 @@ public class QRCodeDetectorTest extends OpenCVTestCase { assertEquals(new HashSet(output), new HashSet(expectedResults)); } - public void testKanji() throws UnsupportedEncodingException { - if (!Charset.isSupported("Shift_JIS")) - throw new TestSkipException(); - - String inp = new String("\u3053\u3093\u306B\u3061\u306F\u4E16\u754C"); - + public void testKanji() { + byte[] inp = new byte[]{(byte)0x82, (byte)0xb1, (byte)0x82, (byte)0xf1, (byte)0x82, (byte)0xc9, (byte)0x82, + (byte)0xbf, (byte)0x82, (byte)0xcd, (byte)0x90, (byte)0xa2, (byte)0x8a, (byte)0x45}; QRCodeEncoder_Params params = new QRCodeEncoder_Params(); params.set_mode(QRCodeEncoder.MODE_KANJI); QRCodeEncoder encoder = QRCodeEncoder.create(params); Mat qrcode = new Mat(); - encoder.encode(inp.getBytes("Shift_JIS"), qrcode); + encoder.encode(inp, qrcode); Imgproc.resize(qrcode, qrcode, new Size(0, 0), 2, 2, Imgproc.INTER_NEAREST); QRCodeDetector detector = new QRCodeDetector(); byte[] output = detector.detectAndDecodeBytes(qrcode); assertEquals(detector.getEncoding(), QRCodeEncoder.ECI_SHIFT_JIS); - assertEquals(inp, new String(output, "Shift_JIS")); + assertArrayEquals(inp, output); List < byte[] > outputs = new ArrayList< byte[] >(); assertTrue(detector.detectAndDecodeBytesMulti(qrcode, outputs)); assertEquals(detector.getEncoding(0), QRCodeEncoder.ECI_SHIFT_JIS); - assertEquals(inp, new String(outputs.get(0), "Shift_JIS")); + assertArrayEquals(inp, outputs.get(0)); } }