@@ -2764,61 +2764,6 @@ mod tests {
assert_eq!(handle_1.read(app).events, vec![7, 10, 5])
}
- // #[crate::test(self)]
- // async fn test_spawn_from_model(mut app: TestAppContext) {
- // #[derive(Default)]
- // struct Model {
- // count: usize,
- // }
-
- // impl Entity for Model {
- // type Event = ();
- // }
-
- // let handle = app.add_model(|_| Model::default());
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn(async { 7 }, |model, output, _| {
- // model.count = output;
- // })
- // })
- // .await;
- // app.read(|ctx| assert_eq!(handle.read(ctx).count, 7));
-
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn(async { 14 }, |model, output, _| {
- // model.count = output;
- // })
- // })
- // .await;
- // app.read(|ctx| assert_eq!(handle.read(ctx).count, 14));
- // }
-
- // #[crate::test(self)]
- // async fn test_spawn_stream_local_from_model(mut app: TestAppContext) {
- // #[derive(Default)]
- // struct Model {
- // events: Vec<Option<usize>>,
- // }
-
- // impl Entity for Model {
- // type Event = ();
- // }
-
- // let handle = app.add_model(|_| Model::default());
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn_stream(
- // smol::stream::iter(vec![1, 2, 3]),
- // |model, output, _| model.events.push(Some(output)),
- // |model, _| model.events.push(None),
- // )
- // })
- // .await;
- // app.read(|ctx| assert_eq!(handle.read(ctx).events, [Some(1), Some(2), Some(3), None]));
- // }
-
#[crate::test(self)]
fn test_view_handles(app: &mut MutableAppContext) {
struct View {
@@ -3135,85 +3080,6 @@ mod tests {
);
}
- // #[crate::test(self)]
- // async fn test_spawn_from_view(mut app: TestAppContext) {
- // #[derive(Default)]
- // struct View {
- // count: usize,
- // }
-
- // impl Entity for View {
- // type Event = ();
- // }
-
- // impl super::View for View {
- // fn render<'a>(&self, _: &AppContext) -> ElementBox {
- // Empty::new().boxed()
- // }
-
- // fn ui_name() -> &'static str {
- // "View"
- // }
- // }
-
- // let handle = app.add_window(|_| View::default()).1;
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn(async { 7 }, |me, output, _| {
- // me.count = output;
- // })
- // })
- // .await;
- // app.read(|ctx| assert_eq!(handle.read(ctx).count, 7));
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn(async { 14 }, |me, output, _| {
- // me.count = output;
- // })
- // })
- // .await;
- // app.read(|ctx| assert_eq!(handle.read(ctx).count, 14));
- // }
-
- // #[crate::test(self)]
- // async fn test_spawn_stream_local_from_view(mut app: TestAppContext) {
- // #[derive(Default)]
- // struct View {
- // events: Vec<Option<usize>>,
- // }
-
- // impl Entity for View {
- // type Event = ();
- // }
-
- // impl super::View for View {
- // fn render<'a>(&self, _: &AppContext) -> ElementBox {
- // Empty::new().boxed()
- // }
-
- // fn ui_name() -> &'static str {
- // "View"
- // }
- // }
-
- // let (_, handle) = app.add_window(|_| View::default());
- // handle
- // .update(&mut app, |_, c| {
- // c.spawn_stream(
- // smol::stream::iter(vec![1_usize, 2, 3]),
- // |me, output, _| {
- // me.events.push(Some(output));
- // },
- // |me, _| {
- // me.events.push(None);
- // },
- // )
- // })
- // .await;
-
- // app.read(|ctx| assert_eq!(handle.read(ctx).events, [Some(1), Some(2), Some(3), None]))
- // }
-
#[crate::test(self)]
fn test_dispatch_action(app: &mut MutableAppContext) {
struct ViewA {