S046: tests fixed
This commit is contained in:
parent
a8c38788e1
commit
8ffed89259
3 changed files with 6 additions and 4 deletions
|
|
@ -297,13 +297,14 @@ mod tests {
|
|||
let mut run = |events: Vec<Event>, focus: bool| {
|
||||
let mut got = (false, false);
|
||||
let input = RawInput { events, ..RawInput::default() };
|
||||
let _ = ctx.run_ui(input, |ui| {
|
||||
let mut out = ctx.run_ui(input, |ui| {
|
||||
let r = ui.add(TextEdit::singleline(&mut text).id(id));
|
||||
if focus {
|
||||
r.request_focus();
|
||||
}
|
||||
got = (pressed(ui, Action::Copy), pressed(ui, Action::SelectAll));
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
got
|
||||
};
|
||||
let ctrl = Modifiers::CTRL;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,8 @@ mod tests {
|
|||
#[test]
|
||||
fn raising_shows_focuses_and_asks_for_attention() {
|
||||
let ctx = Context::default();
|
||||
let out = ctx.run_ui(RawInput::default(), |ui| raise(ui.ctx()));
|
||||
let mut out = ctx.run_ui(RawInput::default(), |ui| raise(ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
let cmds = &out.viewport_output[&ViewportId::ROOT].commands;
|
||||
assert!(cmds.contains(&ViewportCommand::Visible(true)));
|
||||
assert!(cmds.contains(&ViewportCommand::Minimized(false)));
|
||||
|
|
|
|||
|
|
@ -498,13 +498,13 @@ async fn a_placeholder_name_gives_way_to_the_servers() {
|
|||
let add = |path: &str, name: &str| b.store.add_task(Task { url: b.server.url(path), name: name.into(), folder: b.folder(), ..Task::default() }).unwrap();
|
||||
let named = add("/data/4/300k/game.zip?disp=attachment", "output.bin");
|
||||
let moved = add("/redirect/1?to=/data/5/300k/other.iso", "download");
|
||||
let real = add("/data/6/300k/game2.zip?disp=attachment", "mine.bin");
|
||||
let real = add("/data/6/300k/game2.zip?disp=attachment", "mine.7z");
|
||||
for id in [named, moved, real] {
|
||||
b.run(id).await.unwrap();
|
||||
}
|
||||
let name = |id| b.store.task(id).unwrap().name;
|
||||
assert_eq!(name(named), "game.zip");
|
||||
assert_eq!(name(moved), "other.iso");
|
||||
assert_eq!(name(real), "mine.bin", "a name without a placeholder stays");
|
||||
assert_eq!(name(real), "mine.7z", "a name without a placeholder stays");
|
||||
assert!(b.folder().join("game.zip").exists() && !b.folder().join("output.bin").exists());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue