12
12
#include < memory>
13
13
#include < string>
14
14
15
- #include " absl/strings/str_split.h" // for absl::StrSplit
15
+ #include " absl/strings/str_split.h" // for absl::StrSplit
16
16
17
- #include " include_gunit.h"
18
17
#include " allheaders.h"
19
18
#include " boxchar.h"
20
19
#include " boxread.h"
21
20
#include " commandlineflags.h"
22
21
#include " genericvector.h"
22
+ #include " include_gunit.h"
23
23
#include " stringrenderer.h"
24
24
#include " strngs.h"
25
25
@@ -65,9 +65,9 @@ class StringRendererTest : public ::testing::Test {
65
65
if (!FLAGS_display) return ;
66
66
const std::vector<BoxChar*>& boxchars = renderer_->GetBoxes ();
67
67
Boxa* boxes = boxaCreate (0 );
68
- for (size_t i = 0 ; i < boxchars. size (); ++i ) {
69
- if (boxchars[i] ->box ())
70
- boxaAddBox (boxes, const_cast <Box*>(boxchars[i] ->box ()), L_CLONE);
68
+ for (const auto & boxchar : boxchars) {
69
+ if (boxchar ->box ())
70
+ boxaAddBox (boxes, const_cast <Box*>(boxchar ->box ()), L_CLONE);
71
71
}
72
72
Pix* box_pix = pixDrawBoxaRandom (pix, boxes, 1 );
73
73
boxaDestroy (&boxes);
@@ -203,8 +203,8 @@ TEST_F(StringRendererTest, DoesRenderLigatures) {
203
203
204
204
static int FindBoxCharXCoord (const std::vector<BoxChar*>& boxchars,
205
205
const std::string& ch) {
206
- for (size_t i = 0 ; i < boxchars. size (); ++i ) {
207
- if (boxchars[i] ->ch () == ch) return boxchars[i] ->box ()->x ;
206
+ for (const auto & boxchar : boxchars) {
207
+ if (boxchar ->ch () == ch) return boxchar ->box ()->x ;
208
208
}
209
209
return INT_MAX;
210
210
}
@@ -223,8 +223,7 @@ TEST_F(StringRendererTest, ArabicBoxcharsInLTROrder) {
223
223
EXPECT_TRUE (ReadMemBoxes (0 , false , boxes_str.c_str (), false , nullptr , &texts,
224
224
nullptr , nullptr ));
225
225
std::string ltr_str;
226
- for (int i = 0 ; i < texts.size (); ++i)
227
- ltr_str += texts[i].string ();
226
+ for (int i = 0 ; i < texts.size (); ++i) ltr_str += texts[i].string ();
228
227
// The string should come out perfectly reversed, despite there being a
229
228
// ligature.
230
229
EXPECT_EQ (ltr_str, kRevWord );
@@ -364,7 +363,8 @@ TEST_F(StringRendererTest, DoesRenderWordBoxes) {
364
363
renderer_->RenderToImage (kEngText , strlen (kEngText ), &pix));
365
364
pixDestroy (&pix);
366
365
// Verify #boxchars = #words + #spaces
367
- std::vector<std::string> words = absl::StrSplit (kEngText , ' ' , absl::SkipEmpty ());
366
+ std::vector<std::string> words =
367
+ absl::StrSplit (kEngText , ' ' , absl::SkipEmpty ());
368
368
const int kNumSpaces = words.size () - 1 ;
369
369
const int kExpectedNumBoxes = words.size () + kNumSpaces ;
370
370
const std::vector<BoxChar*>& boxchars = renderer_->GetBoxes ();
0 commit comments