Panics · P12 Data Display: featured columns, gauges, usage bars and stars meet readings past their scale
This commit is contained in:
1 parent
c9f492d0b4
commit
4a05c12889
5 files changed
+61
-33
No files matched your search
@@ -9,7 +9,10 @@ use gpui::{
|
||||
TestAppContext, VisualTestContext, Window, div, point, px,
|
||||
};
|
||||
|
||||
use super::{Badge, Carousel, DescriptionList, PropertyGrid, PropertyGroup, Statistic, Tone};
|
||||
use super::{
|
||||
Badge, Carousel, DescriptionList, Gauge, PropertyGrid, PropertyGroup, Stars, Statistic, Tone,
|
||||
UsageBar,
|
||||
};
|
||||
use crate::{
|
||||
primitives::Measure,
|
||||
theme::{TextSize, Theme},
|
||||
@@ -283,3 +286,25 @@ fn left_from_the_first_slide_wraps_to_the_last(cx: &mut TestAppContext) {
|
||||
settle(cx);
|
||||
assert_eq!(front(&places), Some(0));
|
||||
}
|
||||
|
||||
/// Readings past their scale: a gauge over its max, stars over theirs, more parts than hues.
|
||||
struct Over;
|
||||
|
||||
impl Render for Over {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
let parts = (0..10).fold(UsageBar::new(100.0), |bar, ix| {
|
||||
bar.part(format!("p{ix}"), 12.0)
|
||||
});
|
||||
div()
|
||||
.child(Gauge::new("cpu", "CPU", 140.0, 0.0, 100.0))
|
||||
.child(Stars::new(6.5))
|
||||
.child(parts)
|
||||
}
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn readings_past_their_scale_draw(cx: &mut TestAppContext) {
|
||||
cx.update(Theme::init);
|
||||
let (_, cx) = cx.add_window_view(|_, _| Over);
|
||||
cx.run_until_parked();
|
||||
}
|
||||
Reference in new issue
Block a user