Browse Source

Audio: of course nothing is ever simple. Right, Apple?

pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
9ac5943957
  1. 27
      src/Magnum/Audio/Test/ContextALTest.cpp

27
src/Magnum/Audio/Test/ContextALTest.cpp

@ -78,6 +78,12 @@ void ContextALTest::constructDefault() {
CORRADE_COMPARE(&Context::current(), &context); CORRADE_COMPARE(&Context::current(), &context);
/* Verify the queries make sense */ /* Verify the queries make sense */
#ifdef CORRADE_TARGET_APPLE
if(context.vendorString() == "Apple Computer Inc.")
CORRADE_WARN("Apple's OpenAL implementation returns bogus values. Sometimes. With a random value every call. Skipping the context properties comparison.");
else
#endif
{
CORRADE_COMPARE_AS(context.frequency(), 10000, CORRADE_COMPARE_AS(context.frequency(), 10000,
TestSuite::Compare::Greater); TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(context.monoSourceCount(), 2, CORRADE_COMPARE_AS(context.monoSourceCount(), 2,
@ -87,6 +93,7 @@ void ContextALTest::constructDefault() {
CORRADE_COMPARE_AS(context.refreshRate(), 10, CORRADE_COMPARE_AS(context.refreshRate(), 10,
TestSuite::Compare::Greater); TestSuite::Compare::Greater);
} }
}
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
} }
@ -109,6 +116,12 @@ void ContextALTest::constructConfiguration() {
/* Verify the queries make sense. All of these are just hints so the /* Verify the queries make sense. All of these are just hints so the
actual value used could be higher. */ actual value used could be higher. */
#ifdef CORRADE_TARGET_APPLE
if(context.vendorString() == "Apple Computer Inc.")
CORRADE_WARN("Apple's OpenAL implementation returns bogus values. Sometimes. With a random value every call. Skipping the context properties comparison.");
else
#endif
{
CORRADE_COMPARE_AS(context.frequency(), 22050, CORRADE_COMPARE_AS(context.frequency(), 22050,
TestSuite::Compare::GreaterOrEqual); TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(context.monoSourceCount(), 5, CORRADE_COMPARE_AS(context.monoSourceCount(), 5,
@ -116,6 +129,7 @@ void ContextALTest::constructConfiguration() {
CORRADE_COMPARE(context.stereoSourceCount(), 4); CORRADE_COMPARE(context.stereoSourceCount(), 4);
CORRADE_COMPARE_AS(context.refreshRate(), 25, CORRADE_COMPARE_AS(context.refreshRate(), 25,
TestSuite::Compare::GreaterOrEqual); TestSuite::Compare::GreaterOrEqual);
}
/* HRTF gets enabled only if the extension is supported */ /* HRTF gets enabled only if the extension is supported */
if(context.isExtensionSupported<Extensions::ALC::SOFT::HRTF>()) { if(context.isExtensionSupported<Extensions::ALC::SOFT::HRTF>()) {
@ -137,10 +151,16 @@ void ContextALTest::constructDeviceNotFound() {
{ {
Context context{NoCreate, arguments().first, arguments().second}; Context context{NoCreate, arguments().first, arguments().second};
{
#ifdef CORRADE_TARGET_APPLE
CORRADE_EXPECT_FAIL_IF(context.vendorString() == "Apple Computer Inc.",
"Apple's OpenAL implementation doesn't fail if invalid device specifier is set.");
#endif
CORRADE_VERIFY(!context.tryCreate(Context::Configuration{} CORRADE_VERIFY(!context.tryCreate(Context::Configuration{}
.setDeviceSpecifier("hello this definitely doesn't exist"))); .setDeviceSpecifier("hello this definitely doesn't exist")));
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
} }
}
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
} }
@ -153,8 +173,15 @@ void ContextALTest::constructMove() {
{ {
Context second{std::move(context)}; Context second{std::move(context)};
CORRADE_COMPARE(&Context::current(), &second); CORRADE_COMPARE(&Context::current(), &second);
#ifdef CORRADE_TARGET_APPLE
if(context.vendorString() == "Apple Computer Inc.")
CORRADE_WARN("Apple's OpenAL implementation returns bogus values. Sometimes. With a random value every call. Skipping the context properties comparison.");
else
#endif
{
CORRADE_COMPARE(second.frequency(), frequency); CORRADE_COMPARE(second.frequency(), frequency);
} }
}
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
} }

Loading…
Cancel
Save