Skip to content

Commit

Permalink
Update TesseractOcrTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ANcpLua authored Jan 14, 2025
1 parent f33cf69 commit ec49898
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions Tests/TesseractOcrTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ public void OcrPdf_EmptyStream_ShouldThrowException()
Assert.That(() => _ocr.OcrPdf(emptyStream), Throws.Exception);
}

[Test]
public void OcrPdf_MissingTrainedData_ShouldThrowException()
{
// Arrange
var invalidTessDataPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "invalid_tessdata");
Directory.CreateDirectory(invalidTessDataPath);

var ocr = new Ocr("eng", invalidTessDataPath, _mockLogger.Object);
var pdfStream = CreateValidPdfStream();

// Act & Assert
Assert.That(() => ocr.OcrPdf(pdfStream),
Throws.Exception.With.Message.Contains("Failed to initialise tesseract engine"));

// Cleanup
Directory.Delete(invalidTessDataPath, true);
}

private Stream CreateValidPdfStream()
{
return new FileStream(_testFilePath, FileMode.Open, FileAccess.Read);
Expand Down

0 comments on commit ec49898

Please sign in to comment.