Try skip Java test if charset is not supported

This commit is contained in:
Dmitry Kurtaev 2025-06-05 12:41:24 +03:00
parent 901d5b6682
commit d4f94bfb1b
3 changed files with 11 additions and 7 deletions

View File

@ -11,4 +11,4 @@
void Copy_vector_NativeByteArray_to_List(JNIEnv* env, std::vector<std::string>& vs, jobject list);
#endif /* DNN_CONVERTERS_HPP */
#endif /* OBJDETECT_CONVERTERS_HPP */

View File

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
public class QRCodeDetectorTest extends OpenCVTestCase {
@ -57,6 +58,9 @@ public class QRCodeDetectorTest extends OpenCVTestCase {
}
public void testKanji() throws UnsupportedEncodingException {
if (!Charset.isSupported("Shift_JIS"))
throw new TestSkipException();
String inp = new String("\u3053\u3093\u306B\u3061\u306F\u4E16\u754C");
QRCodeEncoder_Params params = new QRCodeEncoder_Params();

View File

@ -4124,22 +4124,22 @@ bool ImplContour::decodeMulti(
straight_qrcode.assign(tmp_straight_qrcodes);
}
decoded_info.clear();
encodings.clear();
decoded_info.resize(info.size());
encodings.resize(info.size());
for (size_t i = 0; i < info.size(); i++)
{
auto& decoder = qrdec[i];
encodings.push_back(decoder.eci);
encodings[i] = decoder.eci;
if (!decoder.isStructured())
{
decoded_info.push_back(info[i]);
decoded_info[i] = info[i];
continue;
}
// Store final message corresponding to 0-th code in a sequence.
if (decoder.structure_info.sequence_num != 0)
{
decoded_info.push_back("");
decoded_info[i] = "";
continue;
}
@ -4160,7 +4160,7 @@ bool ImplContour::decodeMulti(
break;
}
}
decoded_info.push_back(decoded);
decoded_info[i] = decoded;
}
alignmentMarkers.resize(src_points.size());