mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Fix StackView tests
This commit is contained in:
parent
927afafe88
commit
88fb6e7c54
@ -45,7 +45,11 @@ fn make_percentage(value: usize, (min, max): (usize, usize)) -> String {
|
||||
}
|
||||
|
||||
let (percentage, extra) = ratio(value - min, max - min, 100);
|
||||
let percentage = if extra > 4 { percentage + 1 } else { percentage };
|
||||
let percentage = if extra > 4 {
|
||||
percentage + 1
|
||||
} else {
|
||||
percentage
|
||||
};
|
||||
format!("{} %", percentage)
|
||||
}
|
||||
|
||||
|
@ -677,40 +677,28 @@ mod tests {
|
||||
.get(LayerPosition::FromFront(0))
|
||||
.unwrap()
|
||||
.as_any()
|
||||
.downcast_ref::<ViewBox>()
|
||||
.unwrap()
|
||||
.with_view(|v| v.as_any().is::<TextView>())
|
||||
.unwrap()
|
||||
.is::<TextView>()
|
||||
);
|
||||
assert!(
|
||||
stack
|
||||
.get(LayerPosition::FromBack(0))
|
||||
.unwrap()
|
||||
.as_any()
|
||||
.downcast_ref::<ViewBox>()
|
||||
.unwrap()
|
||||
.with_view(|v| v.as_any().is::<TextView>())
|
||||
.unwrap()
|
||||
.is::<TextView>()
|
||||
);
|
||||
assert!(
|
||||
stack
|
||||
.get_mut(LayerPosition::FromFront(0))
|
||||
.unwrap()
|
||||
.as_any_mut()
|
||||
.downcast_mut::<ViewBox>()
|
||||
.unwrap()
|
||||
.with_view_mut(|v| v.as_any_mut().is::<TextView>())
|
||||
.unwrap()
|
||||
.is::<TextView>()
|
||||
);
|
||||
assert!(
|
||||
stack
|
||||
.get_mut(LayerPosition::FromBack(0))
|
||||
.unwrap()
|
||||
.as_any_mut()
|
||||
.downcast_mut::<ViewBox>()
|
||||
.unwrap()
|
||||
.with_view_mut(|v| v.as_any_mut().is::<TextView>())
|
||||
.unwrap()
|
||||
.is::<TextView>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user