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

Ui.UiTest

Synopsis

# Documentation

(10, 50) seems to be the smallest x,y OS X will accept. Apparently fltk's sizes don't take the menu bar into account, which is about 44 pixels high, so a y of 44 is the minimum.

# fmt

fmt_events :: [EventSpec] -> Text Source #

Visualize event ranges. This can be used with Testing.equal_fmt.

right_fst :: (a -> Text) -> Either x (a, y) -> Text Source #

Extract and fmt the fst . right element. Many DeriveTest extractors return Either Error (val, [log]).

type BlockSpec = (Text, [TrackSpec]) Source #

(block_id, tracks)

If the name ends with =ruler, then the length of the ruler is derived from the events inside, rather than being hardcoded. This is convenient for tests and lets them avoid hardcoding the default_ruler end.

Also, if the name contains --, the text after it becomes the block title.

type TrackSpec = (Text, [EventSpec]) Source #

(track_title, events)

(start, dur, text)

Parse a block spec, which looks like name[=ruler] [-- title]

Often tests work with a single block, or a single view. To make them less verbose, there is a default block and view so functions can omit the parameter if convenient.

run :: CallStack.Stack => Ui.State -> Ui.StateId a -> (a, Ui.State) Source #

Return the val and state, throwing an IO error on an exception. Intended for tests that don't expect to fail here.

mkblock_ruler :: Ui.M m => Id.RulerId -> Id.BlockId -> Text -> [TrackSpec] -> m (Id.BlockId, [Id.TrackId]) Source #

Like mkblock, but uses the provided ruler instead of creating its own. Important if you are creating multiple blocks and don't want a separate ruler for each.

Make a TrackId as mkblock does. This is so tests can independently come up with the track IDs mkblock created just by knowing their tracknum.

Get a TrackNum back out of a mk_tid call.

# actions

## make specs

type NoteSpec = (Text, [EventSpec], [(Text, [(ScoreTime.ScoreTime, Text)])]) Source #

This is a simplification of TrackSpec that assumes one pitch per note. It hardcodes the scale to * and all the control tracks are under a single note track, but in exchange it's easier to write than full TrackSpecs.

(inst, [(t, dur, pitch)], [(control, [(t, val)])])

If the pitch looks like "a -- 4c" then "a" is the note track's event and "4c" is the pitch track's event. If the pitch is missing, the empty pitch event is filtered out. This doesn't happen for the note event since empty note event has a meaning.

note_track :: [EventSpec] -> [TrackSpec] Source #

Abbreviation for note_spec where the inst and controls are empty.

note_track1 :: [Text] -> [TrackSpec] Source #

Like note_track, but all notes have a duration of 1.

to_note_spec :: [TrackSpec] -> [NoteSpec] Source #

Parse a TrackSpec back out to a NoteSpec.

to_pitch_spec :: [NoteSpec] -> [[EventSpec]] Source #

Like to_note_spec but expect just notes and pitches, no controls.

# state to spec

Like dump_block but strip out everything but the tracks.

Get the names and tracks of the default block.

# view

## ruler

TimeStep to step by 1 ScoreTime on the default ruler.

Create a ruler with a 4/4 "meter" marklist with the given number of marks at the given distance. Marks are rank [1, 2, 2, ...].

The end of the ruler should be at marks*dist. An extra mark is created since marks start at 0.

# allocations

allocations :: [(Text, Text, [Midi.Channel])] -> UiConfig.Allocations Source #

Make Simple.Allocations from (inst, qualified, [chan]).