mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
calib3d: chessboard detector - replace OpenCV C API
This commit is contained in:
@@ -255,8 +255,9 @@ void BaseTest::safe_run( int start_from )
|
||||
const char* errorStr = cvErrorStr(exc.code);
|
||||
char buf[1 << 16];
|
||||
|
||||
sprintf( buf, "OpenCV Error:\n\t%s (%s) in %s, file %s, line %d",
|
||||
errorStr, exc.err.c_str(), exc.func.size() > 0 ?
|
||||
const char* delim = exc.err.find('\n') == cv::String::npos ? "" : "\n";
|
||||
sprintf( buf, "OpenCV Error:\n\t%s (%s%s) in %s, file %s, line %d",
|
||||
errorStr, delim, exc.err.c_str(), exc.func.size() > 0 ?
|
||||
exc.func.c_str() : "unknown function", exc.file.c_str(), exc.line );
|
||||
ts->printf(TS::LOG, "%s\n", buf);
|
||||
|
||||
@@ -384,7 +385,9 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
|
||||
catch(const cv::Exception& e)
|
||||
{
|
||||
thrown = true;
|
||||
if( e.code != expected_code )
|
||||
if (e.code != expected_code &&
|
||||
e.code != cv::Error::StsError && e.code != cv::Error::StsAssert // Exact error codes support will be dropped. Checks should provide proper text messages intead.
|
||||
)
|
||||
{
|
||||
ts->printf(TS::LOG, "%s (test case #%d): the error code %d is different from the expected %d\n",
|
||||
descr, test_case_idx, e.code, expected_code);
|
||||
@@ -471,7 +474,8 @@ string TS::str_from_code( const TS::FailureCode code )
|
||||
|
||||
static int tsErrorCallback( int status, const char* func_name, const char* err_msg, const char* file_name, int line, TS* ts )
|
||||
{
|
||||
ts->printf(TS::LOG, "OpenCV Error:\n\t%s (%s) in %s, file %s, line %d\n", cvErrorStr(status), err_msg, func_name[0] != 0 ? func_name : "unknown function", file_name, line);
|
||||
const char* delim = std::string(err_msg).find('\n') == std::string::npos ? "" : "\n";
|
||||
ts->printf(TS::LOG, "OpenCV Error:\n\t%s (%s%s) in %s, file %s, line %d\n", cvErrorStr(status), delim, err_msg, func_name[0] != 0 ? func_name : "unknown function", file_name, line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user