Skip to content

Commit c5f94b1

Browse files
authored
Merge pull request #105 from simlay/simlay/add-simple-test-for-audio-device-ids
Added unit tests for get_audio_device_ids and bump version to 0.11.3
2 parents c9bbe6e + 6a4a30f commit c5f94b1

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

.github/workflows/coreaudio-rs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ jobs:
2222
# - name: cargo test - all features
2323
# run: cargo test --all-features --verbose
2424

25+
security-audit:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: rustsec/[email protected]
30+
with:
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
2533
ios-build:
2634
runs-on: macOS-latest
2735
steps:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "coreaudio-rs"
3-
version = "0.11.2"
3+
version = "0.11.3"
44
authors = ["mitchmindtree <[email protected]>", "yupferris <[email protected]>"]
55
description = "A friendly rust interface for Apple's CoreAudio API."
66
keywords = ["core", "audio", "unit", "osx", "ios"]

src/audio_unit/macos_helpers.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,27 @@ pub fn get_audio_device_ids() -> Result<Vec<AudioDeviceID>, Error> {
173173
get_audio_device_ids_for_scope(Scope::Global)
174174
}
175175

176+
#[test]
177+
fn test_get_audio_device_ids() {
178+
let _ = get_audio_device_ids().expect("Failed to get audio device ids");
179+
}
180+
181+
#[test]
182+
fn test_get_audio_device_ids_for_scope() {
183+
for scope in &[
184+
Scope::Global,
185+
Scope::Input,
186+
Scope::Output,
187+
Scope::Group,
188+
Scope::Part,
189+
Scope::Note,
190+
Scope::Layer,
191+
Scope::LayerItem,
192+
] {
193+
let _ = get_audio_device_ids_for_scope(*scope).expect("Failed to get audio device ids");
194+
}
195+
}
196+
176197
/// does this device support input / ouptut?
177198
pub fn get_audio_device_supports_scope(devid: AudioDeviceID, scope: Scope) -> Result<bool, Error> {
178199
let dev_scope: AudioObjectPropertyScope = match scope {

0 commit comments

Comments
 (0)