mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-02-21 16:29:04 +01:00
refactor(engine): flatten
- add `just stats` - add basic doctests
This commit is contained in:
parent
7afab8eade
commit
37068784cb
34 changed files with 1285 additions and 1173 deletions
|
|
@ -510,7 +510,7 @@ impl App {
|
|||
&& slot.is_none()
|
||||
&& let Some(track) = self.project.tracks.get_mut(track)
|
||||
{
|
||||
let (index, mut clip) = self.pool.add_new_clip();
|
||||
let (_index, mut clip) = self.pool.add_new_clip();
|
||||
// autocolor: new clip colors from scene and track color
|
||||
let color = track.color.base.mix(scene.color.base, 0.5);
|
||||
clip.write().unwrap().color = ItemColor::random_near(color, 0.2).into();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,25 @@ use builder_pattern::Builder;
|
|||
/// Total state
|
||||
///
|
||||
/// ```
|
||||
/// use tek::tek_device::TracksView;
|
||||
/// let app: tek::App = Default::default();
|
||||
/// let _ = app.scene_add(None, None)?;
|
||||
/// let _ = app.update_clock();
|
||||
/// app.project.editor = Some(Default::default());
|
||||
/// //let _: Vec<_> = app.project.inputs_with_sizes().collect();
|
||||
/// //let _: Vec<_> = app.project.outputs_with_sizes().collect();
|
||||
/// let _: Vec<_> = app.project.tracks_with_sizes().collect();
|
||||
/// //let _: Vec<_> = app.project.scenes_with_sizes(true, 10, 10).collect();
|
||||
/// //let _: Vec<_> = app.scenes_with_colors(true, 10).collect();
|
||||
/// //let _: Vec<_> = app.scenes_with_track_colors(true, 10, 10).collect();
|
||||
/// let _ = app.project.w();
|
||||
/// //let _ = app.project.w_sidebar();
|
||||
/// //let _ = app.project.w_tracks_area();
|
||||
/// let _ = app.project.h();
|
||||
/// //let _ = app.project.h_tracks_area();
|
||||
/// //let _ = app.project.h_inputs();
|
||||
/// //let _ = app.project.h_outputs();
|
||||
/// let _ = app.project.h_scenes();
|
||||
/// ```
|
||||
#[derive(Default, Debug)] pub struct App {
|
||||
/// Base color.
|
||||
|
|
@ -120,6 +138,9 @@ use builder_pattern::Builder;
|
|||
///
|
||||
/// ```
|
||||
/// let cli: tek::Cli = Default::default();
|
||||
///
|
||||
/// use clap::CommandFactory;
|
||||
/// tek::Cli::command().debug_assert();
|
||||
/// ```
|
||||
#[derive(Debug, Parser, Default)]
|
||||
#[command(name = "tek", version, about = Some(HEADER), long_about = Some(HEADER))]
|
||||
|
|
|
|||
|
|
@ -25,31 +25,6 @@ use crate::*;
|
|||
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_cli () {
|
||||
use clap::CommandFactory;
|
||||
Cli::command().debug_assert();
|
||||
//let jack = Jack::default();
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_app () -> Usually<()> {
|
||||
let mut app = App::default();
|
||||
let _ = app.scene_add(None, None)?;
|
||||
let _ = app.update_clock();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_track () -> Usually<()> {
|
||||
let track = Track::default();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_scene () -> Usually<()> {
|
||||
let scene = Scene::default();
|
||||
let _ = scene.pulses();
|
||||
let _ = scene.is_playing(&[]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_view_layout () {
|
||||
let _ = button_play_pause(true);
|
||||
let _ = button_2("", "", true);
|
||||
|
|
@ -83,52 +58,5 @@ use crate::*;
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_view_iter () {
|
||||
let mut app = App::default();
|
||||
app.project.editor = Some(Default::default());
|
||||
//let _: Vec<_> = app.project.inputs_with_sizes().collect();
|
||||
//let _: Vec<_> = app.project.outputs_with_sizes().collect();
|
||||
let _: Vec<_> = app.project.tracks_with_sizes().collect();
|
||||
//let _: Vec<_> = app.project.scenes_with_sizes(true, 10, 10).collect();
|
||||
//let _: Vec<_> = app.scenes_with_colors(true, 10).collect();
|
||||
//let _: Vec<_> = app.scenes_with_track_colors(true, 10, 10).collect();
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_view_sizes () {
|
||||
let app = App::default();
|
||||
let _ = app.project.w();
|
||||
//let _ = app.project.w_sidebar();
|
||||
//let _ = app.project.w_tracks_area();
|
||||
let _ = app.project.h();
|
||||
//let _ = app.project.h_tracks_area();
|
||||
//let _ = app.project.h_inputs();
|
||||
//let _ = app.project.h_outputs();
|
||||
let _ = app.project.h_scenes();
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_midi_edit () {
|
||||
let _editor = MidiEditor::default();
|
||||
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!(Option<MidiEditor>: |self: TestEditorHost|self.0);
|
||||
//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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue