Use quit to end tests
This commit is contained in:
parent
51aa0d6a94
commit
5651ef7ca2
4 changed files with 10 additions and 18 deletions
|
@ -224,6 +224,8 @@ impl AppContext {
|
||||||
{
|
{
|
||||||
log::error!("timed out waiting on app_will_quit");
|
log::error!("timed out waiting on app_will_quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.globals_by_type.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn app_metadata(&self) -> AppMetadata {
|
pub fn app_metadata(&self) -> AppMetadata {
|
||||||
|
|
|
@ -48,12 +48,8 @@ impl TestAppContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_all_windows(&self) {
|
pub fn quit(&self) {
|
||||||
// todo!("use app quit instead")
|
self.app.lock().quit();
|
||||||
}
|
|
||||||
|
|
||||||
pub fn clear_globals(&self) {
|
|
||||||
// todo!("use app quit instead")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn refresh(&mut self) -> Result<()> {
|
pub fn refresh(&mut self) -> Result<()> {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use super::{display_bounds_from_native, ns_string, MacDisplay, MetalRenderer, NSRange};
|
use super::{display_bounds_from_native, ns_string, MacDisplay, MetalRenderer, NSRange};
|
||||||
use crate::{
|
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,
|
FileDropEvent, GlobalPixels, InputEvent, KeyDownEvent, Keystroke, Modifiers,
|
||||||
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
|
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
|
||||||
PlatformAtlas, PlatformDisplay, PlatformInputHandler, PlatformWindow, Point, Scene, Size,
|
PlatformAtlas, PlatformDisplay, PlatformInputHandler, PlatformWindow, Point, Scene, Size,
|
||||||
|
|
|
@ -3,8 +3,8 @@ use proc_macro2::Ident;
|
||||||
use quote::{format_ident, quote};
|
use quote::{format_ident, quote};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use syn::{
|
use syn::{
|
||||||
parse_macro_input, parse_quote, spanned::Spanned as _, AttributeArgs, FnArg,
|
parse_macro_input, parse_quote, spanned::Spanned as _, AttributeArgs, FnArg, ItemFn, Lit, Meta,
|
||||||
ItemFn, Lit, Meta, NestedMeta, Type,
|
NestedMeta, Type,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
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_teardowns.extend(quote!(
|
||||||
#cx_varname.remove_all_windows();
|
#cx_varname.quit();
|
||||||
dispatcher.run_until_parked();
|
|
||||||
#cx_varname.clear_globals();
|
|
||||||
dispatcher.run_until_parked();
|
dispatcher.run_until_parked();
|
||||||
));
|
));
|
||||||
inner_fn_args.extend(quote!(&mut #cx_varname,));
|
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,));
|
inner_fn_args.extend(quote!(&mut #cx_varname_lock,));
|
||||||
cx_teardowns.extend(quote!(
|
cx_teardowns.extend(quote!(
|
||||||
#cx_varname.remove_all_windows();
|
#cx_varname.quit();
|
||||||
dispatcher.run_until_parked();
|
|
||||||
#cx_varname.clear_globals();
|
|
||||||
dispatcher.run_until_parked();
|
dispatcher.run_until_parked();
|
||||||
));
|
));
|
||||||
continue;
|
continue;
|
||||||
|
@ -191,9 +187,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
|
||||||
);
|
);
|
||||||
));
|
));
|
||||||
cx_teardowns.extend(quote!(
|
cx_teardowns.extend(quote!(
|
||||||
#cx_varname.remove_all_windows();
|
#cx_varname.quit();
|
||||||
dispatcher.run_until_parked();
|
|
||||||
#cx_varname.clear_globals();
|
|
||||||
dispatcher.run_until_parked();
|
dispatcher.run_until_parked();
|
||||||
));
|
));
|
||||||
inner_fn_args.extend(quote!(&mut #cx_varname,));
|
inner_fn_args.extend(quote!(&mut #cx_varname,));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue