gtk_test/lib.rs
1#![warn(missing_docs)]
2
3//! Crate to test UI interactions with [gtk-rs] crates.
4//!
5//! [gtk-rs]: https://gtk-rs.org
6//!
7//! Small example:
8//!
9//! ```
10//! extern crate gtk;
11//! #[macro_use]
12//! extern crate gtk_test;
13//!
14//! use gtk::{prelude::ButtonExt, prelude::ContainerExt, prelude::GtkWindowExt, prelude::LabelExt, prelude::WidgetExt};
15//!
16//! # fn main() {
17//! gtk::init().expect("GTK init failed");
18//!
19//! let win = gtk::Window::new(gtk::WindowType::Toplevel);
20//! let but = gtk::Button::new();
21//!
22//! but.set_label(""); // Otherwise, assert_label! call will fail.
23//! but.connect_clicked(|b| {
24//! b.set_label("clicked!");
25//! });
26//!
27//! win.add(&but);
28//! win.show_all();
29//! win.activate_focus(); // Very important, otherwise tests will fail on OSX!
30//!
31//! assert_label!(but, "");
32//! gtk_test::click(&but);
33//! gtk_test::wait(1000); // To be sure that GTK has updated the label's text.
34//! assert_label!(but, "clicked!");
35//! # }
36//! ```
37
38mod macros;
39
40mod functions;
41mod observer;
42
43pub use functions::*;
44pub use gtk;
45pub use gtk::gdk;
46pub use observer::Observer;