extern crate tesseract;
use screenshots::Screen;
use uuid::Uuid;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    pub fn screenshots() {
        let screens = Screen::all().unwrap();

        for (_index, screen) in screens.iter().enumerate() {
            // 捕获屏幕
            let screenshot = screen.capture().unwrap();

            // 保存截图，使用索引作为文件名的一部分
            let random_uuid = Uuid::new_v4();
            let filename = format!("screenshot/screenshot_{}.png", random_uuid);
            screenshot.save(&filename).unwrap();

            println!("截图: {}", filename);
        }
    }
}

fn ocr() {
    let output_text = tesseract::ocr("/Users/wangyijia/Desktop/wecom-temp-219286-5e1060a3022e70398ee52d83e6cdfc63.jpg", "chi_sim").unwrap();

    println!("识别结果:\n{}", output_text);
}