mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-27 20:34:03 +00:00
Fix Toggle Naming; Update import for skyline-web (#596)
* Initial * Convert to using Display * Small test refactor * Fix for recent skyline_web change
This commit is contained in:
parent
0f808320c3
commit
afdd620c53
4 changed files with 594 additions and 529 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::fs;
|
||||
|
||||
use skyline_web::DialogOk;
|
||||
use skyline_web::dialog_ok::DialogOk;
|
||||
|
||||
use crate::consts::{
|
||||
LEGACY_MENU_OPTIONS_PATH, MENU_DEFAULT_OPTIONS_PATH, MENU_OPTIONS_PATH, VERSION_TXT_PATH,
|
||||
|
|
|
@ -644,7 +644,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
notifications::clear_notifications("Save State");
|
||||
notifications::notification(
|
||||
"Save State".to_string(),
|
||||
format!("Saved Slot {}", MENU.save_state_slot.as_str().unwrap()),
|
||||
format!("Saved Slot {}", MENU.save_state_slot),
|
||||
120,
|
||||
);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -187,6 +187,46 @@ fn test_save_and_reset_defaults() -> Result<(), Box<dyn Error>> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn _get_frame_buffer(
|
||||
mut terminal: Terminal<training_mod_tui::TestBackend>,
|
||||
mut app: training_mod_tui::App,
|
||||
) -> Result<String, Box<dyn Error>> {
|
||||
let frame_res = terminal.draw(|f| training_mod_tui::ui(f, &mut app))?;
|
||||
let mut full_frame_buffer = String::new();
|
||||
for (i, cell) in frame_res.buffer.content().iter().enumerate() {
|
||||
full_frame_buffer.push_str(&cell.symbol);
|
||||
if i % frame_res.area.width as usize == frame_res.area.width as usize - 1 {
|
||||
full_frame_buffer.push_str("\n");
|
||||
}
|
||||
}
|
||||
full_frame_buffer.push_str("\n");
|
||||
|
||||
Ok(full_frame_buffer)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_toggle_naming() -> Result<(), Box<dyn Error>> {
|
||||
let menu;
|
||||
let mut prev_menu;
|
||||
let menu_defaults;
|
||||
unsafe {
|
||||
prev_menu = MENU.clone();
|
||||
menu = ui_menu(MENU);
|
||||
menu_defaults = (ui_menu(MENU), serde_json::to_string(&MENU).unwrap());
|
||||
}
|
||||
|
||||
let (mut terminal, mut app) = test_backend_setup(menu, menu_defaults)?;
|
||||
// Enter Mash Toggles
|
||||
app.on_a();
|
||||
// Set Mash Airdodge
|
||||
app.on_a();
|
||||
|
||||
let frame_buffer = _get_frame_buffer(terminal, app)?;
|
||||
assert!(frame_buffer.contains("Airdodge"));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
let inputs = args.get(1);
|
||||
|
|
Loading…
Reference in a new issue