Skip to content

Commit

Permalink
unittest/apiexample_test: Report missing test image
Browse files Browse the repository at this point in the history
This avoids a runtime error (SIGSEGV caused by nullptr) for that case.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 13, 2017
1 parent 5c7600c commit b42df38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion unittest/apiexample_test.cc
Expand Up @@ -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();
Expand Down

0 comments on commit b42df38

Please sign in to comment.