Skip to content

Commit 780986e

Browse files
committed
Fix linker error for baseapi_test when building without legacy engine
Linker error reported in issue #2439: unittest/baseapi_test.cc:190: undefined reference to `tesseract::TessBaseAPI::AdaptToWordStr(tesseract::PageSegMode, char const*)' Signed-off-by: Stefan Weil <[email protected]>
1 parent 7e9d2f4 commit 780986e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

unittest/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ AM_CPPFLAGS += -DTESSDATA_BEST_DIR="\"$(TESSDATA_BEST_DIR)\""
2020
AM_CPPFLAGS += -DTESTING_DIR="\"$(TESTING_DIR)\""
2121
AM_CPPFLAGS += -DTESTDATA_DIR="\"$(TESTDATA_DIR)\""
2222
AM_CPPFLAGS += -DPANGO_ENABLE_ENGINE
23+
if DISABLED_LEGACY_ENGINE
24+
AM_CPPFLAGS += -DDISABLED_LEGACY_ENGINE
25+
endif
2326
AM_CPPFLAGS += -I$(top_builddir)/src/api
2427
AM_CPPFLAGS += -I$(top_srcdir)/src/api
2528
AM_CPPFLAGS += -I$(top_srcdir)/src/arch

unittest/baseapi_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ TEST_F(TesseractTest, RickSnyderNotFuckSnyder) {
166166

167167
// Tests that Tesseract gets exactly the right answer on some page numbers.
168168
TEST_F(TesseractTest, AdaptToWordStrTest) {
169+
#ifdef DISABLED_LEGACY_ENGINE
170+
// Skip test because TessBaseAPI::AdaptToWordStr is missing.
171+
GTEST_SKIP();
172+
#else
169173
static const char* kTrainingPages[] = {
170174
"136.tif", "256.tif", "410.tif", "432.tif", "540.tif",
171175
"692.tif", "779.tif", "793.tif", "808.tif", "815.tif",
@@ -204,6 +208,7 @@ TEST_F(TesseractTest, AdaptToWordStrTest) {
204208
EXPECT_STREQ(kTestText[i], ocr_text.c_str());
205209
pixDestroy(&src_pix);
206210
}
211+
#endif
207212
}
208213

209214
// Tests that LSTM gets exactly the right answer on phototest.

0 commit comments

Comments
 (0)