Browse Source

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

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

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

@ -78,14 +78,21 @@ void ContextALTest::constructDefault() {
CORRADE_COMPARE(&Context::current(), &context); CORRADE_COMPARE(&Context::current(), &context);
/* Verify the queries make sense */ /* Verify the queries make sense */
CORRADE_COMPARE_AS(context.frequency(), 10000, #ifdef CORRADE_TARGET_APPLE
TestSuite::Compare::Greater); if(context.vendorString() == "Apple Computer Inc.")
CORRADE_COMPARE_AS(context.monoSourceCount(), 2, CORRADE_WARN("Apple's OpenAL implementation returns bogus values. Sometimes. With a random value every call. Skipping the context properties comparison.");
TestSuite::Compare::GreaterOrEqual); else
CORRADE_COMPARE_AS(context.stereoSourceCount(), 1, #endif
TestSuite::Compare::GreaterOrEqual); {
CORRADE_COMPARE_AS(context.refreshRate(), 10, CORRADE_COMPARE_AS(context.frequency(), 10000,
TestSuite::Compare::Greater); TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(context.monoSourceCount(), 2,
TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(context.stereoSourceCount(), 1,
TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(context.refreshRate(), 10,
TestSuite::Compare::Greater);
}
} }
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
@ -109,13 +116,20 @@ 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. */
CORRADE_COMPARE_AS(context.frequency(), 22050, #ifdef CORRADE_TARGET_APPLE
TestSuite::Compare::GreaterOrEqual); if(context.vendorString() == "Apple Computer Inc.")
CORRADE_COMPARE_AS(context.monoSourceCount(), 5, CORRADE_WARN("Apple's OpenAL implementation returns bogus values. Sometimes. With a random value every call. Skipping the context properties comparison.");
TestSuite::Compare::GreaterOrEqual); else
CORRADE_COMPARE(context.stereoSourceCount(), 4); #endif
CORRADE_COMPARE_AS(context.refreshRate(), 25, {
TestSuite::Compare::GreaterOrEqual); CORRADE_COMPARE_AS(context.frequency(), 22050,
TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(context.monoSourceCount(), 5,
TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE(context.stereoSourceCount(), 4);
CORRADE_COMPARE_AS(context.refreshRate(), 25,
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,9 +151,15 @@ void ContextALTest::constructDeviceNotFound() {
{ {
Context context{NoCreate, arguments().first, arguments().second}; Context context{NoCreate, arguments().first, arguments().second};
CORRADE_VERIFY(!context.tryCreate(Context::Configuration{} {
.setDeviceSpecifier("hello this definitely doesn't exist"))); #ifdef CORRADE_TARGET_APPLE
CORRADE_VERIFY(!Context::hasCurrent()); 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{}
.setDeviceSpecifier("hello this definitely doesn't exist")));
CORRADE_VERIFY(!Context::hasCurrent());
}
} }
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
@ -153,7 +173,14 @@ void ContextALTest::constructMove() {
{ {
Context second{std::move(context)}; Context second{std::move(context)};
CORRADE_COMPARE(&Context::current(), &second); CORRADE_COMPARE(&Context::current(), &second);
CORRADE_COMPARE(second.frequency(), frequency); #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_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());

Loading…
Cancel
Save