1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-28 04:44:06 +00:00
UltimateTrainingModpack/src/test.rs
asimon-1 e2a5620ee3
Change from remote to local resource files (#315)
* Extract css into standalone file

* Move images to static folder

* Add fonts, fix focus animation

* Remove Nintendo JS dependencies

* Remove unused sliders templating

* Fix shadows

* Fix back button

* Work on Sound Effects

* Change htdocs folder

* Move fonts to a folder

* Refactor JS to remove jquery as a dependency

* Fix broken JS

* Update rust.yml
2022-03-05 13:55:13 -08:00

33 lines
1 KiB
Rust

/// Recommended to run with the following command:
/// `RUSTFLAGS=-Awarnings cargo test --target=x86_64-unknown-linux-gnu`
/// But you can replace the target with your PC's target.
/// This will run and render the default menu in your default HTML opening program, ideally Chrome.
#[test]
fn write_menu() {
unsafe {
use crate::common::menu::write_menu;
use std::process::Command;
let folder_path = "../training_modpack.htdocs";
let path = "../training_modpack.htdocs/training_menu.html";
assert!(
std::path::Path::new(folder_path).exists(),
"Needs required folder: ../training_modpack.htdocs!"
);
std::fs::write(path, write_menu()).unwrap();
let (cmd, args) = if wsl::is_wsl() || cfg!(target_os = "windows") {
("cmd.exe", ["/C", "start", path])
} else {
("sh", ["-c", "open", path])
};
Command::new(cmd)
.args(&args)
.output()
.expect("failed to open rendered HTML file");
}
}