Skip to content

Commit

Permalink
Fix memory leaks and typos in progress_test
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Nov 13, 2018
1 parent 4ef51d8 commit 303ac97
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions unittest/progress_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <fstream>
#include <iostream>
#include <locale>
#include <memory> // std::unique_ptr
#include <string>
#include "baseapi.h"
#include "gmock/gmock.h"
Expand Down Expand Up @@ -88,7 +89,7 @@ void ClassicProgressTester(const char* imgname, const char* tessdatadir,
using ::testing::Return;
using ::testing::SaveArg;

tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI();
std::unique_ptr<tesseract::TessBaseAPI> api(new tesseract::TessBaseAPI());
ASSERT_FALSE(api->Init(tessdatadir, lang))
<< "Could not initialize tesseract.";
Pix* image = pixRead(imgname);
Expand Down Expand Up @@ -124,7 +125,7 @@ void NewProgressTester(const char* imgname, const char* tessdatadir,
using ::testing::Return;
using ::testing::SaveArg;

tesseract::TessBaseAPI* api = new tesseract::TessBaseAPI();
std::unique_ptr<tesseract::TessBaseAPI> api(new tesseract::TessBaseAPI());
ASSERT_FALSE(api->Init(tessdatadir, lang))
<< "Could not initialize tesseract.";
Pix* image = pixRead(imgname);
Expand All @@ -149,12 +150,12 @@ void NewProgressTester(const char* imgname, const char* tessdatadir,
pixDestroy(&image);
}

TEST(QuickTest, ClassicProgressReporitng) {
TEST(QuickTest, ClassicProgressReporting) {
ClassicProgressTester(TESTING_DIR "/phototest.tif", TESSDATA_DIR "_fast",
"eng");
}

TEST(QuickTest, NewProgressReporitng) {
TEST(QuickTest, NewProgressReporting) {
NewProgressTester(TESTING_DIR "/phototest.tif", TESSDATA_DIR "_fast", "eng");
}

Expand Down

0 comments on commit 303ac97

Please sign in to comment.