Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

test for ocr function

matthew-heartful2d250bc8e72e
diff --git a/screenpipe-vision/tests/integration_test.rs b/screenpipe-vision/tests/integration_test.rs
new file mode 100644
index 000000000..098d90b3f
--- /dev/null
+++ b/screenpipe-vision/tests/integration_test.rs
@@ -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(())
+}
\ No newline at end of file
diff --git a/screenpipe-vision/tests/testing_OCR.png b/screenpipe-vision/tests/testing_OCR.png
new file mode 100644
index 000000000..8c3131fe4
Binary files /dev/null and b/screenpipe-vision/tests/testing_OCR.png differ