mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-26 12:30:48 +01:00
test: polling deadlines are a minute, not two seconds; the stroke test skips work it never read (M8)
This commit is contained in:
1 parent
26c54d7471
commit
654e4efbe4
5 files changed
+10
-7
No files matched your search
@@ -328,7 +328,8 @@ fn dropping_the_server_frees_the_port() {
|
||||
let port = server.port;
|
||||
assert!(TcpListener::bind(("127.0.0.1", port)).is_err(), "the port is taken while the server lives");
|
||||
drop(server);
|
||||
let freed = (0..200).any(|_| {
|
||||
// (Up to a minute: the listening thread ends when it next runs, late on a busy machine.)
|
||||
let freed = (0..6000).any(|_| {
|
||||
std::thread::sleep(Duration::from_millis(10));
|
||||
TcpListener::bind(("127.0.0.1", port)).is_ok()
|
||||
});
|
||||
|
||||
@@ -931,9 +931,9 @@ mod tests {
|
||||
assert!(apart < 1.0 / 255.0, "{what}, {how}: {apart}");
|
||||
// 3. Against the truth: each pixel sampled 16 × 16 times against the pieces.
|
||||
// (Checked for the plain styles; a sample grid is good to a sixteenth.)
|
||||
let (pieces, _) = piece_loops(&lines, hw, &outline, profile.as_ref(), None, false);
|
||||
let before = coverage(&pieces, FillRule::NonZero);
|
||||
if how == "round" || how == "dashes whose round caps overlap" {
|
||||
let (pieces, _) = piece_loops(&lines, hw, &outline, profile.as_ref(), None, false);
|
||||
let before = coverage(&pieces, FillRule::NonZero);
|
||||
for y in (0..300).step_by(7) {
|
||||
for x in 0..400 {
|
||||
let c = drawn[y * 400 + x];
|
||||
|
||||
+3
-2
@@ -589,10 +589,11 @@ mod imp {
|
||||
)
|
||||
}
|
||||
|
||||
/// Frames until the start thread has answered (bounded).
|
||||
/// Frames until the start thread has answered (bounded: a minute, which only a start
|
||||
/// thread that never answers reaches; a busy machine can take seconds to run it).
|
||||
fn settle(m: &mut Imp<Fake>, svc: &RenderService, ctx: &egui::Context, now: f64, size: (u32, u32)) -> Vec<Notice> {
|
||||
let mut out = Vec::new();
|
||||
for _ in 0..400 {
|
||||
for _ in 0..12_000 {
|
||||
out.extend(m.sync(true, svc, ctx, now, size));
|
||||
if m.starting.is_none() {
|
||||
break;
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ mod tests {
|
||||
assert!(!file.exists(), "the token file goes when the window closes");
|
||||
assert_eq!(super::port(&app), None);
|
||||
// The port is free again: the same run can open another window on it (ADR 0092).
|
||||
let freed = (0..200).any(|_| {
|
||||
let freed = (0..6000).any(|_| {
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
std::net::TcpListener::bind(("127.0.0.1", port)).is_ok()
|
||||
});
|
||||
|
||||
+2
-1
@@ -390,8 +390,9 @@ fn autosave_and_recovery_cover_every_open_document() {
|
||||
let dir = std::env::temp_dir().join(format!("anicraft-tabs-recovery-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
// (A minute: a deadline for a save thread on a busy machine, not a time that is checked.)
|
||||
let wait = |saver_ids: &[String]| {
|
||||
for _ in 0..200 {
|
||||
for _ in 0..6000 {
|
||||
if saver_ids.iter().all(|id| recovery::document_path(&dir, id).exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user