From b42df389be39df2b6c0b6855cd91b65c2ca1dd20 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 13 Sep 2017 13:43:49 +0200 Subject: [PATCH] unittest/apiexample_test: Report missing test image This avoids a runtime error (SIGSEGV caused by nullptr) for that case. Signed-off-by: Stefan Weil --- unittest/apiexample_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittest/apiexample_test.cc b/unittest/apiexample_test.cc index 3854c2b789..08ff5e4d52 100644 --- a/unittest/apiexample_test.cc +++ b/unittest/apiexample_test.cc @@ -39,11 +39,12 @@ TEST(TesseractTest, ApiExample) // Open input image with leptonica library Pix *image = pixRead("../testing/phototest.tif"); + ASSERT_TRUE(image != nullptr) << "Failed to read test image."; api->SetImage(image); // Get OCR result outText = api->GetUTF8Text(); - ASSERT_EQ(gtText,outText) << "Phototest.tif with default values OCR does not match ground truth"; + ASSERT_EQ(gtText,outText) << "Phototest.tif with default values OCR does not match ground truth"; // Destroy used object and release memory api->End();