Skip to content

Commit c65d064

Browse files
sdroegebilelmoussaoui
authored andcommitted
glib-macros: Make subclassable test actually do something at runtime
1 parent 1e6a98b commit c65d064

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

glib-macros/tests/test.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,16 @@ fn subclassable() {
281281
}
282282

283283
impl ObjectImpl for Foo {}
284+
285+
impl Foo {
286+
pub(super) fn test(&self) {}
287+
}
284288
}
285289

286290
pub trait FooExt: IsA<Foo> + 'static {
287291
fn test(&self) {
288-
let _self = self.as_ref().downcast_ref::<Foo>().unwrap().imp();
289-
unimplemented!()
292+
let imp = self.as_ref().upcast_ref::<Foo>().imp();
293+
imp.test();
290294
}
291295
}
292296

@@ -296,6 +300,11 @@ fn subclassable() {
296300
pub struct Foo(ObjectSubclass<imp::Foo>);
297301
}
298302
}
303+
304+
use foo::FooExt;
305+
306+
let obj = glib::Object::new::<foo::Foo>();
307+
obj.test();
299308
}
300309

301310
#[test]

0 commit comments

Comments
 (0)