Coverage Report

Created: 2026-07-21 00:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
super-stt-cosmic-applet/src/ui/components/visualizations/centered_bars.rs
Line
Count
Source
1
// SPDX-License-Identifier: GPL-3.0-only
2
use crate::ui::components::visualizations::{
3
    BarAnchor, DrawContext, VisualizationConfig, VisualizationRenderer, render_bars,
4
};
5
use cosmic::iced::{Padding, Radius, widget::canvas::Frame};
6
7
/// Bars that are centered vertically within the drawable bounds.
8
pub struct CenteredBarsVisualization {
9
    config: VisualizationConfig,
10
}
11
12
impl Default for CenteredBarsVisualization {
13
0
    fn default() -> Self {
14
0
        Self {
15
0
            config: VisualizationConfig {
16
0
                margins: Padding {
17
0
                    top: 1.0,
18
0
                    right: 0.0,
19
0
                    bottom: 1.0,
20
0
                    left: 0.0,
21
0
                },
22
0
                corner_radius: Radius::new(24.0),
23
0
                min_element_height: 4.0,
24
0
                height_safety_margin: 0.0,
25
0
            },
26
0
        }
27
0
    }
28
}
29
30
impl VisualizationRenderer for CenteredBarsVisualization {
31
0
    fn draw(&self, frame: &mut Frame<cosmic::Renderer>, ctx: &DrawContext) {
32
0
        render_bars(&self.config, BarAnchor::Center, frame, ctx);
33
0
    }
34
}