Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Cmd.CmdTest

Contents

Description

Utilities for cmd tests.

Synopsis

running cmds

run_tracks :: [UiTest.TrackSpec] -> Cmd.CmdId a -> Result a Source #

Run cmd with the given tracks.

run_tracks_ruler :: [UiTest.TrackSpec] -> Cmd.CmdId a -> Result a Source #

Like run_tracks, but the ruler only extends to the end of the last event.

run_tracks_with_performance :: [UiTest.TrackSpec] -> Cmd.CmdT IO a -> IO (Result a) Source #

Derive the tracks and then run the cmd with the performance available.

run :: Ui.State -> Cmd.State -> Cmd.CmdId a -> Result a Source #

Run a cmd and return everything you could possibly be interested in.

eval :: Ui.State -> Cmd.State -> Cmd.CmdId a -> a Source #

Run a Cmd and return just the value.

run_sel :: Types.TrackNum -> [UiTest.TrackSpec] -> Cmd.CmdId a -> Result a Source #

Like run, but with a selection on the given track at 0 and note duration set to what will be a ScoreTime 1 with the ruler supplied by UiTest.

update_perf :: Ui.State -> Result val -> IO (Result val) Source #

Update performances after running a Cmd and getting its Result.

extract_derive :: (Score.Event -> a) -> Result _a -> ([a], [String]) Source #

Run a DeriveTest extractor on a CmdTest Result.

extract_derive_result :: Result a -> Result Source #

Reconstruct a Derive.Result from the root performance, or throw an exception if there is a problem getting it.

update_performance :: Ui.State -> Ui.State -> Cmd.State -> [Update.CmdUpdate] -> IO Cmd.State Source #

Update the performances based on the UI state change and updates. This manually runs that part of the responder, and is needed for tests that rely on the performances.

thread :: Ui.State -> Cmd.State -> [Cmd.CmdId a] -> Either String (Ui.State, Cmd.State) Source #

Run several cmds, threading the state through. The first cmd that fails aborts the whole operation.

cmds

set_point_sel_block :: Ui.M m => Text -> Types.TrackNum -> ScoreTime -> m () Source #

Set a point selection on the default view of the given block name.

select_all :: Cmd.M m => m () Source #

extractors

type Extracted val = Either String (val, [String]) Source #

The output of the extract family of functions: Either error (val, [log])

trace_logs :: Extracted a -> Either String a Source #

Run this on either extract or extract_state when you don't care about the logs.

val

extract :: (val -> e) -> Result val -> Extracted (Maybe e) Source #

Extract the value from a cmd. This is meant to be used as the single check on a cmd operation, so it also returns logs and whether the cmd failed or not (the latter is mandatory since otherwise there is no value).

state

extract_state :: (Ui.State -> Cmd.State -> e) -> Result val -> Extracted e Source #

Get something out of the Result from one of the states. Like extract, this is meant to be used as the single check on a cmd operation.

inst db

set_synths_simple :: [MidiInst.Synth] -> DeriveTest.SimpleAllocations -> Ui.State -> Cmd.State -> (Ui.State, Cmd.State) Source #

Configure ustate and cstate with the given instruments.

msg

Pitch.Input

setup cmds

set_env :: Cmd.M m => BlockId -> BlockId -> TrackId -> [(BaseTypes.Key, BaseTypes.Val)] -> m () Source #

Fake up just enough Performance to have environ in it.