Karya, built on Sun Nov 26 01:04:37 PST 2017 (patch 0a920b2bde70c0cbac8ee09d158064798b61bbe5)

Cmd.CmdTest

Description

Utilities for cmd tests.

Synopsis

# running cmds

data Result val Source #

Constructors

 Result Fieldsresult_val :: Either Text (Maybe val)A Nothing val means it aborted.result_cmd_state :: Cmd.State result_ui_state :: Ui.State result_updates :: [Update.CmdUpdate] result_logs :: [Log.Msg] result_midi :: [Interface.Message]

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

Run cmd with the given tracks.

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

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], [Text]) Source #

Run a DeriveTest extractor on a CmdTest Result.

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

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.

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

thread_tracks :: [UiTest.TrackSpec] -> (Cmd.State -> Cmd.State) -> [Cmd.CmdId a] -> Either Text (Ui.State, Cmd.State) Source #

Make some tracks and call thread.

## 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 Text (val, [Text]) Source #

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

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

Configure ustate and cstate with the given instruments.

# setup cmds

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

Fake up just enough Performance to have environ in it.