pub struct Case { /* private fields */ }Expand description
One test: what it proves, what it needs, the page it shows and the body that drives it.
Built by a #[day::test] function each time the test runs, so the signals a page and its
drive share are fresh per run; the registry names it after that function.
Implementations§
Source§impl Case
impl Case
Sourcepub fn new() -> Self
pub fn new() -> Self
A GUI case: a page the app’s test host shows while the case runs, and a drive against it.
Sourcepub fn timeout(self, secs: f64) -> Self
pub fn timeout(self, secs: f64) -> Self
How long the case may take, page and drive together, before it fails as timed out.
Unset, the run’s default applies (30 s, or what day test --case-timeout says).
Sourcepub fn proves(self, kind: &str) -> Self
pub fn proves(self, kind: &str) -> Self
The piece kind this case is the proof of (kinds::BUTTON); a pass marks the kind
on this toolkit in the coverage tables.
Sourcepub fn proves_cap(self, cap: Cap) -> Self
pub fn proves_cap(self, cap: Cap) -> Self
The capability this case proves.
Sourcepub fn proves_modifier(self, modifier: &str) -> Self
pub fn proves_modifier(self, modifier: &str) -> Self
The Decorate modifier this case proves ("padding").
Sourcepub fn proves_duty(self, duty: &str) -> Self
pub fn proves_duty(self, duty: &str) -> Self
The toolkit duty this case proves ("set_input_traits").
Sourcepub fn requires(self, cap: Cap) -> Self
pub fn requires(self, cap: Cap) -> Self
A capability the case needs; where the toolkit answers Unsupported the case is
skipped with that reason rather than failed. The one way a case adapts to a toolkit.
Sourcepub fn requires_support(self, what: &str, support: fn() -> Support) -> Self
pub fn requires_support(self, what: &str, support: fn() -> Support) -> Self
A piece’s own support the case needs (day_piece_map::support), named for the skip
reason: where it answers Unsupported the case is skipped, as for Case::requires.
For a piece realized only where its platform ships the widget.
Sourcepub fn missing_support(&self) -> Option<String>
pub fn missing_support(&self) -> Option<String>
The first support this case needs that the running toolkit lacks, named.
Sourcepub fn page<P: Piece>(self, page: impl Fn() -> P + 'static) -> Self
pub fn page<P: Piece>(self, page: impl Fn() -> P + 'static) -> Self
The page the app shows for this case; any piece.
Sourcepub fn shot(self, name: &str) -> Self
pub fn shot(self, name: &str) -> Self
A capture taken before the drive runs, once the page is shown.
Sourcepub fn drive<F>(self, body: impl Fn(Drive) -> F + 'static) -> Selfwhere
F: Future<Output = TestResult> + 'static,
pub fn drive<F>(self, body: impl Fn(Drive) -> F + 'static) -> Selfwhere
F: Future<Output = TestResult> + 'static,
The drive: an async body over a Drive, awaiting each step so the app’s main loop
runs between them (a transition settles, a capture paints) as it does between a
script’s steps.
Sourcepub fn run<F>(self, body: impl Fn(Drive) -> F + 'static) -> Selfwhere
F: Future<Output = TestResult> + 'static,
pub fn run<F>(self, body: impl Fn(Drive) -> F + 'static) -> Selfwhere
F: Future<Output = TestResult> + 'static,
Case::drive under the name a headless test reads better with.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name the registry gave the case: its function’s, hyphenated. Empty for a case built outside the registry.
Sourcepub fn timeout_secs(&self) -> Option<f64>
pub fn timeout_secs(&self) -> Option<f64>
The case’s own time limit, if it set one.
pub fn kind(&self) -> TestKind
Sourcepub fn proves_keys(&self) -> &[String]
pub fn proves_keys(&self) -> &[String]
The kind:, cap: and duty: keys this case proves, in the matrices’ own spelling.
pub fn requirements(&self) -> &[Cap]
Sourcepub fn build_page(&self) -> Option<AnyPiece>
pub fn build_page(&self) -> Option<AnyPiece>
Build the case’s page, if it has one.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Case
impl !Send for Case
impl !Sync for Case
impl !UnwindSafe for Case
impl Freeze for Case
impl Unpin for Case
impl UnsafeUnpin for Case
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more