Skip to content

Commit

Permalink
test for ocr function
Browse files Browse the repository at this point in the history
  • Loading branch information
m13v committed Jul 16, 2024
1 parent af068dc commit 2d250bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions screenpipe-vision/tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use assert_fs::prelude::*;
use std::path::PathBuf;
use std::fs;
use screenpipe_vision::core::perform_ocr; // Adjust the import path

#[test]
fn test_ocr_output() -> Result<(), Box<dyn std::error::Error>> {
println!("Starting test_ocr_output");

// Use the correct path to the testing_OCR.png file
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/testing_OCR.png");
println!("Path to testing_OCR.png: {:?}", path);

let image = image::open(&path).expect("Failed to open image");
let (text, tsv_output) = perform_ocr(&image);

println!("OCR Text: {}", text);
println!("TSV Output: {}", tsv_output);

assert!(!text.is_empty(), "OCR text should not be empty");
assert!(!tsv_output.is_empty(), "TSV output should not be empty");

Ok(())
}
Binary file added screenpipe-vision/tests/testing_OCR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2d250bc

Please sign in to comment.