-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTEST_Tesseract.cpp
144 lines (122 loc) · 3.76 KB
/
TEST_Tesseract.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#include <boost/test/unit_test.hpp>
#include "TEST_Global.h"
Docapost::IA::Tesseract::TesseractFactory* CreateTesseractFactory()
{
auto factory = new Docapost::IA::Tesseract::TesseractFactory();
factory->Lang("fra");
factory->Oem(tesseract::OcrEngineMode::OEM_DEFAULT);
factory->Psm(tesseract::PageSegMode::PSM_AUTO_OSD);
return factory;
}
BOOST_AUTO_TEST_SUITE(TEST_Tesseract)
BOOST_AUTO_TEST_CASE(TEST_TesseractFactory)
{
auto factory = new Docapost::IA::Tesseract::TesseractFactory();
factory->Lang("tst");
BOOST_CHECK(factory->Lang() == "tst");
factory->Lang("fra");
BOOST_CHECK(factory->Lang() == "fra");
factory->Oem(tesseract::OcrEngineMode::OEM_LSTM_ONLY);
BOOST_CHECK(factory->Oem() == tesseract::OcrEngineMode::OEM_LSTM_ONLY);
factory->Oem(tesseract::OcrEngineMode::OEM_DEFAULT);
BOOST_CHECK(factory->Oem() == tesseract::OcrEngineMode::OEM_DEFAULT);
factory->Psm(tesseract::PageSegMode::PSM_RAW_LINE);
BOOST_CHECK(factory->Psm() == tesseract::PageSegMode::PSM_RAW_LINE);
factory->Psm(tesseract::PageSegMode::PSM_AUTO_OSD);
BOOST_CHECK(factory->Psm() == tesseract::PageSegMode::PSM_AUTO_OSD);
auto ocr = factory->CreateNew();
BOOST_CHECK(ocr != nullptr);
}
BOOST_AUTO_TEST_CASE(TEST_TesseractMemory)
{
OcrMemory(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractMemoryPdf)
{
OcrMemoryPdf(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractCorruptPdf)
{
OcrCorruptPdf(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile)
{
OcrFile(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf)
{
OcrFilePdf(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_DifferentDir)
{
OcrFile_DifferentDir(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_DifferentDir)
{
OcrFilePdf_DifferentDir(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_DifferentDir_Flatern)
{
OcrFile_DifferentDir_Flatern(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_DifferentDir_Flatern)
{
OcrFilePdf_DifferentDir_Flatern(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_DifferentDir_MultiFile_SingleThread)
{
OcrFile_DifferentDir_MultiFile_SingleThread(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_DifferentDir_MultiFile_SingleThread)
{
OcrFilePdf_DifferentDir_MultiFile_SingleThread(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_DifferentDir_MultiFile_MultiThread)
{
OcrFile_DifferentDir_MultiFile_MultiThread(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_DifferentDir_MultiFile_MultiThread)
{
OcrFilePdf_DifferentDir_MultiFile_MultiThread(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_Utf8)
{
OcrFile_Utf8(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_Utf8)
{
OcrFilePdf_Utf8(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_Slave)
{
OcrFile_Slave(CreateTesseractFactory(), CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_Slave)
{
OcrFilePdf_Slave(CreateTesseractFactory(), CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_Slave_Inverse)
{
OcrFile_Slave_Inverse(CreateTesseractFactory(), CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_Slave_Inverse)
{
OcrFilePdf_Slave_Inverse(CreateTesseractFactory(), CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_Http_Get)
{
OcrFile_Http_Get(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFile_Http_Post)
{
OcrFile_Http_Post(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_TesseractFilePdf_Http_Post)
{
OcrFilePdf_Http_Post(CreateTesseractFactory());
}
BOOST_AUTO_TEST_CASE(TEST_Tesseract_Api)
{
Api_Test("Tesseract");
}
BOOST_AUTO_TEST_SUITE_END()