|
12 | 12 | #import <Kiwi/Kiwi.h> |
13 | 13 | #import "Defaults.h" |
14 | 14 |
|
| 15 | +@interface G8Tesseract (Tests) |
| 16 | +- (BOOL)configEngine; |
| 17 | +- (BOOL)resetEngine; |
| 18 | +@end |
| 19 | + |
15 | 20 | SPEC_BEGIN(TesseractInitialization) |
16 | 21 |
|
17 | 22 | describe(@"Tesseract initialization", ^{ |
|
43 | 48 | [[recognizedText should] equal:@"1234567890\n\n"]; |
44 | 49 | }; |
45 | 50 |
|
| 51 | + context(@"Should check common function", ^{ |
| 52 | + |
| 53 | + it(@"Should check version", ^{ |
| 54 | + [[[G8Tesseract version] should] equal:@"3.03"]; |
| 55 | + }); |
| 56 | + }); |
| 57 | + |
46 | 58 | context(@"nil cachesRelatedDataPath", ^{ |
47 | 59 |
|
48 | 60 | it(@"Should initialize simple", ^{ |
|
51 | 63 | [[tesseract shouldNot] beNil]; |
52 | 64 |
|
53 | 65 | [[tesseract.absoluteDataPath should] equal:resourcePath]; |
| 66 | + |
| 67 | + tesseract = [G8Tesseract alloc]; |
| 68 | + [[tesseract shouldNot] beNil]; |
| 69 | + NSAssert([tesseract respondsToSelector:@selector(configEngine)] == YES, @"Error! G8Tesseract instance does not contain configEngine selector"); |
| 70 | + [[tesseract should] receive:@selector(configEngine) andReturn:theValue(NO)]; |
| 71 | + tesseract = [tesseract init]; |
| 72 | + |
| 73 | + [[tesseract should] beNil]; |
| 74 | + |
| 75 | + tesseract = [[G8Tesseract alloc] init]; |
| 76 | + NSAssert([tesseract respondsToSelector:@selector(resetEngine)] == YES, @"Error! G8Tesseract instance does not contain resetEngine selector"); |
| 77 | + [[tesseract should] receive:@selector(configEngine) andReturn:theValue(NO)]; |
| 78 | + [[theValue([tesseract resetEngine]) should] beNo]; |
| 79 | + }); |
| 80 | + |
| 81 | + it(@"Should initialize simple with engine mode", ^{ |
| 82 | + [[fileManager shouldNot] receive:@selector(createSymbolicLinkAtPath:withDestinationPath:error:)]; |
| 83 | + G8Tesseract *tesseract = [[G8Tesseract alloc] initWithLanguage:kG8Languages engineMode:G8OCREngineModeTesseractOnly]; |
| 84 | + [[tesseract shouldNot] beNil]; |
| 85 | + |
| 86 | + [[tesseract.absoluteDataPath should] equal:resourcePath]; |
54 | 87 | }); |
55 | 88 |
|
56 | 89 | NSString *debugConfigsFilePathFromTheBundle = [[tessdataFolderPathFromTheBundle stringByAppendingPathComponent:tessConfigsFolderName] stringByAppendingPathComponent:debugConfigsFileName]; |
|
0 commit comments