move sanity check

This commit is contained in:
Erica Z 2024-11-04 13:54:30 +01:00
parent f18c413457
commit daff4e7dbd

View file

@ -150,12 +150,6 @@ mod imp {
Event::StartFile(_) => { Event::StartFile(_) => {
window.notify("song"); window.notify("song");
// TODO: load cover art // TODO: load cover art
// sanity check
assert_eq!(
window.song().unwrap().stream_url(),
window.imp().mpv.get_property::<String>("path").unwrap()
);
} }
Event::Hook(event) => match event.reply_userdata { Event::Hook(event) => match event.reply_userdata {
@ -332,14 +326,20 @@ mod imp {
if self.obj().playlist_pos() < 0 { if self.obj().playlist_pos() < 0 {
None None
} else { } else {
Some( let song: PlaybinSong = self
self.obj() .obj()
.playlist_model() .playlist_model()
.item(self.obj().playlist_pos() as u32) .item(self.obj().playlist_pos() as u32)
.unwrap() .unwrap()
.dynamic_cast() .dynamic_cast()
.unwrap(), .unwrap();
)
// sanity check
assert_eq!(
song.stream_url(),
self.mpv.get_property::<String>("path").unwrap()
);
Some(song)
} }
} }
} }