Commit Graph

195 Commits

Author SHA1 Message Date
Stefan Weil
eec9c96767 Remove member functions STRING::string and StringParam::string (continued)
Commit 994ec697d8 did not update unittest.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-09-25 10:07:51 +02:00
Stefan Weil
46e2a0f106 Remove more code for builds with disabled legacy engine
Now the Tesseract library no longer includes unused code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-13 17:49:10 +02:00
Egor Pugin
73f713519c
Merge pull request #2614 from stweil/training
Move source files which are used for training only to src/training
2019-08-12 19:35:50 +03:00
Stefan Weil
e84cb24def Move source files which are used for training only to src/training
They are moved from src/classify and src/lstm to src/training.

This reduces the size of the Tesseract library.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 17:08:08 +02:00
Stefan Weil
bce585286d Remove global array kPolyBlockNames from Tesseract library
It is only used in unittest/layout_test.cc after moving a test from
baseapi_test.cc to that file, so it can be made local.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 14:33:55 +02:00
Stefan Weil
beec85e023 Remove UNICHARSET::load_from_inmemory_file and related code
The method was only used in unittest where it can be replaced by
UNICHARSET::load_from_file which also simplifies the code.

This allows removing the class InMemoryFilePointer and fixes a TODO.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 13:07:15 +02:00
Stefan Weil
ab953c1d51 unittest: Fix build and simplify build rules
Now more tests (those which use fileio) depend on the training build.
This is required since commit c5a50b93ce.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-07 13:58:12 +02:00
Stefan Weil
2ba90f02cb unittest: Initialize non-static class members in RecodeBeamTest (CID 1402765)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:52:27 +02:00
Stefan Weil
d40a2423e8 unittest: Fix two issues reported by Coverity Scan (CID 1402761, 1402755)
GTEST_SKIP() returns from the function which caused two warnings:

CID 1402755 (#1 of 1): Resource leak (RESOURCE_LEAK)
CID 1402761 (#1 of 1): Structurally dead code (UNREACHABLE)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:38:30 +02:00
Stefan Weil
a85045eeb5 unittest: Add missing precision specifiers (CID 1402752)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:33:08 +02:00
Stefan Weil
7fab891e36 unittest: Don't build tatweel_test when TensorFlow is disabled
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:06:27 +02:00
Stefan Weil
ba27deb3a0 unittest: Add missing libraries to fix linker errors
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 15:11:51 +02:00
Stefan Weil
e94392ef10 Update test submodule and fix pagesegmode_test
The test submodule now adds an image which is needed by the
pagesegmode_test.

That image was newly created for the test. Therefore the box
coordinates in the test had to be fixed by using data from
the hOCR output for the full image.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-09 11:48:56 +02:00
Stefan Weil
098180982a Update test submodule and fix tatweel_test
The test submodule now includes the files needed by the tatweel_test.
Fix also a linker error for tatweel_test.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-09 08:03:11 +02:00
Stefan Weil
71e7e16a61 unittest: Fix and enable pagesegmode_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-07 12:35:41 +02:00
Stefan Weil
6668f2fc9e unittest: Fix and enable tatweel_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-07 10:59:27 +02:00
Stefan Weil
cf46eaeac8 unittest: Fix and enable baseapi_thread_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 20:21:56 +02:00
Stefan Weil
b00e53fabf unittest: Fix and enable stridemap_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 15:30:03 +02:00
Stefan Weil
4e576f844c unittest: Fix and enable networkio_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 15:28:42 +02:00
Stefan Weil
2833db7c67 unittest: Fix and enable equationdetect_test
It requires Tensorflow. Skip one test because equ_gt1.tif is missing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-30 12:39:54 +02:00
Stefan Weil
5409299763 unittest: Fix tests which need Tensorflow headers
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-29 11:43:12 +02:00
Stefan Weil
655ba7af10 unittest: Fix compiler warnings (signed/unsigned)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 08:11:42 +02:00
Stefan Weil
40c1cf671f unittest: Fix and enable pango_font_info_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 08:09:28 +02:00
Stefan Weil
04d85b4c0f Add more test code for normstrngs_test
unilib.h is now available, so more code can be enabled.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:35:27 +02:00
Stefan Weil
aa54bf0f8b Fix code from tensorflow/models/research/syntaxnet/util/utf8
See https://github.com/tensorflow/models/issues/7090.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:30:40 +02:00
Stefan Weil
0702194246 Add code from tensorflow/models
The new code was copied from the latest code on GitHub
(https://github.com/tensorflow/models/tree/master/research/syntaxnet).

It is required for pango_font_info_test and other unit tests.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-28 07:30:40 +02:00
Stefan Weil
252d80cb6d unittest: Fix function QCHECK (issue #2517)
The function must print an error message if the condition fails.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-23 19:05:42 +02:00
Stefan Weil
efa3cae06d Simplify unittest/Makefile.am
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-22 20:29:39 +02:00
Stefan Weil
bd13069fe8 Simplify class LSTMTrainer
The function pointers and callbacks file_reader_, file_writer_,
checkpointer_reader_ and checkpoint_writer_ are always set to
the same values. Replacing them by direct function calls
simplifies the code and allows removing more code from tesscallback.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-22 09:18:13 +02:00
Stefan Weil
b967c62880 unittest: Add missing Leptonica library for textlineprojection_test
It is needed for builds with --enable-shared.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-17 15:10:16 +02:00
Stefan Weil
ceabab8373 unittest: Catch missing eng.traineddata in baseapi_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 08:11:16 +02:00
Stefan Weil
bbd3626d77 unittest: Fix and enable normstrngs_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-16 08:01:11 +02:00
Stefan Weil
73e5241004 unittest: Fix and enable textlineprojection_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-15 10:22:44 +02:00
Stefan Weil
e0e29126ac unittest: Fix and enable scanutils_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-14 16:51:39 +02:00
Stefan Weil
3c507100c6 unittest: Fix and enable ligature_table_test
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-06-11 16:40:23 +02:00
Stefan Weil
9a4bd041c8 Fix build for unittests
Commit 29f2cff203 was the wrong fix
for the compiler warnings because it broke the unittest build.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-26 21:36:34 +02:00
Stefan Weil
9551c3d413 unittest: Remove unused methods
This fixes compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-26 20:27:21 +02:00
zdenop
12847d58ad
Merge pull request #2455 from bact/master
Unittest: Fix Thai valid text and add Thai illegal sequences
2019-05-25 18:36:17 +02:00
Stefan Weil
1ba8c97cac Fix linking of unittest with Tensorflow
This does not add Tensorflow tests. It only fixes the linker errors.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-24 17:08:48 +02:00
bact
aac6f593f3
Update normstrngs_test.cc 2019-05-22 15:21:16 +07:00
bact
e05c5ecfcc
Fix Thai valid text and add Thai illegal sequences
- Fix a invalid sequence in "valid text" `kScriptText`
- Add two illegal sequence in `kBadlyFormedThaiWords`
2019-05-22 15:19:49 +07:00
Stefan Weil
639781b5c8 stringrenderer_test: Get system locale only once
This fixes a runtime exception on macOS.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-18 13:24:13 +02:00
Stefan Weil
8e7b1119b5 Run more unittests with the user's locale
Hopefully this improves the test coverage.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
59e31e958b Fix more build error for compilation without legacy engine
Skip the tests which need the legacy code.
Add also code to those tests to use the user's locale to test that, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
780986ebfb 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 <sw@weilnetz.de>
2019-05-16 18:12:55 +02:00
Stefan Weil
28a521fec2 Fix some typos (most found and fixed by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-01 20:30:41 +02:00
Stefan Weil
4194b93e3a unittest: Add missing unittests to Makefile.am as comments
This gives a good overview of the missing unittests.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-19 11:14:43 +02:00
Stefan Weil
5529a5db11 unittest: Fix and enable params_model_test
This needs the latest test submodule.

The test uses LoadFromFile which is not used otherwise, so remove that
function from class ParamsModel.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-04-18 17:06:48 +02:00
Stefan Weil
bb52887c36 unittest: Replace TRUE, FALSE by true, false
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-31 17:54:48 +02:00
Stefan Weil
2718b81a3e fuzzer-api: Use environment variable TESSDATA_PREFIX if set
Clean also the code a little bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-03-26 11:09:22 +01:00