add just cov-md and bump total coverage to 29.26%

This commit is contained in:
🪞👃🪞 2025-02-15 19:30:32 +00:00
parent 5b797342b7
commit fd32cbc34c
5 changed files with 77 additions and 18 deletions

View file

@ -279,3 +279,28 @@ impl Command<MidiEditor> for MidiEditCommand {
////// TODO: kpat!(Char('/')) => // toggle 3plet
////// TODO: kpat!(Char('?')) => // toggle dotted
//});
#[cfg(test)] #[test] fn test_midi_edit () {
let mut editor = MidiEditor {
mode: PianoHorizontal::new(Some(&Arc::new(RwLock::new(MidiClip::stop_all())))),
size: Default::default(),
keys: Default::default(),
};
let _ = editor.put_note(true);
let _ = editor.put_note(false);
let _ = editor.clip_status();
let _ = editor.edit_status();
struct TestEditorHost(Option<MidiEditor>);
has_editor!(|self: TestEditorHost|{
editor = self.0;
editor_w = 0;
editor_h = 0;
is_editing = false;
});
let mut host = TestEditorHost(Some(editor));
let _ = host.editor();
let _ = host.editor_mut();
let _ = host.is_editing();
let _ = host.editor_w();
let _ = host.editor_h();
}

View file

@ -62,3 +62,18 @@ impl NoteRange for MidiRangeModel {
fn note_lo (&self) -> &AtomicUsize { &self.note_lo }
fn note_axis (&self) -> &AtomicUsize { &self.note_axis }
}
#[cfg(test)] #[test] fn test_midi_range () {
let model = MidiRangeModel::from((1, false));
let _ = model.time_len();
let _ = model.time_zoom();
let _ = model.time_lock();
let _ = model.time_start();
let _ = model.time_axis();
let _ = model.time_end();
let _ = model.note_lo();
let _ = model.note_axis();
let _ = model.note_hi();
}

View file

@ -104,9 +104,10 @@ impl PianoHorizontal {
match event {
MidiMessage::NoteOn { key, .. } => {
let note = key.as_int() as usize;
let cell = buf.get_mut(x, note).unwrap();
cell.set_char('█');
cell.set_style(style);
if let Some(cell) = buf.get_mut(x, note) {
cell.set_char('█');
cell.set_style(style);
}
notes_on[note] = true
},
MidiMessage::NoteOff { key, .. } => {