Skip to content

Commit 3165853

Browse files
committed
default-resolution: Make constants extern. Update test
1 parent 7df2c3e commit 3165853

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

TesseractOCR/G8Tesseract.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@
1111
#import "G8Constants.h"
1212
#import "G8TesseractDelegate.h"
1313

14+
/**
15+
* Default value of `sourceResolution` property.
16+
*/
17+
extern NSInteger const kG8DefaultResolution;
18+
19+
/**
20+
* Minimum alowed value of `sourceResolution` property.
21+
*/
22+
extern NSInteger const kG8MinCredibleResolution;
23+
24+
/**
25+
* Maximum alowed value of `sourceResolution` property.
26+
*/
27+
extern NSInteger const kG8MaxCredibleResolution;
28+
1429
/**
1530
* `G8Tesseract` encapsulates the Tesseract library and provides properties
1631
* and methods for performing text recognition and analysis on a target image.

TesseractOCR/G8Tesseract.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#import "genericvector.h"
2323
#import "strngs.h"
2424

25-
static NSInteger const kG8DefaultResolution = 72;
26-
static NSInteger const kG8MinCredibleResolution = 70;
27-
static NSInteger const kG8MaxCredibleResolution = 2400;
25+
NSInteger const kG8DefaultResolution = 72;
26+
NSInteger const kG8MinCredibleResolution = 70;
27+
NSInteger const kG8MaxCredibleResolution = 2400;
2828

2929
namespace tesseract {
3030
class TessBaseAPI;

TestsProject/TestsProjectTests/RecognitionTests.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@
128128
it(@"Should clamp source resolution", ^{
129129
[helper setupTesseract];
130130

131+
[[theValue(helper.tesseract.sourceResolution) should] equal:theValue(kG8DefaultResolution)];
132+
131133
helper.tesseract.sourceResolution = 50;
132-
[[theValue(helper.tesseract.sourceResolution) should] beInTheIntervalFrom:theValue(70) to:theValue(2400)];
134+
[[theValue(helper.tesseract.sourceResolution) should] beInTheIntervalFrom:theValue(kG8MinCredibleResolution)
135+
to:theValue(kG8MaxCredibleResolution)];
133136

134137
helper.tesseract.sourceResolution = 3000;
135-
[[theValue(helper.tesseract.sourceResolution) should] beInTheIntervalFrom:theValue(70) to:theValue(2400)];
138+
[[theValue(helper.tesseract.sourceResolution) should] beInTheIntervalFrom:theValue(kG8MinCredibleResolution)
139+
to:theValue(kG8MaxCredibleResolution)];
136140
});
137141

138142
it(@"Should draw blocks on image", ^{

0 commit comments

Comments
 (0)