25#include <allheaders.h>
44 const time_t end_time = time(
nullptr);
60 return instance->classicProgress(progress);
87 using ::testing::AllOf;
95 auto api = std::make_unique<tesseract::TessBaseAPI>();
96 ASSERT_FALSE(api->Init(tessdatadir, lang)) <<
"Could not initialize tesseract.";
97 Image image = pixRead(imgname);
98 ASSERT_TRUE(image !=
nullptr) <<
"Failed to read test image.";
103 int currentProgress = -1;
104 EXPECT_CALL(progressSink, classicProgress(AllOf(Gt<int &>(currentProgress), Le(100))))
106 .WillRepeatedly(
DoAll(SaveArg<0>(¤tProgress),
Return(
false)));
110 EXPECT_GE(currentProgress, 50) <<
"The reported progress did not reach 50%";
118 using ::testing::AllOf;
126 auto api = std::make_unique<tesseract::TessBaseAPI>();
127 ASSERT_FALSE(api->Init(tessdatadir, lang)) <<
"Could not initialize tesseract.";
128 Image image = pixRead(imgname);
129 ASSERT_TRUE(image !=
nullptr) <<
"Failed to read test image.";
130 api->SetImage(image);
134 int currentProgress = -1;
135 EXPECT_CALL(progressSink, classicProgress(_)).Times(0);
136 EXPECT_CALL(progressSink, progress(AllOf(Gt<int &>(currentProgress), Le(100))))
138 .WillRepeatedly(
DoAll(SaveArg<0>(¤tProgress),
Return(
false)));
142 EXPECT_GE(currentProgress, 50) <<
"The reported progress did not reach 50%";
#define EXPECT_CALL(obj, call)
#define EXPECT_EQ(val1, val2)
#define ASSERT_FALSE(condition)
#define EXPECT_GE(val1, val2)
#define EXPECT_TRUE(condition)
#define ASSERT_TRUE(condition)
void ClassicProgressTester(const char *imgname, const char *tessdatadir, const char *lang)
void NewProgressTester(const char *imgname, const char *tessdatadir, const char *lang)
TEST(TesseractInstanceTest, TestMultipleTessInstances)
internal::SaveArgAction< k, Ptr > SaveArg(Ptr pointer)
GTEST_API_ Cardinality AtLeast(int n)
internal::DoAllAction< typename std::decay< Action >::type... > DoAll(Action &&... action)
::std::string PrintToString(const T &value)
internal::ReturnAction< R > Return(R value)
void * cancel_this
monitor-aware progress callback
PROGRESS_FUNC progress_callback
returns true to cancel
PROGRESS_FUNC2 progress_callback2
called whenever progress increases
int16_t progress
chars in this buffer(0)
CANCEL_FUNC cancel
for errcode use
ClassicMockProgressSink()
MOCK_METHOD1(classicProgress, bool(int))
MOCK_METHOD1(cancel, bool(int))
static ClassicMockProgressSink * instance
MOCK_METHOD1(progress, bool(int))