Issue11cTests.inc 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Round 165 issue11c (issue #11, n3m351S + Jocho-Smith): the record button of an audio track's header and FL 2026's
  2. // measured Shift+Space
  3. // FL 2026 [SHOT, issue11c]: only an audio track (Track mode › Audio track › Insert N) has the header buttons; they act on
  4. // its linked mixer track. Unassigned and instrument tracks have none.
  5. TEST (issue11c_audio_track_arms_its_mixer_track)
  6. {
  7. using namespace lynx;
  8. auto song = Song::makeDefault();
  9. song.playlistTracks.resize (4);
  10. CHECK (trackmodes::armableInsert (song, 0) < 0); // unassigned
  11. CHECK (trackmodes::armableInsert (song, -1) < 0 && trackmodes::armableInsert (song, 99) < 0);
  12. CHECK (trackmodes::makeAudioTrack (song, 2));
  13. const auto insert = song.playlistTracks[2].mixerTrack;
  14. CHECK (insert > 0 && trackmodes::armableInsert (song, 2) == insert);
  15. CHECK (trackmodes::makeInstrumentTrack (song, 1, 0)); // an instrument track: no record button
  16. CHECK (trackmodes::armableInsert (song, 1) < 0);
  17. song.playlistTracks[3].mode = PlaylistTrackMode::audio; // linked to a mixer track that doesn't exist: none
  18. song.playlistTracks[3].mixerTrack = (int) song.mixer.size();
  19. CHECK (trackmodes::armableInsert (song, 3) < 0);
  20. song.playlistTracks[3].mixerTrack = 0; // the Master can't be armed
  21. CHECK (trackmodes::armableInsert (song, 3) < 0);
  22. trackmodes::unassign (song, 2);
  23. CHECK (trackmodes::armableInsert (song, 2) < 0);
  24. }
  25. // FL 2026, measured with real keys in FL (Song and Pattern mode, Playlist / Piano Roll / Channel Rack focus, recording):
  26. // Shift+Space while playing stops at the start of the time selection (Song mode) or else at 1:01 — not where playback
  27. // started (bar 5 → 1:01) and not where it was pressed; while stopped it plays from the current position like Space.
  28. TEST (issue11c_shift_space_stop_target_matches_fl)
  29. {
  30. using namespace lynx;
  31. const auto bar = (std::int64_t) (4 * ppq);
  32. CHECK (transportedit::shiftSpaceStopTarget (true, false, 0) == 0); // Song, no selection: 1:01
  33. CHECK (transportedit::shiftSpaceStopTarget (true, true, 2 * bar) == 2 * bar); // Song, selection bars 3-7: 3:01
  34. CHECK (transportedit::shiftSpaceStopTarget (false, true, 2 * bar) == 0); // Pattern mode: pattern start
  35. CHECK (transportedit::shiftSpaceStopTarget (false, false, 0) == 0);
  36. CHECK (transportedit::shiftSpaceStopTarget (true, true, -5) == 0);
  37. using namespace lynx::keys;
  38. KeyMap map;
  39. CHECK (map.find ({ space, shift }, Context::playlist, false) == "transport.playFromStart");
  40. const auto* action = findAction ("transport.playFromStart");
  41. CHECK (action != nullptr && std::string (action->description) == "Play, or stop at the start of the song or pattern");
  42. }
  43. // Round 165 issue11d — FL 2026 [SHOT]: a left-click on a mixer track's "Arm disk recording" (or on an audio track's
  44. // record button) arms it at once, with no input source as well as with one; a second click disarms; the Master has none.
  45. TEST (issue11d_arm_click_arms_at_once_like_fl)
  46. {
  47. using namespace lynx;
  48. CHECK (armClick (1, false) == ArmClick::arm); // insert without (or with) an input: armed at once
  49. CHECK (armClick (1, true) == ArmClick::disarm);
  50. CHECK (armClick (126, false) == ArmClick::arm);
  51. CHECK (armClick (0, false) == ArmClick::none); // the Master
  52. CHECK (armClick (-1, true) == ArmClick::none);
  53. }