Remove condition_with_duration for ModelHandle
Also, use a 2s timeout on CI for both `ModelHandle::condition` and `ViewHandle::condition`.
This commit is contained in:
+7
-16
@@ -10,7 +10,6 @@ use crate::{
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_task::Task;
|
||||
use keymap::MatchResult;
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use pathfinder_geometry::{rect::RectF, vector::vec2f};
|
||||
use platform::Event;
|
||||
@@ -2083,15 +2082,6 @@ impl<T: Entity> ModelHandle<T> {
|
||||
pub fn condition(
|
||||
&self,
|
||||
ctx: &TestAppContext,
|
||||
predicate: impl FnMut(&T, &AppContext) -> bool,
|
||||
) -> impl Future<Output = ()> {
|
||||
self.condition_with_duration(Duration::from_millis(100), ctx, predicate)
|
||||
}
|
||||
|
||||
pub fn condition_with_duration(
|
||||
&self,
|
||||
duration: Duration,
|
||||
ctx: &TestAppContext,
|
||||
mut predicate: impl FnMut(&T, &AppContext) -> bool,
|
||||
) -> impl Future<Output = ()> {
|
||||
let (tx, mut rx) = mpsc::channel(1024);
|
||||
@@ -2114,6 +2104,11 @@ impl<T: Entity> ModelHandle<T> {
|
||||
|
||||
let ctx = ctx.weak_self.as_ref().unwrap().upgrade().unwrap();
|
||||
let handle = self.downgrade();
|
||||
let duration = if std::env::var("CI").is_ok() {
|
||||
Duration::from_secs(2)
|
||||
} else {
|
||||
Duration::from_millis(500)
|
||||
};
|
||||
|
||||
async move {
|
||||
timeout(duration, async move {
|
||||
@@ -2293,10 +2288,6 @@ impl<T: View> ViewHandle<T> {
|
||||
ctx: &TestAppContext,
|
||||
mut predicate: impl FnMut(&T, &AppContext) -> bool,
|
||||
) -> impl Future<Output = ()> {
|
||||
lazy_static! {
|
||||
static ref CI: bool = std::env::var("CI").is_ok();
|
||||
}
|
||||
|
||||
let (tx, mut rx) = mpsc::channel(1024);
|
||||
|
||||
let mut ctx = ctx.0.borrow_mut();
|
||||
@@ -2318,8 +2309,8 @@ impl<T: View> ViewHandle<T> {
|
||||
|
||||
let ctx = ctx.weak_self.as_ref().unwrap().upgrade().unwrap();
|
||||
let handle = self.downgrade();
|
||||
let duration = if *CI {
|
||||
Duration::from_secs(1)
|
||||
let duration = if std::env::var("CI").is_ok() {
|
||||
Duration::from_secs(2)
|
||||
} else {
|
||||
Duration::from_millis(500)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user