Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Commit a019876

Browse files
authored
Merge pull request #519 from fengalin/remove_signal_panic_tests
Remove tests which panic in signals
2 parents 580be8c + 5e21d8a commit a019876

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed

src/subclass/object.rs

+2-33
Original file line numberDiff line numberDiff line change
@@ -666,18 +666,8 @@ mod test {
666666
assert_eq!(value.get::<String>(), Ok(Some("return value".to_string())));
667667
}
668668

669-
#[cfg(not(all(windows, target_pointer_width = "32")))] // Windows 32bits CI fails on this test
670-
#[test]
671-
#[should_panic(expected = "Signal required return value of type gchararray but got gboolean")]
672-
fn test_signal_return_wrong_type() {
673-
let obj = Object::new(SimpleObject::get_type(), &[]).unwrap();
674-
675-
// Returning a `bool` when a `String` was expected
676-
obj.connect("create-string", false, move |_args| Some(true.to_value()))
677-
.unwrap();
678-
679-
let _res = obj.emit("create-string", &[]);
680-
}
669+
// Note: can't test type mismatch in signals since panics accross FFI boundaries
670+
// are UB. See https://github.com/gtk-rs/glib/issues/518
681671

682672
#[test]
683673
fn test_signal_return_expected_object_type() {
@@ -695,25 +685,4 @@ mod test {
695685
let value = obj.emit("create-child-object", &[]).unwrap().unwrap();
696686
assert!(value.type_().is_a(&ChildObject::static_type()));
697687
}
698-
699-
#[cfg(not(all(windows, target_pointer_width = "32")))] // Windows 32bits CI fails on this test
700-
#[test]
701-
#[should_panic(
702-
expected = "Signal required return value of type ChildObject but got GObject (actual SimpleObject)"
703-
)]
704-
fn test_signal_return_wrong_object_type() {
705-
let obj = Object::new(SimpleObject::get_type(), &[]).unwrap();
706-
707-
// Returning a `SimpleObject` when a `ChildObject` was expected
708-
obj.connect("create-child-object", false, move |_args| {
709-
Some(
710-
Object::new(SimpleObject::get_type(), &[])
711-
.unwrap()
712-
.to_value(),
713-
)
714-
})
715-
.unwrap();
716-
717-
let _res = obj.emit("create-child-object", &[]);
718-
}
719688
}

0 commit comments

Comments
 (0)