Use quit to end tests

This commit is contained in:
Conrad Irwin 2023-10-26 10:40:04 +02:00
parent 51aa0d6a94
commit 5651ef7ca2
4 changed files with 10 additions and 18 deletions

View file

@ -224,6 +224,8 @@ impl AppContext {
{
log::error!("timed out waiting on app_will_quit");
}
self.globals_by_type.clear();
}
pub fn app_metadata(&self) -> AppMetadata {

View file

@ -48,12 +48,8 @@ impl TestAppContext {
}
}
pub fn remove_all_windows(&self) {
// todo!("use app quit instead")
}
pub fn clear_globals(&self) {
// todo!("use app quit instead")
pub fn quit(&self) {
self.app.lock().quit();
}
pub fn refresh(&mut self) -> Result<()> {

View file

@ -1,6 +1,6 @@
use super::{display_bounds_from_native, ns_string, MacDisplay, MetalRenderer, NSRange};
use crate::{
display_bounds_to_native, point, px, size, AnyWindowHandle, Bounds, ExternalPaths, Executor,
display_bounds_to_native, point, px, size, AnyWindowHandle, Bounds, Executor, ExternalPaths,
FileDropEvent, GlobalPixels, InputEvent, KeyDownEvent, Keystroke, Modifiers,
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
PlatformAtlas, PlatformDisplay, PlatformInputHandler, PlatformWindow, Point, Scene, Size,

View file

@ -3,8 +3,8 @@ use proc_macro2::Ident;
use quote::{format_ident, quote};
use std::mem;
use syn::{
parse_macro_input, parse_quote, spanned::Spanned as _, AttributeArgs, FnArg,
ItemFn, Lit, Meta, NestedMeta, Type,
parse_macro_input, parse_quote, spanned::Spanned as _, AttributeArgs, FnArg, ItemFn, Lit, Meta,
NestedMeta, Type,
};
pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
@ -110,9 +110,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
);
));
cx_teardowns.extend(quote!(
#cx_varname.remove_all_windows();
dispatcher.run_until_parked();
#cx_varname.clear_globals();
#cx_varname.quit();
dispatcher.run_until_parked();
));
inner_fn_args.extend(quote!(&mut #cx_varname,));
@ -176,9 +174,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
));
inner_fn_args.extend(quote!(&mut #cx_varname_lock,));
cx_teardowns.extend(quote!(
#cx_varname.remove_all_windows();
dispatcher.run_until_parked();
#cx_varname.clear_globals();
#cx_varname.quit();
dispatcher.run_until_parked();
));
continue;
@ -191,9 +187,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
);
));
cx_teardowns.extend(quote!(
#cx_varname.remove_all_windows();
dispatcher.run_until_parked();
#cx_varname.clear_globals();
#cx_varname.quit();
dispatcher.run_until_parked();
));
inner_fn_args.extend(quote!(&mut #cx_varname,));