Skip to content

Commit

Permalink
feat: windows native ocr
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Aug 3, 2024
1 parent 4f47741 commit c5787a3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
sudo apt-get update
sudo apt-get install -y libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libasound2-dev libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev
- name: Copy test image
run: |
mkdir -p target/debug/deps
cp tests/testing_OCR.png target/debug/deps/
- name: Run tests
run: cargo test

Expand All @@ -53,7 +58,7 @@ jobs:
toolchain: stable

# - name: Run tests
# run: cargo test
# run: cargo test

- name: Run specific Windows OCR test
run: cargo test test_process_ocr_task_windows
run: cargo test test_process_ocr_task_windows
8 changes: 4 additions & 4 deletions screenpipe-vision/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use screenpipe_vision::perform_ocr_tesseract;
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
// Use an absolute path that works in both local and CI environments
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests/testing_OCR.png");
println!("Path to image.png: {:?}", path);

path.push("tests");
path.push("testing_OCR.png");
println!("Path to testing_OCR.png: {:?}", path);
let image = image::open(&path).expect("Failed to open image");

// Start timing
Expand Down
9 changes: 7 additions & 2 deletions screenpipe-vision/tests/windows_vision_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ mod tests {
use screenpipe_vision::{process_ocr_task, OcrEngine};
use std::{sync::Arc, time::Instant};
use tokio::sync::{mpsc, Mutex};

#[cfg(target_os = "windows")]
#[tokio::test]
async fn test_process_ocr_task_windows() {
let image = DynamicImage::new_rgb8(100, 100);
// Use an absolute path that works in both local and CI environments
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.push("tests");
path.push("testing_OCR.png");
println!("Path to testing_OCR.png: {:?}", path);
let image = image::open(&path).expect("Failed to open image");

let image_arc = Arc::new(image);
let frame_number = 1;
let timestamp = Instant::now();
Expand Down

0 comments on commit c5787a3

Please sign in to comment.