gui_smoke/gui_smoke.rs
1//! A GUI-subsystem smoke test, for Windows: build it with
2//! `cargo build --example gui_smoke`, then double-click
3//! `target/debug/examples/gui_smoke.exe` in Explorer. Three
4//! dialogs appear in sequence. Because the exe has no console
5//! of its own, it exercises the case a console test cannot
6//! see: whether spawning the (console) powershell.exe helper
7//! pops up a console window next to the dialogs. It should
8//! not; the crate spawns its helpers with CREATE_NO_WINDOW.
9//!
10//! On other platforms this builds as an ordinary example and
11//! simply shows the same three dialogs from a terminal.
12#![cfg_attr(windows, windows_subsystem = "windows")]
13
14use any_dialog::Dialogs;
15
16fn main() {
17 let dialogs = Dialogs::new();
18 if !dialogs.available() {
19 return;
20 }
21 let _ = dialogs.show_info(
22 "any-dialog GUI smoke test",
23 "Watch for a black console window while these dialogs are up: there should be none.",
24 );
25 let _ = dialogs.prompt_text("any-dialog GUI smoke test", "Type anything:", None);
26 let _ = dialogs.confirm(
27 "any-dialog GUI smoke test",
28 "Did every dialog appear without a console window?",
29 );
30}