oxidize-pdf 2.4.2

A pure Rust PDF generation and manipulation library with zero external dependencies
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
//! Dashboard Theming System
//!
//! This module provides a comprehensive theming system for dashboards, including
//! color palettes, typography, spacing, and pre-defined themes for different
//! use cases (corporate, minimal, dark, colorful, etc.).

use crate::graphics::Color;

/// Font weight enumeration
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FontWeight {
    Normal,
    Bold,
}

/// Main theme configuration for dashboards
#[derive(Debug, Clone)]
pub struct DashboardTheme {
    /// Color palette for the theme
    pub colors: ThemeColors,
    /// Typography settings
    pub typography: Typography,
    /// Spacing and layout settings
    pub spacing: ThemeSpacing,
    /// Border and shadow settings
    pub borders: ThemeBorders,
    /// Background settings
    pub backgrounds: ThemeBackgrounds,
}

impl DashboardTheme {
    /// Create a new custom theme
    pub fn new(colors: ThemeColors, typography: Typography) -> Self {
        Self {
            colors,
            typography,
            spacing: ThemeSpacing::default(),
            borders: ThemeBorders::default(),
            backgrounds: ThemeBackgrounds::default(),
        }
    }

    /// Corporate theme - professional, blue-based palette
    pub fn corporate() -> Self {
        let colors = ThemeColors {
            primary: Color::hex("#1f4788"),
            secondary: Color::hex("#4a90a4"),
            accent: Color::hex("#87ceeb"),
            success: Color::hex("#28a745"),
            warning: Color::hex("#ffc107"),
            danger: Color::hex("#dc3545"),
            info: Color::hex("#17a2b8"),
            light: Color::hex("#f8f9fa"),
            dark: Color::hex("#343a40"),
            muted: Color::hex("#6c757d"),
            background: Color::white(),
            surface: Color::hex("#f0f4f8"), // Light blue-gray instead of white
            text_primary: Color::hex("#212529"),
            text_secondary: Color::hex("#6c757d"),
            text_muted: Color::hex("#adb5bd"),
            border: Color::hex("#dee2e6"),
        };

        let typography = Typography {
            title_font: "Helvetica-Bold".to_string(),
            title_size: 24.0,
            title_color: colors.text_primary,
            heading_font: "Helvetica-Bold".to_string(),
            heading_size: 18.0,
            heading_color: colors.text_primary,
            body_font: "Helvetica".to_string(),
            body_size: 12.0,
            body_color: colors.text_primary,
            caption_font: "Helvetica".to_string(),
            caption_size: 10.0,
            caption_color: colors.text_secondary,
            line_height: 1.4,
        };

        Self {
            colors,
            typography,
            spacing: ThemeSpacing::corporate(),
            borders: ThemeBorders::corporate(),
            backgrounds: ThemeBackgrounds::corporate(),
        }
    }

    /// Minimal theme - clean, grayscale palette
    pub fn minimal() -> Self {
        let colors = ThemeColors {
            primary: Color::hex("#000000"),
            secondary: Color::hex("#666666"),
            accent: Color::hex("#999999"),
            success: Color::hex("#4caf50"),
            warning: Color::hex("#ff9800"),
            danger: Color::hex("#f44336"),
            info: Color::hex("#2196f3"),
            light: Color::hex("#fafafa"),
            dark: Color::hex("#212121"),
            muted: Color::hex("#757575"),
            background: Color::white(),
            surface: Color::hex("#ffffff"),
            text_primary: Color::hex("#212121"),
            text_secondary: Color::hex("#757575"),
            text_muted: Color::hex("#bdbdbd"),
            border: Color::hex("#e0e0e0"),
        };

        let typography = Typography::minimal();

        Self {
            colors,
            typography,
            spacing: ThemeSpacing::minimal(),
            borders: ThemeBorders::minimal(),
            backgrounds: ThemeBackgrounds::minimal(),
        }
    }

    /// Dark theme - dark background with light text
    pub fn dark() -> Self {
        let colors = ThemeColors {
            primary: Color::hex("#bb86fc"),
            secondary: Color::hex("#03dac6"),
            accent: Color::hex("#cf6679"),
            success: Color::hex("#4caf50"),
            warning: Color::hex("#ff9800"),
            danger: Color::hex("#f44336"),
            info: Color::hex("#2196f3"),
            light: Color::hex("#424242"),
            dark: Color::hex("#121212"),
            muted: Color::hex("#757575"),
            background: Color::hex("#121212"),
            surface: Color::hex("#1e1e1e"),
            text_primary: Color::hex("#ffffff"),
            text_secondary: Color::hex("#b3b3b3"),
            text_muted: Color::hex("#666666"),
            border: Color::hex("#333333"),
        };

        let typography = Typography::dark();

        Self {
            colors,
            typography,
            spacing: ThemeSpacing::default(),
            borders: ThemeBorders::dark(),
            backgrounds: ThemeBackgrounds::dark(),
        }
    }

    /// Colorful theme - vibrant, multi-color palette
    pub fn colorful() -> Self {
        let colors = ThemeColors {
            primary: Color::hex("#e91e63"),
            secondary: Color::hex("#9c27b0"),
            accent: Color::hex("#ff5722"),
            success: Color::hex("#4caf50"),
            warning: Color::hex("#ff9800"),
            danger: Color::hex("#f44336"),
            info: Color::hex("#2196f3"),
            light: Color::hex("#fce4ec"),
            dark: Color::hex("#880e4f"),
            muted: Color::hex("#ad1457"),
            background: Color::hex("#fafafa"),
            surface: Color::white(),
            text_primary: Color::hex("#212121"),
            text_secondary: Color::hex("#757575"),
            text_muted: Color::hex("#bdbdbd"),
            border: Color::hex("#e1bee7"),
        };

        let typography = Typography::colorful();

        Self {
            colors,
            typography,
            spacing: ThemeSpacing::colorful(),
            borders: ThemeBorders::colorful(),
            backgrounds: ThemeBackgrounds::colorful(),
        }
    }

    /// Set custom color palette
    pub fn set_color_palette(&mut self, colors: Vec<Color>) {
        if !colors.is_empty() {
            self.colors.primary = colors[0];
            if colors.len() > 1 {
                self.colors.secondary = colors[1];
            }
            if colors.len() > 2 {
                self.colors.accent = colors[2];
            }
        }
    }

    /// Set typography configuration
    pub fn set_typography(&mut self, typography: Typography) {
        self.typography = typography;
    }

    /// Get title text style
    pub fn title_style(&self) -> TextStyle {
        TextStyle {
            font_name: self.typography.title_font.clone(),
            font_size: self.typography.title_size,
            color: self.typography.title_color,
            weight: FontWeight::Bold,
            alignment: TextAlignment::Center,
        }
    }

    /// Get subtitle text style
    pub fn subtitle_style(&self) -> TextStyle {
        TextStyle {
            font_name: self.typography.heading_font.clone(),
            font_size: self.typography.heading_size,
            color: self.typography.heading_color,
            weight: FontWeight::Normal,
            alignment: TextAlignment::Center,
        }
    }

    /// Get footer text style
    pub fn footer_style(&self) -> TextStyle {
        TextStyle {
            font_name: self.typography.caption_font.clone(),
            font_size: self.typography.caption_size,
            color: self.typography.caption_color,
            weight: FontWeight::Normal,
            alignment: TextAlignment::Left,
        }
    }

    /// Get title height in points
    pub fn title_height(&self) -> f64 {
        self.typography.title_size * self.typography.line_height
    }

    /// Get footer height in points
    pub fn footer_height(&self) -> f64 {
        self.typography.caption_size * self.typography.line_height
    }
}

impl Default for DashboardTheme {
    fn default() -> Self {
        Self::corporate()
    }
}

/// Color palette for dashboard themes
#[derive(Debug, Clone)]
pub struct ThemeColors {
    /// Primary brand color
    pub primary: Color,
    /// Secondary brand color
    pub secondary: Color,
    /// Accent color for highlights
    pub accent: Color,
    /// Success state color (green)
    pub success: Color,
    /// Warning state color (orange)
    pub warning: Color,
    /// Danger/error state color (red)
    pub danger: Color,
    /// Information state color (blue)
    pub info: Color,
    /// Light neutral color
    pub light: Color,
    /// Dark neutral color
    pub dark: Color,
    /// Muted color for less important elements
    pub muted: Color,
    /// Main background color
    pub background: Color,
    /// Surface color (cards, panels)
    pub surface: Color,
    /// Primary text color
    pub text_primary: Color,
    /// Secondary text color
    pub text_secondary: Color,
    /// Muted text color
    pub text_muted: Color,
    /// Border color
    pub border: Color,
}

/// Typography configuration for dashboard themes
#[derive(Debug, Clone)]
pub struct Typography {
    /// Font for titles
    pub title_font: String,
    /// Title font size
    pub title_size: f64,
    /// Title text color
    pub title_color: Color,
    /// Font for headings
    pub heading_font: String,
    /// Heading font size
    pub heading_size: f64,
    /// Heading text color
    pub heading_color: Color,
    /// Font for body text
    pub body_font: String,
    /// Body font size
    pub body_size: f64,
    /// Body text color
    pub body_color: Color,
    /// Font for captions
    pub caption_font: String,
    /// Caption font size
    pub caption_size: f64,
    /// Caption text color
    pub caption_color: Color,
    /// Line height multiplier
    pub line_height: f64,
}

impl Typography {
    /// Professional typography setup
    pub fn professional() -> Self {
        Self {
            title_font: "Helvetica-Bold".to_string(),
            title_size: 24.0,
            title_color: Color::hex("#212529"),
            heading_font: "Helvetica-Bold".to_string(),
            heading_size: 18.0,
            heading_color: Color::hex("#212529"),
            body_font: "Helvetica".to_string(),
            body_size: 12.0,
            body_color: Color::hex("#212529"),
            caption_font: "Helvetica".to_string(),
            caption_size: 10.0,
            caption_color: Color::hex("#6c757d"),
            line_height: 1.4,
        }
    }

    /// Minimal typography setup
    pub fn minimal() -> Self {
        Self {
            title_font: "Helvetica-Light".to_string(),
            title_size: 28.0,
            title_color: Color::hex("#212121"),
            heading_font: "Helvetica".to_string(),
            heading_size: 16.0,
            heading_color: Color::hex("#212121"),
            body_font: "Helvetica".to_string(),
            body_size: 11.0,
            body_color: Color::hex("#212121"),
            caption_font: "Helvetica".to_string(),
            caption_size: 9.0,
            caption_color: Color::hex("#757575"),
            line_height: 1.5,
        }
    }

    /// Dark theme typography
    pub fn dark() -> Self {
        Self {
            title_font: "Helvetica-Bold".to_string(),
            title_size: 24.0,
            title_color: Color::white(),
            heading_font: "Helvetica-Bold".to_string(),
            heading_size: 18.0,
            heading_color: Color::white(),
            body_font: "Helvetica".to_string(),
            body_size: 12.0,
            body_color: Color::white(),
            caption_font: "Helvetica".to_string(),
            caption_size: 10.0,
            caption_color: Color::hex("#b3b3b3"),
            line_height: 1.4,
        }
    }

    /// Colorful theme typography
    pub fn colorful() -> Self {
        Self {
            title_font: "Helvetica-Bold".to_string(),
            title_size: 26.0,
            title_color: Color::hex("#880e4f"),
            heading_font: "Helvetica-Bold".to_string(),
            heading_size: 18.0,
            heading_color: Color::hex("#ad1457"),
            body_font: "Helvetica".to_string(),
            body_size: 12.0,
            body_color: Color::hex("#212121"),
            caption_font: "Helvetica".to_string(),
            caption_size: 10.0,
            caption_color: Color::hex("#757575"),
            line_height: 1.4,
        }
    }
}

impl Default for Typography {
    fn default() -> Self {
        Self::professional()
    }
}

/// Text style for rendering
#[derive(Debug, Clone)]
pub struct TextStyle {
    /// Font name
    pub font_name: String,
    /// Font size in points
    pub font_size: f64,
    /// Text color
    pub color: Color,
    /// Font weight
    pub weight: FontWeight,
    /// Text alignment
    pub alignment: TextAlignment,
}

/// Text alignment options
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TextAlignment {
    Left,
    Center,
    Right,
}

/// Spacing configuration for themes
#[derive(Debug, Clone)]
pub struct ThemeSpacing {
    /// Extra small spacing (4pt)
    pub xs: f64,
    /// Small spacing (8pt)
    pub sm: f64,
    /// Medium spacing (16pt)
    pub md: f64,
    /// Large spacing (24pt)
    pub lg: f64,
    /// Extra large spacing (32pt)
    pub xl: f64,
}

impl ThemeSpacing {
    pub fn corporate() -> Self {
        Self {
            xs: 4.0,
            sm: 8.0,
            md: 16.0,
            lg: 24.0,
            xl: 32.0,
        }
    }

    pub fn minimal() -> Self {
        Self {
            xs: 2.0,
            sm: 6.0,
            md: 12.0,
            lg: 20.0,
            xl: 28.0,
        }
    }

    pub fn colorful() -> Self {
        Self {
            xs: 6.0,
            sm: 10.0,
            md: 18.0,
            lg: 28.0,
            xl: 36.0,
        }
    }
}

impl Default for ThemeSpacing {
    fn default() -> Self {
        Self::corporate()
    }
}

/// Border configuration for themes
#[derive(Debug, Clone)]
pub struct ThemeBorders {
    /// Thin border width
    pub thin: f64,
    /// Medium border width
    pub medium: f64,
    /// Thick border width
    pub thick: f64,
    /// Border radius for rounded corners
    pub radius: f64,
}

impl ThemeBorders {
    pub fn corporate() -> Self {
        Self {
            thin: 0.5,
            medium: 1.0,
            thick: 2.0,
            radius: 4.0,
        }
    }

    pub fn minimal() -> Self {
        Self {
            thin: 0.25,
            medium: 0.5,
            thick: 1.0,
            radius: 2.0,
        }
    }

    pub fn dark() -> Self {
        Self {
            thin: 0.5,
            medium: 1.0,
            thick: 2.0,
            radius: 6.0,
        }
    }

    pub fn colorful() -> Self {
        Self {
            thin: 1.0,
            medium: 2.0,
            thick: 3.0,
            radius: 8.0,
        }
    }
}

impl Default for ThemeBorders {
    fn default() -> Self {
        Self::corporate()
    }
}

/// Background configuration for themes
#[derive(Debug, Clone)]
pub struct ThemeBackgrounds {
    /// Primary background color
    pub primary: Color,
    /// Secondary background color
    pub secondary: Color,
    /// Card/panel background color
    pub surface: Color,
    /// Hover state background
    pub hover: Color,
}

impl ThemeBackgrounds {
    pub fn corporate() -> Self {
        Self {
            primary: Color::white(),
            secondary: Color::hex("#f8f9fa"),
            surface: Color::white(),
            hover: Color::hex("#f5f5f5"),
        }
    }

    pub fn minimal() -> Self {
        Self {
            primary: Color::white(),
            secondary: Color::hex("#fafafa"),
            surface: Color::white(),
            hover: Color::hex("#f0f0f0"),
        }
    }

    pub fn dark() -> Self {
        Self {
            primary: Color::hex("#121212"),
            secondary: Color::hex("#1e1e1e"),
            surface: Color::hex("#2d2d2d"),
            hover: Color::hex("#3d3d3d"),
        }
    }

    pub fn colorful() -> Self {
        Self {
            primary: Color::hex("#fafafa"),
            secondary: Color::hex("#fce4ec"),
            surface: Color::white(),
            hover: Color::hex("#f8bbd9"),
        }
    }
}

impl Default for ThemeBackgrounds {
    fn default() -> Self {
        Self::corporate()
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_theme_creation() {
        let theme = DashboardTheme::corporate();
        assert_eq!(theme.typography.title_size, 24.0);
        assert_eq!(theme.colors.primary, Color::hex("#1f4788"));
    }

    #[test]
    fn test_theme_variants() {
        let corporate = DashboardTheme::corporate();
        let minimal = DashboardTheme::minimal();
        let dark = DashboardTheme::dark();
        let colorful = DashboardTheme::colorful();

        // Themes should have different color schemes
        assert_ne!(corporate.colors.primary, minimal.colors.primary);
        assert_ne!(minimal.colors.background, dark.colors.background);
        assert_ne!(dark.colors.accent, colorful.colors.accent);
    }

    #[test]
    fn test_typography_variants() {
        let professional = Typography::professional();
        let minimal = Typography::minimal();

        assert_eq!(professional.title_font, "Helvetica-Bold");
        assert_eq!(minimal.title_font, "Helvetica-Light");
        assert_ne!(professional.title_size, minimal.title_size);
    }

    #[test]
    fn test_theme_spacing() {
        let spacing = ThemeSpacing::corporate();
        assert_eq!(spacing.xs, 4.0);
        assert_eq!(spacing.sm, 8.0);
        assert_eq!(spacing.md, 16.0);
        assert_eq!(spacing.lg, 24.0);
        assert_eq!(spacing.xl, 32.0);
    }

    #[test]
    fn test_text_style_creation() {
        let theme = DashboardTheme::default();
        let title_style = theme.title_style();

        assert_eq!(title_style.alignment, TextAlignment::Center);
        assert_eq!(title_style.weight, FontWeight::Bold);
    }

    #[test]
    fn test_theme_backgrounds_corporate() {
        let bg = ThemeBackgrounds::corporate();
        assert_eq!(bg.primary, Color::white());
        assert_eq!(bg.secondary, Color::hex("#f8f9fa"));
        assert_eq!(bg.surface, Color::white());
        assert_eq!(bg.hover, Color::hex("#f5f5f5"));
    }

    #[test]
    fn test_theme_backgrounds_minimal() {
        let bg = ThemeBackgrounds::minimal();
        assert_eq!(bg.primary, Color::white());
        assert_eq!(bg.secondary, Color::hex("#fafafa"));
        assert_eq!(bg.surface, Color::white());
        assert_eq!(bg.hover, Color::hex("#f0f0f0"));
    }

    #[test]
    fn test_theme_backgrounds_dark() {
        let bg = ThemeBackgrounds::dark();
        assert_eq!(bg.primary, Color::hex("#121212"));
        assert_eq!(bg.secondary, Color::hex("#1e1e1e"));
        assert_eq!(bg.surface, Color::hex("#2d2d2d"));
        assert_eq!(bg.hover, Color::hex("#3d3d3d"));
    }

    #[test]
    fn test_theme_backgrounds_colorful() {
        let bg = ThemeBackgrounds::colorful();
        assert_eq!(bg.primary, Color::hex("#fafafa"));
        assert_eq!(bg.secondary, Color::hex("#fce4ec"));
        assert_eq!(bg.surface, Color::white());
        assert_eq!(bg.hover, Color::hex("#f8bbd9"));
    }

    #[test]
    fn test_theme_backgrounds_default() {
        let bg = ThemeBackgrounds::default();
        let corporate = ThemeBackgrounds::corporate();
        assert_eq!(bg.primary, corporate.primary);
        assert_eq!(bg.secondary, corporate.secondary);
    }

    #[test]
    fn test_typography_default() {
        let typography = Typography::default();
        let professional = Typography::professional();
        assert_eq!(typography.title_font, professional.title_font);
    }

    #[test]
    fn test_typography_dark() {
        let typography = Typography::dark();
        assert_eq!(typography.title_color, Color::white());
        assert_eq!(typography.heading_color, Color::white());
        assert_eq!(typography.body_color, Color::white());
        assert_eq!(typography.caption_color, Color::hex("#b3b3b3"));
    }

    #[test]
    fn test_typography_colorful() {
        let typography = Typography::colorful();
        assert_eq!(typography.title_color, Color::hex("#880e4f"));
        assert_eq!(typography.heading_color, Color::hex("#ad1457"));
        assert_eq!(typography.title_size, 26.0);
    }

    #[test]
    fn test_theme_spacing_minimal() {
        let spacing = ThemeSpacing::minimal();
        assert_eq!(spacing.xs, 2.0);
        assert_eq!(spacing.sm, 6.0);
        assert_eq!(spacing.md, 12.0);
        assert_eq!(spacing.lg, 20.0);
        assert_eq!(spacing.xl, 28.0);
    }

    #[test]
    fn test_theme_spacing_corporate() {
        let spacing = ThemeSpacing::corporate();
        assert_eq!(spacing.xs, 4.0);
        assert_eq!(spacing.sm, 8.0);
        assert_eq!(spacing.md, 16.0);
        assert_eq!(spacing.lg, 24.0);
        assert_eq!(spacing.xl, 32.0);
    }

    #[test]
    fn test_theme_spacing_colorful() {
        let spacing = ThemeSpacing::colorful();
        assert_eq!(spacing.xs, 6.0);
        assert_eq!(spacing.sm, 10.0);
        assert_eq!(spacing.md, 18.0);
        assert_eq!(spacing.lg, 28.0);
        assert_eq!(spacing.xl, 36.0);
    }

    #[test]
    fn test_theme_spacing_default() {
        let spacing = ThemeSpacing::default();
        let corporate = ThemeSpacing::corporate();
        assert_eq!(spacing.xs, corporate.xs);
    }

    #[test]
    fn test_theme_clone() {
        let theme = DashboardTheme::corporate();
        let cloned = theme.clone();
        assert_eq!(theme.colors.primary, cloned.colors.primary);
        assert_eq!(theme.typography.title_size, cloned.typography.title_size);
    }

    #[test]
    fn test_dashboard_theme_default() {
        let theme = DashboardTheme::default();
        let corporate = DashboardTheme::corporate();
        assert_eq!(theme.colors.primary, corporate.colors.primary);
    }

    #[test]
    fn test_typography_minimal() {
        let typography = Typography::minimal();
        assert_eq!(typography.title_font, "Helvetica-Light".to_string());
        assert_eq!(typography.title_size, 28.0);
        assert_eq!(typography.body_size, 11.0);
        assert_eq!(typography.line_height, 1.5);
    }

    #[test]
    fn test_typography_professional() {
        let typography = Typography::professional();
        assert_eq!(typography.title_font, "Helvetica-Bold".to_string());
        assert_eq!(typography.title_size, 24.0);
        assert_eq!(typography.line_height, 1.4);
    }
}