mirror of
https://github.com/ZSeven-W/openpencil.git
synced 2026-05-31 19:04:29 +07:00
test(ai): cover image search job polling
Some checks failed
Rust check (native) / macos-latest / 1.94 (push) Waiting to run
Rust check (native) / windows-latest / 1.94 (push) Waiting to run
Rust multi-platform build / linux-aarch64 (push) Waiting to run
Rust multi-platform build / macos-aarch64 (push) Waiting to run
Rust multi-platform build / windows-x86_64 (push) Waiting to run
Rust multi-platform build / macos-x86_64 (push) Waiting to run
Rust multi-platform build / windows-aarch64 (push) Waiting to run
Rust multi-platform build / ios-aarch64 (cargo check only) (push) Waiting to run
Rust multi-platform build / ios-aarch64-sim (cargo check only) (push) Waiting to run
Rust check (native) / ubuntu-latest / 1.94 (push) Failing after 2s
Rust check (native) / cargo-deny (native) (push) Failing after 2s
Rust check (native) / diagnostics golden drift (push) Failing after 2s
Rust multi-platform build / linux-x86_64 (push) Failing after 4s
Rust multi-platform build / wasm32-unknown-unknown / op-host-web (compile guard) (push) Failing after 1s
Rust multi-platform build / android-aarch64 (cargo check only) (push) Failing after 2s
Rust multi-platform build / android-x86_64 (cargo check only) (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo check --target wasm32-unknown-unknown (push) Failing after 1s
WASM bundle check (kickoff §1.2) / cargo-deny --target wasm32-unknown-unknown check bans (push) Failing after 1s
Some checks failed
Rust check (native) / macos-latest / 1.94 (push) Waiting to run
Rust check (native) / windows-latest / 1.94 (push) Waiting to run
Rust multi-platform build / linux-aarch64 (push) Waiting to run
Rust multi-platform build / macos-aarch64 (push) Waiting to run
Rust multi-platform build / windows-x86_64 (push) Waiting to run
Rust multi-platform build / macos-x86_64 (push) Waiting to run
Rust multi-platform build / windows-aarch64 (push) Waiting to run
Rust multi-platform build / ios-aarch64 (cargo check only) (push) Waiting to run
Rust multi-platform build / ios-aarch64-sim (cargo check only) (push) Waiting to run
Rust check (native) / ubuntu-latest / 1.94 (push) Failing after 2s
Rust check (native) / cargo-deny (native) (push) Failing after 2s
Rust check (native) / diagnostics golden drift (push) Failing after 2s
Rust multi-platform build / linux-x86_64 (push) Failing after 4s
Rust multi-platform build / wasm32-unknown-unknown / op-host-web (compile guard) (push) Failing after 1s
Rust multi-platform build / android-aarch64 (cargo check only) (push) Failing after 2s
Rust multi-platform build / android-x86_64 (cargo check only) (push) Failing after 2s
WASM bundle check (kickoff §1.2) / cargo check --target wasm32-unknown-unknown (push) Failing after 1s
WASM bundle check (kickoff §1.2) / cargo-deny --target wasm32-unknown-unknown check bans (push) Failing after 1s
This commit is contained in:
parent
db0e33fc55
commit
6c930c8eaa
1 changed files with 43 additions and 0 deletions
|
|
@ -217,6 +217,49 @@ fn apply_result_repaints_placeholder_frame_with_image_fill_and_clears_children()
|
||||||
assert_eq!(frame.children.as_deref(), Some(&[][..]));
|
assert_eq!(frame.children.as_deref(), Some(&[][..]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn poll_into_applies_finished_job_to_placeholder_frame() {
|
||||||
|
let mut state = EditorState::default();
|
||||||
|
state.active_children_mut().clear();
|
||||||
|
state.active_children_mut().push(frame_node(
|
||||||
|
"photo",
|
||||||
|
"Image",
|
||||||
|
Some("image-placeholder"),
|
||||||
|
Some(vec![solid_fill()]),
|
||||||
|
vec![text_label(
|
||||||
|
"label",
|
||||||
|
Some("image-placeholder-label"),
|
||||||
|
"pizza hero",
|
||||||
|
)],
|
||||||
|
));
|
||||||
|
|
||||||
|
let (tx, rx) = std::sync::mpsc::channel();
|
||||||
|
tx.send(Some("https://example.com/photo.jpg".to_string()))
|
||||||
|
.unwrap();
|
||||||
|
let mut session = ImageSearchSession {
|
||||||
|
in_flight: HashSet::from(["photo".to_string()]),
|
||||||
|
completed: HashSet::new(),
|
||||||
|
jobs: vec![ImageSearchJob {
|
||||||
|
node_id: NodeId::new("photo"),
|
||||||
|
rx,
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
|
||||||
|
assert!(session.poll_into(&mut state));
|
||||||
|
assert!(!session.is_pending());
|
||||||
|
assert!(session.in_flight.is_empty());
|
||||||
|
assert!(session.completed.contains("photo"));
|
||||||
|
|
||||||
|
let PenNode::Frame(frame) = &state.active_children()[0] else {
|
||||||
|
panic!("expected frame");
|
||||||
|
};
|
||||||
|
let Some([PenFill::Image(image_fill)]) = frame.container.fill.as_deref() else {
|
||||||
|
panic!("expected single image fill");
|
||||||
|
};
|
||||||
|
assert_eq!(image_fill.url, "https://example.com/photo.jpg");
|
||||||
|
assert_eq!(frame.children.as_deref(), Some(&[][..]));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn openverse_credentials_require_both_fields() {
|
fn openverse_credentials_require_both_fields() {
|
||||||
let mut state = EditorState::default();
|
let mut state = EditorState::default();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue