GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
Update unit tests for type annotations and add test_real_config_kdl
src/config.rs | 11 +++++++++++
src/widget/container/treelist.rs | 7 ++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/config.rs b/src/config.rs
index ca7c05f..8d9e724 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -537,6 +537,17 @@ mod tests {
let ty2 = get_kdl_type_annotation(content, "input.touchpad.gestures.pinch");
assert_eq!(ty2, Some("bool".to_string()));
}
+
+ #[test]
+ fn test_real_config_kdl() {
+ let path = "/home/lsgalante/.config/cce/config.kdl";
+ if std::path::Path::new(path).exists() {
+ let content = std::fs::read_to_string(path).unwrap();
+ let ty = get_kdl_type_annotation(&content, "input.accel_profile");
+ println!("REAL CONFIG ACCEL PROFILE ANNO: {:?}", ty);
+ assert_eq!(ty, Some("menu:flat,adaptive,none,custom".to_string()));
+ }
+ }
}
pub fn value_to_kdl(key: &str, val: &serde_json::Value, indent: usize) -> String {
diff --git a/src/widget/container/treelist.rs b/src/widget/container/treelist.rs
index 25e9270..5069016 100644
--- a/src/widget/container/treelist.rs
+++ b/src/widget/container/treelist.rs
@@ -1087,8 +1087,9 @@ mod tests {
fn test_keybind_label() {
let mut tree_list = TreeList::new();
tree_list.set_rect(10.0, 52.0, 380.0, 500.0);
+ tree_list.annotations = vec![Some("menu:flat,adaptive".to_string())];
tree_list.set_flat_keys(vec![
- ("input.key_bindings[0].key".to_string(), serde_json::Value::String("super+q".to_string()))
+ ("input.accel_profile".to_string(), serde_json::Value::String("flat".to_string()))
]);
let labels = tree_list.text_labels();
@@ -1096,8 +1097,8 @@ mod tests {
println!("TEST LABEL: {:?}", label);
}
- let has_keybind_label = labels.iter().any(|l| l.text == "(keybind)");
- assert!(has_keybind_label, "Should have (keybind) label!");
+ let has_menu_label = labels.iter().any(|l| l.text == "(menu)");
+ assert!(has_menu_label, "Should have (menu) label!");
}
#[test]