1 extern crate ron;
2 #[macro_use]
3 extern crate serde;
4 
5 #[derive(Serialize, Deserialize)]
6 pub struct ImVec2 {
7     pub x: f32,
8     pub y: f32,
9 }
10 
11 #[derive(Serialize, Deserialize)]
12 pub struct ImColorsSave {
13     pub text: f32,
14 }
15 
16 #[derive(Serialize, Deserialize)]
17 pub struct ImGuiStyleSave {
18     pub alpha: f32,
19     pub window_padding: ImVec2,
20     pub window_min_size: ImVec2,
21     pub window_rounding: f32,
22     pub window_title_align: ImVec2,
23     pub child_window_rounding: f32,
24     pub frame_padding: ImVec2,
25     pub frame_rounding: f32,
26     pub item_spacing: ImVec2,
27     pub item_inner_spacing: ImVec2,
28     pub touch_extra_padding: ImVec2,
29     pub indent_spacing: f32,
30     pub columns_min_spacing: f32,
31     pub scrollbar_size: f32,
32     pub scrollbar_rounding: f32,
33     pub grab_min_size: f32,
34     pub grab_rounding: f32,
35     pub button_text_align: ImVec2,
36     pub display_window_padding: ImVec2,
37     pub display_safe_area_padding: ImVec2,
38     pub anti_aliased_lines: bool,
39     pub anti_aliased_shapes: bool,
40     pub curve_tessellation_tol: f32,
41     pub colors: ImColorsSave,
42 }
43 
44 const CONFIG: &str = "(
45     alpha: 1.0,
46     window_padding: (x: 8, y: 8),
47     window_min_size: (x: 32, y: 32),
48     window_rounding: 9.0,
49     window_title_align: (x: 0.0, y: 0.5),
50     child_window_rounding: 0.0,
51     frame_padding: (x: 4, y: 3),
52     frame_rounding: 0.0,
53     item_spacing: (x: 8, y: 4),
54     item_inner_spacing: (x: 4, y: 4),
55     touch_extra_padding: (x: 0, y: 0),
56     indent_spacing: 21.0,
57     columns_min_spacing: 6.0,
58     scrollbar_size: 16,
59     scrollbar_rounding: 9,
60     grab_min_size: 10,
61     grab_rounding: 0,
62     button_text_align: (x: 0.5, y: 0.5),
63     display_window_padding: (x: 22, y: 22),
64     display_safe_area_padding: (x: 4, y: 4),
65     anti_aliased_lines: true,
66     anti_aliased_shapes: true,
67     curve_tessellation_tol: 1.25,
68     colors: (text: 4),
69 
70     ignored_field: \"Totally ignored, not causing a panic. Hopefully.\",
71 )";
72 
73 #[test]
deserialize_big_struct()74 fn deserialize_big_struct() {
75     ron::de::from_str::<ImGuiStyleSave>(CONFIG).unwrap();
76 }
77