fix: update dependencies

This commit is contained in:
Nova
2022-12-03 11:43:36 -05:00
parent 82b110260a
commit 43294edee4
4 changed files with 74 additions and 69 deletions

View File

@@ -5,18 +5,15 @@ use std::str::FromStr;
use std::{env, fs};
use anyhow::Result;
use image::GenericImageView;
use resvg::render;
use resvg::tiny_skia::{Pixmap, PixmapMut, Transform};
use resvg::tiny_skia::{Pixmap, Transform};
use resvg::usvg::{FitTo, Tree};
use walkdir::WalkDir;
fn get_desktop_files() -> Vec<PathBuf> {
// Get the XDG data directories
let xdg_data_dirs = match std::env::var("XDG_DATA_DIRS") {
Ok(val) => val,
Err(_) => "/usr/local/share:/usr/share".to_string(),
};
let xdg_data_dirs =
std::env::var("XDG_DATA_DIRS").unwrap_or("/usr/local/share:/usr/share".to_string());
// Append the applications directory to each data directory
let app_dirs = xdg_data_dirs
@@ -120,11 +117,9 @@ fn test_parse_desktop_file() {
fs::write(&file, data).unwrap();
// Parse the test desktop file
let result = parse_desktop_file(&file);
assert!(result.is_ok());
let desktop_file = parse_desktop_file(&file).unwrap();
// Check the parsed values
let desktop_file = result.unwrap();
assert_eq!(desktop_file.name, Some("Test".to_string()));
assert_eq!(desktop_file.command, Some("test".to_string()));
assert_eq!(
@@ -171,6 +166,7 @@ fn render_svg_to_png(svg_path: &PathBuf, png_path: &PathBuf, size: u32) -> Resul
}
#[test]
fn test_render_svg_to_png() {
use image::GenericImageView;
// Create temporary input and output paths
let input_path = PathBuf::from("test_input.svg");
let output_path = PathBuf::from("test_output.png");

View File

@@ -55,7 +55,16 @@ impl ProtoStar {
impl LifeCycleHandler for ProtoStar {
fn logic_step(&mut self, info: LogicStepInfo) {
self.grabbable.update();
if self.grabbable.grab_action().actor_stopped() {
if let Some(icon_shrink) = &mut self.icon_shrink {
if let Some(scale) = icon_shrink.update(info.delta) {
self.icon
.set_scale(None, Vector3::from([scale; 3]))
.unwrap();
} else {
self.client.stop_loop();
}
} else if self.grabbable.grab_action().actor_stopped() {
let startup_settings =
StartupSettings::create(&self.field.spatial.client().unwrap()).unwrap();
self.grabbable
@@ -82,14 +91,5 @@ impl LifeCycleHandler for ProtoStar {
}
});
}
if let Some(icon_shrink) = &mut self.icon_shrink {
if let Some(scale) = icon_shrink.update(info.delta) {
self.icon
.set_scale(None, Vector3::from([scale; 3]))
.unwrap();
} else {
self.client.stop_loop();
}
}
}
}