Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
sassman committed May 23, 2022
1 parent 47d619d commit 20b68ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/linux/x11_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ impl PlatformApi for X11Api {
mod test {
use super::*;
use crate::utils::IMG_EXT;
use crate::Image;
use image::flat::View;
use image::{save_buffer, GenericImageView, Rgba};

Expand All @@ -271,11 +272,13 @@ mod test {
let mut api = X11Api::new()?;
let win = api.get_active_window()?;
let image_raw = api.capture_window_screenshot(win)?;
let image_raw: &Image = image_raw.as_ref();
let image: View<_, Rgba<u8>> = image_raw.as_view().unwrap();
let (width, height) = image.dimensions();

api.calibrate(win)?;
let image_calibrated_raw = api.capture_window_screenshot(win)?;
let image_calibrated_raw: &Image = image_calibrated_raw.as_ref();
let image_calibrated: View<_, Rgba<u8>> = image_calibrated_raw.as_view().unwrap();
let (width_new, height_new) = image_calibrated.dimensions();
dbg!(width, width_new, height, height_new);
Expand Down Expand Up @@ -337,6 +340,7 @@ mod test {
let api = X11Api::new()?;
let win = api.get_active_window()?;
let image_raw = api.capture_window_screenshot(win)?;
let image_raw: &Image = image_raw.as_ref();
let image: View<_, Rgba<u8>> = image_raw.as_view().unwrap();
let (width, height) = image.dimensions();

Expand Down
3 changes: 3 additions & 0 deletions src/macos/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub fn capture_window_screenshot(win_id: u64) -> Result<Frame> {

#[cfg(test)]
mod tests {
use crate::Image;
#[cfg(feature = "e2e_tests")]
use image::save_buffer;

Expand All @@ -69,6 +70,7 @@ mod tests {
let mut api = setup()?;
let win = 5308;
let image = api.capture_window_screenshot(win)?;
let image: &Image = image.as_ref();
let (width, height) = (image.layout.width, image.layout.height);
dbg!(width, height);

Expand All @@ -84,6 +86,7 @@ mod tests {

api.calibrate(win)?;
let image_cropped = api.capture_window_screenshot(win)?;
let image_cropped: &Image = image_cropped.as_ref();

assert!(width > image_cropped.layout.width);
// Note: visual validation is sometimes helpful:
Expand Down

0 comments on commit 20b68ce

Please sign in to comment.