Bug 1589514 - P2: Update cubeb-coreaudio-rs to 92e2e11. r=padenot

Depends on D50002

Differential Revision: https://phabricator.services.mozilla.com/D50003

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Chun-Min Chang 2019-10-22 11:46:55 +00:00
parent d8668b05bc
commit d7aacc3bc4
4 changed files with 29 additions and 6 deletions

View File

@ -1,7 +1,7 @@
[package]
name = "cubeb-coreaudio"
version = "0.1.0"
authors = ["Chun-Min Chang <chun.m.chang@gmail.com>"]
authors = ["Chun-Min Chang <chun.m.chang@gmail.com>", "Paul Adenot <paul@paul.cx>"]
[lib]
crate-type = ["staticlib", "rlib"]

View File

@ -3,4 +3,4 @@ git repository using the update.sh script.
The cubeb-coreaudio-rs git repository is: https://github.com/ChunMinChang/cubeb-coreaudio-rs
The git commit ID used was fd242eabb966784a0345df91c2462fd0b799bc71 (2019-10-10 10:22:29 -0700)
The git commit ID used was 92e2e116cffb570176f9916b98355f1ed0728559 (2019-10-21 15:51:54 -0700)

View File

@ -9,5 +9,5 @@ core-foundation-sys = { version = "0.6" }
[dependencies.coreaudio-sys]
default-features = false
features = ["audio_unit", "core_audio", "nobindgen"]
features = ["audio_unit", "core_audio"]
version = "0.2"

View File

@ -81,7 +81,9 @@ fn utf8_from_cfstringref(string_ref: CFStringRef) -> Vec<u8> {
assert!(!string_ref.is_null());
let length: CFIndex = unsafe { CFStringGetLength(string_ref) };
assert!(length > 0);
if length == 0 {
return Vec::new();
}
// Get the buffer size of the string.
let range: CFRange = CFRange {
@ -126,10 +128,9 @@ fn utf8_from_cfstringref(string_ref: CFStringRef) -> Vec<u8> {
mod test {
use super::*;
const STATIC_STRING: &str = "static string for testing";
#[test]
fn test_create_static_cfstring_ref() {
const STATIC_STRING: &str = "static string for testing";
let stringref =
StringRef::new(cfstringref_from_static_string(STATIC_STRING) as CFStringRef);
assert_eq!(STATIC_STRING, stringref.to_string());
@ -140,6 +141,19 @@ mod test {
// TODO: Find a way to check the string's inner pointer is same.
}
#[test]
fn test_create_static_empty_cfstring_ref() {
const STATIC_EMPTY_STRING: &str = "";
let stringref =
StringRef::new(cfstringref_from_static_string(STATIC_EMPTY_STRING) as CFStringRef);
assert_eq!(STATIC_EMPTY_STRING, stringref.to_string());
assert_eq!(
CString::new(STATIC_EMPTY_STRING).unwrap(),
stringref.into_cstring()
);
// TODO: Find a way to check the string's inner pointer is same.
}
#[test]
fn test_create_cfstring_ref() {
let expected = "Rustaceans 🦀";
@ -148,4 +162,13 @@ mod test {
assert_eq!(CString::new(expected).unwrap(), stringref.into_cstring());
// TODO: Find a way to check the string's inner pointer is different.
}
#[test]
fn test_create_empty_cfstring_ref() {
let expected = "";
let stringref = StringRef::new(cfstringref_from_string(expected) as CFStringRef);
assert_eq!(expected, stringref.to_string());
assert_eq!(CString::new(expected).unwrap(), stringref.into_cstring());
// TODO: Find a way to check the string's inner pointer is different.
}
}