Skip to main content

litehtml_sys/
lib.rs

1#![allow(
2    non_upper_case_globals,
3    non_camel_case_types,
4    non_snake_case,
5    dead_code
6)]
7
8include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
9
10#[cfg(test)]
11mod tests {
12    use super::*;
13
14    #[test]
15    fn test_struct_sizes() {
16        // Ensure C structs have reasonable sizes (not zero)
17        assert!(std::mem::size_of::<lh_position_t>() > 0);
18        assert!(std::mem::size_of::<lh_web_color_t>() > 0);
19        assert!(std::mem::size_of::<lh_container_vtable_t>() > 0);
20    }
21
22    #[test]
23    fn test_null_document() {
24        unsafe {
25            // Passing null should not crash
26            lh_document_destroy(std::ptr::null_mut());
27            assert_eq!(lh_document_width(std::ptr::null()), 0.0);
28            assert_eq!(lh_document_height(std::ptr::null()), 0.0);
29        }
30    }
31}