33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
// MultiSliderTests.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import Testing
|
|
@testable import LyrebirdUI
|
|
import LyrebirdSynth
|
|
|
|
@Suite("MultiSlider")
|
|
struct MultiSliderTests {
|
|
|
|
/// `MultiSlider.init` reads initial bar values from the buffer's current
|
|
/// contents — verify by constructing one against a buffer with known values.
|
|
/// We can't exercise the SwiftUI body in a unit test, so this is a structural
|
|
/// smoke covering the precondition path and the `@State` seed loop.
|
|
@Test func initReadsValuesFromBuffer() {
|
|
let buf: LyrebirdBuffer = LyrebirdBuffer(count: 8)
|
|
for i: Int in 0..<8 {
|
|
buf.setValue(Double(i) / 8.0, at: i)
|
|
}
|
|
// Construct does not crash; preconditions all pass for valid args.
|
|
_ = MultiSlider(buffer: buf, count: 4, startIndex: 2, range: 0.0...1.0, height: 80)
|
|
}
|
|
|
|
@Test func initWithFullBufferRange() {
|
|
let buf: LyrebirdBuffer = LyrebirdBuffer(count: 16)
|
|
buf.fill(with: 0.5)
|
|
_ = MultiSlider(buffer: buf, count: 16, startIndex: 0, range: 0.0...1.0)
|
|
}
|
|
}
|