1pub struct TitlePopup {
2 pub title: String,
3 pub visible: bool,
4}
5
6impl TitlePopup {
7 pub fn new() -> Self {
8 TitlePopup {
9 title: String::new(),
10 visible: false,
11 }
12 }
13}
14
15impl Default for TitlePopup {
16 fn default() -> Self {
17 Self::new()
18 }
19}
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24
25 #[test]
26 fn test_new_title_popup() {
27 let popup = TitlePopup::new();
28 assert_eq!(popup.title, "");
29 assert!(!popup.visible);
30 }
31
32 #[test]
33 fn test_title_popup_visibility() {
34 let mut popup = TitlePopup::new();
35 popup.visible = true;
36 assert!(popup.visible);
37 }
38
39 #[test]
40 fn test_title_popup_set_title() {
41 let mut popup = TitlePopup::new();
42 popup.title = "New Title".to_string();
43 assert_eq!(popup.title, "New Title");
44 }
45}