Files
ShoeGaze/Tests/LyrebirdShoeGazeTests/PedalInfoTests.swift
T
josh f29ab609bd Add Chorus, Sustainer, Ring Modulator pedals + pedal-info UI
Pedals (each registered, with PedalType static, enclosure color, palette order,
summary, and tests):
- Chorus: true-stereo widener (two anti-phase modulated delay lines), distinct
  from the mono-summed Modulation chorus.
- Sustainer: one-knob compressor (sustain drives threshold/ratio/makeup via
  LinLin) + tone low-pass.
- Ring Modulator: dry × tunable sine carrier.

Pedal-info UI:
- Pedal.summary (open var, overridden by all 21 pedals; mandatory going forward).
- PedalRegistry.summary(for:) for the picker.
- PedalPaletteView rows show the summary as a subtitle.
- PedalView gains an ⓘ button → PedalInfoView sheet showing the description and
  the effect controls (knobs/sliders/switches) with ranges/options — excludes
  the common Mix/Level/bypass.

Tests: per-pedal build/param-change/knob-list; every built-in pedal has a
non-empty summary; info excludes common controls. 183 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 18:05:30 -07:00

44 lines
1.6 KiB
Swift

// PedalInfoTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import Testing
import Foundation
import LyrebirdSynth
import LyrebirdUI
@testable import LyrebirdShoeGaze
@MainActor
@Suite("Pedal info")
struct PedalInfoTests {
@Test func everyBuiltInPedalHasASummary() throws {
for type: String in PedalRegistry.builtIn.keys {
let pedal: Pedal? = PedalRegistry.makePedal(type: type)
#expect(pedal != nil, "registry could not build \(type)")
let summary: String = pedal?.summary ?? ""
#expect(!summary.isEmpty, "\(type) has an empty summary — every pedal must set one")
}
}
@Test func registrySummaryHelperMatchesInstance() throws {
#expect(PedalRegistry.summary(for: "Overdrive") == OverdrivePedal().summary)
#expect(PedalRegistry.summary(for: "Ring Modulator") == RingModulatorPedal().summary)
#expect(PedalRegistry.summary(for: "Nope") == "")
}
@Test func effectControlsExcludeCommonControls() throws {
// The info panel lists effect controls only; the common Mix / Level / bypass live in the
// base `Pedal` and must never appear in effectKnobs/effectSliders/effectSwitches.
let pedal: GraphicEQPedal = GraphicEQPedal()
let effectLabels: [String] =
pedal.effectKnobs.map { $0.label }
+ pedal.effectSliders.map { $0.label }
+ pedal.effectSwitches.map { $0.label }
#expect(!effectLabels.contains("Mix"))
#expect(!effectLabels.contains("Level"))
}
}