chore: comment out image generator when not in use

This commit is contained in:
Jonathan Kelley 2022-02-13 12:35:07 -05:00
parent 64f8e58c04
commit ab99bc6c8d
2 changed files with 26 additions and 23 deletions

View file

@ -41,4 +41,4 @@ tokio_runtime = ["tokio"]
[dev-dependencies]
dioxus-hooks = { path = "../hooks" }
image = "0.24.0"
# image = "0.24.0" # enable this when generating a new desktop image

View file

@ -103,25 +103,28 @@ impl Default for DesktopConfig {
// dirty trick, avoid introducing `image` at runtime
// TODO: use serde when `Icon` impl serde
#[test]
#[ignore]
fn prepare_default_icon() {
use image::io::Reader as ImageReader;
use image::ImageFormat;
use std::fs::File;
use std::io::Cursor;
use std::io::Write;
use std::path::PathBuf;
let png: &[u8] = include_bytes!("default_icon.png");
let mut reader = ImageReader::new(Cursor::new(png));
reader.set_format(ImageFormat::Png);
let icon = reader.decode().unwrap();
let bin = PathBuf::from(file!())
.parent()
.unwrap()
.join("default_icon.bin");
println!("{:?}", bin);
let mut file = File::create(bin).unwrap();
file.write_all(icon.as_bytes()).unwrap();
println!("({}, {})", icon.width(), icon.height())
}
//
// This function should only be enabled when generating new icons.
//
// #[test]
// #[ignore]
// fn prepare_default_icon() {
// use image::io::Reader as ImageReader;
// use image::ImageFormat;
// use std::fs::File;
// use std::io::Cursor;
// use std::io::Write;
// use std::path::PathBuf;
// let png: &[u8] = include_bytes!("default_icon.png");
// let mut reader = ImageReader::new(Cursor::new(png));
// reader.set_format(ImageFormat::Png);
// let icon = reader.decode().unwrap();
// let bin = PathBuf::from(file!())
// .parent()
// .unwrap()
// .join("default_icon.bin");
// println!("{:?}", bin);
// let mut file = File::create(bin).unwrap();
// file.write_all(icon.as_bytes()).unwrap();
// println!("({}, {})", icon.width(), icon.height())
// }