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

fix: unit tests

Louis Beaumont77ee82cd1afa
diff --git a/screenpipe-server/src/add.rs b/screenpipe-server/src/add.rs
index 478d2e47b..5897b72fc 100644
--- a/screenpipe-server/src/add.rs
+++ b/screenpipe-server/src/add.rs
@@ -77,8 +77,8 @@ pub async fn handle_index_command(
}
}
- let mut total_frames = 0;
- let mut total_text = 0;
+ let mut total_frames = 0;
+ let mut total_text = 0;
// Setup channel for OCR results
@@ -189,8 +189,8 @@ pub async fn handle_index_command(
_ => {
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
{
- perform_ocr_tesseract(&frame, vec![]) // Ensure this returns the expected tuple
- }
+ perform_ocr_tesseract(&frame, Arc::new(vec![]))
+ }
#[cfg(any(target_os = "macos", target_os = "windows"))]
panic!("unsupported ocr engine");
}
@@ -330,4 +330,4 @@ fn find_video_files(root: &str, pattern: Option<&str>) -> Result<Vec<PathBuf>> {
}
Ok(video_files)
-}
\ No newline at end of file
+}
diff --git a/screenpipe-vision/tests/custom_ocr_test.rs b/screenpipe-vision/tests/custom_ocr_test.rs
index b1a07e441..5761a8d0b 100644
--- a/screenpipe-vision/tests/custom_ocr_test.rs
+++ b/screenpipe-vision/tests/custom_ocr_test.rs
@@ -61,7 +61,6 @@ rm -rf venv app.py
*/
#[cfg(test)]
-#[ignore] // need to run server
mod tests {
use image::GenericImageView;
use screenpipe_core::Language;
@@ -71,6 +70,7 @@ mod tests {
use std::sync::Arc;
#[tokio::test]
+ #[ignore] // need to run server
async fn test_custom_ocr() {
println!("Starting custom OCR test...");
@@ -119,6 +119,7 @@ mod tests {
}
#[tokio::test]
+ #[ignore] // need to run server
async fn test_custom_ocr_chinese() {
println!("Starting custom OCR Chinese test...");
diff --git a/screenpipe-vision/tests/windows_vision_test.rs b/screenpipe-vision/tests/windows_vision_test.rs
index dbf513c0a..6f0e23a3e 100644
--- a/screenpipe-vision/tests/windows_vision_test.rs
+++ b/screenpipe-vision/tests/windows_vision_test.rs
@@ -7,7 +7,9 @@ mod tests {
use std::{path::PathBuf, time::Instant};
use tokio::sync::mpsc;
+ use screenpipe_vision::core::CapturedWindow;
use screenpipe_vision::{continuous_capture, CaptureResult};
+ use std::sync::Arc;
use std::time::Duration;
use tokio::time::timeout;
@@ -21,18 +23,18 @@ mod tests {
println!("Path to testing_OCR.png: {:?}", path);
let image = image::open(&path).expect("Failed to open image");
- let image_arc = image.clone();
+ let image_arc = Arc::new(image.clone());
let frame_number = 1;
let timestamp = Instant::now();
let (tx, _rx) = mpsc::channel(1);
- let ocr_engine = OcrEngine::WindowsNative;
+ let ocr_engine = Arc::new(OcrEngine::WindowsNative);
- let window_images = vec![(
- image.clone(),
- "test_app".to_string(),
- "test_window".to_string(),
- true,
- )];
+ let window_images = vec![CapturedWindow {
+ image: image.clone(),
+ app_name: "test_app".to_string(),
+ window_name: "test_window".to_string(),
+ is_foreground: true,
+ }];
let result = process_ocr_task(
OcrTaskData {
@@ -42,8 +44,8 @@ mod tests {
timestamp,
result_tx: tx,
},
- &ocr_engine,
- vec![],
+ ocr_engine,
+ Arc::new(vec![]),
)
.await;
@@ -63,7 +65,7 @@ mod tests {
// Set up test parameters
let interval = Duration::from_millis(1000);
let save_text_files_flag = false;
- let ocr_engine = OcrEngine::WindowsNative;
+ let ocr_engine = Arc::new(OcrEngine::WindowsNative);
let window_filters = Arc::new(WindowFilters::new(&[], &[]));
// Spawn the continuous_capture function