tesseract v5.3.3.20231005
colpartition_test.cc
Go to the documentation of this file.
1// (C) Copyright 2017, Google Inc.
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5// http://www.apache.org/licenses/LICENSE-2.0
6// Unless required by applicable law or agreed to in writing, software
7// distributed under the License is distributed on an "AS IS" BASIS,
8// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9// See the License for the specific language governing permissions and
10// limitations under the License.
11
12#include "colpartition.h"
13
14#include "include_gunit.h"
15
16namespace tesseract {
17
19public:
20 void SetColumnRange(int first, int last) {
21 set_first_column(first);
23 }
24};
25
27protected:
28 void SetUp() override {
29 std::locale::global(std::locale(""));
30 }
31
32 void TearDown() override {}
33};
34
35TEST_F(ColPartitionTest, IsInSameColumnAsReflexive) {
37 a.SetColumnRange(1, 2);
38 b.SetColumnRange(3, 3);
39
42}
43
44TEST_F(ColPartitionTest, IsInSameColumnAsBorders) {
45 TestableColPartition a, b, c, d;
46 a.SetColumnRange(0, 1);
47 b.SetColumnRange(1, 2);
48 c.SetColumnRange(2, 3);
49 d.SetColumnRange(4, 5);
50
56}
57
58TEST_F(ColPartitionTest, IsInSameColumnAsSuperset) {
60 a.SetColumnRange(4, 7);
61 b.SetColumnRange(2, 8);
62
65}
66
67TEST_F(ColPartitionTest, IsInSameColumnAsPartialOverlap) {
69 a.SetColumnRange(3, 8);
70 b.SetColumnRange(6, 10);
71
74}
75
76} // namespace tesseract
#define EXPECT_TRUE(condition)
Definition: gtest.h:1982
#define EXPECT_FALSE(condition)
Definition: gtest.h:1986
LIST last(LIST var_list)
Definition: oldlist.cpp:153
TEST_F(EuroText, FastLatinOCR)
bool IsInSameColumnAs(const ColPartition &part) const
void set_last_column(int column)
Definition: colpartition.h:732
void set_first_column(int column)
Definition: colpartition.h:729
void SetColumnRange(int first, int last)