thoth_cli/
title_popup.rs

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
pub struct TitlePopup {
    pub title: String,
    pub visible: bool,
}

impl TitlePopup {
    pub fn new() -> Self {
        TitlePopup {
            title: String::new(),
            visible: false,
        }
    }
}

impl Default for TitlePopup {
    fn default() -> Self {
        Self::new()
    }
}

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

    #[test]
    fn test_new_title_popup() {
        let popup = TitlePopup::new();
        assert_eq!(popup.title, "");
        assert!(!popup.visible);
    }

    #[test]
    fn test_title_popup_visibility() {
        let mut popup = TitlePopup::new();
        popup.visible = true;
        assert!(popup.visible);
    }

    #[test]
    fn test_title_popup_set_title() {
        let mut popup = TitlePopup::new();
        popup.title = "New Title".to_string();
        assert_eq!(popup.title, "New Title");
    }
}