gtk4/
object_expression.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
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::translate::*;

use crate::ObjectExpression;

define_expression!(ObjectExpression, crate::ffi::GtkObjectExpression);

impl std::fmt::Debug for ObjectExpression {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ObjectExpression")
            .field("value_type", &self.value_type())
            .field("is_static", &self.is_static())
            .field("object", &self.object())
            .finish()
    }
}

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

    #[test]
    fn test_object_expression() {
        let obj = crate::IconTheme::new();
        let expr = ObjectExpression::new(&obj);
        assert_eq!(expr.object().unwrap(), obj);
        assert!(expr.is::<ObjectExpression>());
    }
}