waft_test/lib.rs
1//! Test scaffolding: a [`TestPlatform`] to run an `App` on, a [`TestView`] for it to draw
2//! into, whose [`TestViewHost`] records what it asks of the system, a [`MockClipboard`] for it to copy to and paste from, the system's menus
3//! ([`MockMenuBar`], [`MockPopupMenus`], [`MockDockMenu`], [`MockTrayIcons`]) for it to set and
4//! choose in, file dialogs ([`MockFileDialogs`], with [`MemoryFile`] and [`MemoryFolder`])
5//! for it to open and save through, a hardware buffer allocator ([`MockHardwareBufferAllocator`]) for it to allocate buffers with,
6//! and a compositor, frame readers, players, media assets and
7//! cameras ([`MockCompositor`], [`MockVideoFrameReaders`], [`MockPlayers`], [`MockMediaAssets`],
8//! [`MockCameras`]) for it to show and read media through, image codecs ([`MockImageCodecs`])
9//! for it to decode and encode images with, with the user's caption settings ([`MockCaptionSettings`]) to draw subtitles
10//! in, so a test supplies only the piece it is about. The shape of `flutter_test`'s `TestPlatformDispatcher` and
11//! `TestFlutterView`: real implementations of the host traits that answer what a test
12//! configures and record what the framework asks of them. Its fonts are flutter_test's: every
13//! family is FlutterTest ([`TestFontSource`]) unless the test gives the platform other fonts.
14//! A test that looks at what the app paints gives the platform the system's fonts and a GPU
15//! with no window ([`TestPlatform::with_system_fonts`], [`TestPlatform::with_gpu`]), reads
16//! a widget's image back through it, and can encode the pixels as a PNG ([`encode_png`]).
17//! In a debug build, [`object_snapshot`] and [`assert_no_new_objects`] check that a piece of a
18//! test leaves no object behind in the `App`'s arena.
19//!
20//! A dev-dependency of a crate with tests:
21//!
22//! ```toml
23//! [dev-dependencies]
24//! waft-test = "0.1"
25//! ```
26
27mod caption_style;
28mod clipboard;
29mod file_dialogs;
30mod files;
31mod hardware_buffers;
32mod http;
33mod image_codecs;
34mod media;
35mod menus;
36mod notifications;
37#[cfg(debug_assertions)]
38mod objects;
39mod opener;
40mod platform;
41mod png_bytes;
42mod time_zone;
43mod view;
44mod view_host;
45mod windows;
46
47pub use caption_style::MockCaptionSettings;
48pub use clipboard::MockClipboard;
49pub use file_dialogs::{AskedDialog, MemoryFile, MemoryFolder, MockFileDialogs};
50pub use files::MemoryFiles;
51pub use hardware_buffers::{AskedAllocation, MockHardwareBuffer, MockHardwareBufferAllocator};
52pub use http::{MockHttpClient, MockResponse, SentRequest};
53pub use image_codecs::{CodecCall, ImageAnswers, ImageFacts, MockImageCodecs};
54pub use media::{
55 AssetAnswers, FrameAsked, MockCameras, MockCaptureSession, MockCompositor, MockLayer,
56 MockMediaAsset, MockMediaAssets, MockPlayer, MockPlayers, MockVideoFrame,
57 MockVideoFrameReaders, PlayerCall, VideoOutputKind,
58};
59pub use menus::{
60 MockDockMenu, MockMenuBar, MockPopupMenus, MockTrayIcons, ShownMenu, ShownTrayIcon,
61};
62pub use notifications::MockNotifications;
63#[cfg(debug_assertions)]
64pub use objects::{ObjectSnapshot, assert_no_new_objects, object_snapshot};
65pub use opener::{MockOpener, Opened};
66pub use platform::{TestDispatcher, TestPlatform};
67pub use png_bytes::encode_png;
68pub use time_zone::TestTimeZone;
69pub use view::{IMPLICIT_VIEW_ID, MetricsListener, TestView};
70pub use view_host::{BarsShown, TestViewHost, TextInputCall};
71pub use waft_embedder::TestFontSource;
72pub use windows::{TestWindow, TestWindows};