diff --git a/tests/loadcanvas_test.rs b/tests/loadcanvas_test.rs index 3321836..8cd5ca8 100644 --- a/tests/loadcanvas_test.rs +++ b/tests/loadcanvas_test.rs @@ -1,9 +1,10 @@ -use synfig_core::{loadcanvas::*, version::*}; +use synfig_core::loadcanvas::*; +use synfig_core::version::*; #[test] fn load_canvas_methods() { - env_logger::init(); + env_logger::Builder::new().filter_level(log::LevelFilter::max()).init(); // Test canvas data structure let mut canvas = CanvasParser::new(); @@ -13,12 +14,22 @@ fn load_canvas_methods() { canvas.show_canvas_map("file".to_string(), 1, "text".to_string()); assert_eq!(0, canvas.error_count()); - // Test log functions + + let err_txt = canvas.get_errors_text(); + let warn_txt = canvas.get_warnings_text(); + assert!(err_txt == "".to_string()); + assert!(warn_txt == "".to_string()); + canvas.set_allow_errors(true); - canvas.error(1234, "canvas layer missing".to_string()); + canvas.error(1234, "canvas layer missing"); assert_eq!(1, canvas.error_count()); + canvas.warning(98, "attribute unknown"); + + let err_txt = canvas.get_errors_text(); + let warn_txt = canvas.get_warnings_text(); + assert!(err_txt == " * :<1234>:1234: error: canvas layer missing\n".to_string()); + assert!(warn_txt == " * :<98>:98: attribute unknown\n".to_string()); - canvas.warning(98, "attribute unknown".to_string()); } #[test]