aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-07-22 12:35:57 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-07-22 13:12:42 +0300
commitb454fd5d9ee5b1fc9797a9ccbd8b3d0d1f49f05d (patch)
tree03fc36986fd1c63f5dcc2f1ae5239bdb0a256e25 /src
parent2a830ed498c78529a8ddfc62f3e578592b1b1e03 (diff)
downloadniri-b454fd5d9ee5b1fc9797a9ccbd8b3d0d1f49f05d.tar.gz
niri-b454fd5d9ee5b1fc9797a9ccbd8b3d0d1f49f05d.tar.bz2
niri-b454fd5d9ee5b1fc9797a9ccbd8b3d0d1f49f05d.zip
Add negative struts to tests
Diffstat (limited to 'src')
-rw-r--r--src/layout/mod.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 21e90668..97a839c1 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -4271,12 +4271,21 @@ mod tests {
prop_oneof![Just(0.), Just(4.), ((1.)..=65535.)]
}
+ fn arbitrary_spacing_neg() -> impl Strategy<Value = f64> {
+ // Give equal weight to:
+ // - 0: the element is disabled
+ // - 4: some reasonable value
+ // - -4: some reasonable negative value
+ // - random value, likely unreasonably big
+ prop_oneof![Just(0.), Just(4.), Just(-4.), ((1.)..=65535.)]
+ }
+
fn arbitrary_struts() -> impl Strategy<Value = Struts> {
(
- arbitrary_spacing(),
- arbitrary_spacing(),
- arbitrary_spacing(),
- arbitrary_spacing(),
+ arbitrary_spacing_neg(),
+ arbitrary_spacing_neg(),
+ arbitrary_spacing_neg(),
+ arbitrary_spacing_neg(),
)
.prop_map(|(left, right, top, bottom)| Struts {
left: FloatOrInt(left),