Skip to main content

rosace_theme/
radius.rs

1//! Border-radius tokens — the standard corner-rounding values.
2
3/// Named corner radii in logical pixels.
4#[derive(Debug, Clone, Copy)]
5pub struct BorderRadius {
6    /// No rounding (0 px).
7    pub none: f32,
8    /// Small rounding (4 px).
9    pub sm: f32,
10    /// Medium rounding (8 px).
11    pub md: f32,
12    /// Large rounding (12 px).
13    pub lg: f32,
14    /// Extra-large rounding (16 px).
15    pub xl: f32,
16    /// Full pill shape (9999 px).
17    pub full: f32,
18}
19
20impl Default for BorderRadius {
21    fn default() -> Self {
22        Self {
23            none: 0.0,
24            sm: 4.0,
25            md: 8.0,
26            lg: 12.0,
27            xl: 16.0,
28            full: 9999.0,
29        }
30    }
31}
32
33// ---------------------------------------------------------------------------
34// Tests
35// ---------------------------------------------------------------------------
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40
41    #[test]
42    fn border_radius_defaults_are_correct() {
43        let r = BorderRadius::default();
44        assert_eq!(r.none, 0.0);
45        assert_eq!(r.sm, 4.0);
46        assert_eq!(r.md, 8.0);
47        assert_eq!(r.lg, 12.0);
48        assert_eq!(r.xl, 16.0);
49        assert_eq!(r.full, 9999.0);
50    }
51
52    #[test]
53    fn border_radius_values_are_ascending() {
54        let r = BorderRadius::default();
55        assert!(r.none < r.sm);
56        assert!(r.sm < r.md);
57        assert!(r.md < r.lg);
58        assert!(r.lg < r.xl);
59        assert!(r.xl < r.full);
60    }
61}