Skip to content

Commit

Permalink
Update loadcanvas_test.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
eshikafe committed Dec 31, 2023
1 parent 3800308 commit e3761e1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions tests/loadcanvas_test.rs
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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]
Expand Down

0 comments on commit e3761e1

Please sign in to comment.