Skip to content

Commit

Permalink
Fixed wrong test.
Browse files Browse the repository at this point in the history
Fixed wrong code.
  • Loading branch information
ws233 committed Jul 6, 2015
1 parent 452f426 commit 0e1b170
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TesseractOCR/G8Tesseract.mm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ - (BOOL)moveTessdataToDirectoryIfNecessary:(NSString *)directoryPath
BOOL isDirectory = YES;
if (![fileManager fileExistsAtPath:tessdataPath isDirectory:&isDirectory] || !isDirectory) {
// No tessdata directory in application bundle, nothing to do.
return YES;
return NO;
}

if ([fileManager fileExistsAtPath:destinationPath] == NO) {
Expand Down
12 changes: 7 additions & 5 deletions TestsProject/TestsProjectTests/InitializationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ - (void*)pixForImage:(UIImage *)image;

it(@"Should not initialize if no tessdata folder in app bundle", ^{

NSString *tessdataPath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:tessdataFolderName];
[[NSFileManager defaultManager] stub:@selector(fileExistsAtPath:isDirectory:) andReturn:NO withArguments:tessdataPath, nil];

G8Tesseract *tesseract = [[G8Tesseract alloc] initWithLanguage:kG8Languages configDictionary:nil configFileNames:nil absoluteDataPath:nil engineMode:G8OCREngineModeTesseractOnly];
[[tesseract shouldNot] beNil];
[[NSFileManager defaultManager] stub:@selector(fileExistsAtPath:isDirectory:) andReturn:NO];
G8Tesseract *tesseract = [[G8Tesseract alloc] initWithLanguage:kG8Languages
configDictionary:nil
configFileNames:nil
absoluteDataPath:customDirectoryPath
engineMode:G8OCREngineModeTesseractOnly];
[[tesseract should] beNil];
});
});

Expand Down

0 comments on commit 0e1b170

Please sign in to comment.