tesseract v5.3.3.20231005
tesseract::StringRendererTest Class Reference
Inheritance diagram for tesseract::StringRendererTest:
testing::Test

Protected Member Functions

void SetUp () override
 
void DisplayClusterBoxes (Image pix)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Static Protected Member Functions

static void SetUpTestCase ()
 

Protected Attributes

std::unique_ptr< StringRendererrenderer_
 

Additional Inherited Members

- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestSuite ()
 
static void TearDownTestSuite ()
 
static void TearDownTestCase ()
 
static void SetUpTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool IsSkipped ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 

Detailed Description

Definition at line 43 of file stringrenderer_test.cc.

Member Function Documentation

◆ DisplayClusterBoxes()

void tesseract::StringRendererTest::DisplayClusterBoxes ( Image  pix)
inlineprotected

Definition at line 63 of file stringrenderer_test.cc.

63 {
64 if (!FLAGS_display) {
65 return;
66 }
67 const std::vector<BoxChar *> &boxchars = renderer_->GetBoxes();
68 Boxa *boxes = boxaCreate(0);
69 for (const auto &boxchar : boxchars) {
70 if (boxchar->box()) {
71 boxaAddBox(boxes, const_cast<Box *>(boxchar->box()), L_CLONE);
72 }
73 }
74 Image box_pix = pixDrawBoxaRandom(pix, boxes, 1);
75 boxaDestroy(&boxes);
76 pixDisplay(box_pix, 0, 0);
77 box_pix.destroy();
78 }
std::unique_ptr< StringRenderer > renderer_

◆ SetUp()

void tesseract::StringRendererTest::SetUp ( )
inlineoverrideprotectedvirtual

Reimplemented from testing::Test.

Definition at line 45 of file stringrenderer_test.cc.

45 {
46 if (!font_map) {
47 font_map = pango_cairo_font_map_new_for_font_type(CAIRO_FONT_TYPE_FT);
48 }
49 pango_cairo_font_map_set_default(PANGO_CAIRO_FONT_MAP(font_map));
50 }

◆ SetUpTestCase()

static void tesseract::StringRendererTest::SetUpTestCase ( )
inlinestaticprotected

Definition at line 52 of file stringrenderer_test.cc.

52 {
53 static std::locale system_locale("");
54 std::locale::global(system_locale);
55
56 l_chooseDisplayProg(L_DISPLAY_WITH_XZGV);
57 FLAGS_fonts_dir = TESTING_DIR;
58 FLAGS_fontconfig_tmpdir = FLAGS_test_tmpdir;
61 }
static void MakeTmpdir()
Definition: include_gunit.h:38

Member Data Documentation

◆ renderer_

std::unique_ptr<StringRenderer> tesseract::StringRendererTest::renderer_
protected

Definition at line 79 of file stringrenderer_test.cc.


The documentation for this class was generated from the following file: