main.rs (988B)
1 mod account_login_view_test; 2 mod egui_test_setup; 3 use account_login_view_test::AccountLoginTest; 4 use egui_test_setup::{EguiTestCase, EguiTestSetup}; 5 use notedeck::app_creation::generate_native_options; 6 use std::env; 7 8 fn run_test_app<F, T, O>(create_supr: F, create_child: O) 9 where 10 F: 'static + FnOnce(&eframe::CreationContext<'_>) -> EguiTestSetup, 11 T: 'static + EguiTestCase, 12 O: 'static + FnOnce(EguiTestSetup) -> T, 13 { 14 tracing_subscriber::fmt::init(); 15 16 let _ = eframe::run_native( 17 "UI Test Harness", 18 generate_native_options(), 19 Box::new(|cc| Box::new(create_child(create_supr(cc)))), 20 ); 21 } 22 23 fn main() { 24 let args: Vec<String> = env::args().collect(); 25 26 if args.len() > 1 { 27 match args[1].as_str() { 28 "AccountLoginView" => run_test_app(EguiTestSetup::new, AccountLoginTest::new), 29 _ => println!("Component not found."), 30 } 31 } else { 32 println!("Please specify a component to test."); 33 } 34 }