From e435401f0051b2cd374653e41767887eccdd1f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 8 Aug 2023 13:25:42 +0200 Subject: [PATCH] Audio: test Context creation failure. --- src/Magnum/Audio/Test/ContextALTest.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Magnum/Audio/Test/ContextALTest.cpp b/src/Magnum/Audio/Test/ContextALTest.cpp index 18cc72575..7ec53567c 100644 --- a/src/Magnum/Audio/Test/ContextALTest.cpp +++ b/src/Magnum/Audio/Test/ContextALTest.cpp @@ -39,6 +39,7 @@ struct ContextALTest: TestSuite::Tester { void constructDefault(); void constructConfiguration(); + void constructDeviceNotFound(); void constructMove(); void quietLog(); @@ -56,6 +57,7 @@ ContextALTest::ContextALTest(): { addTests({&ContextALTest::constructDefault, &ContextALTest::constructConfiguration, + &ContextALTest::constructDeviceNotFound, &ContextALTest::constructMove}); addInstancedTests({&ContextALTest::quietLog}, 2); @@ -130,6 +132,19 @@ void ContextALTest::constructConfiguration() { CORRADE_VERIFY(!Context::hasCurrent()); } +void ContextALTest::constructDeviceNotFound() { + CORRADE_VERIFY(!Context::hasCurrent()); + + { + Context context{NoCreate, arguments().first, arguments().second}; + CORRADE_VERIFY(!context.tryCreate(Context::Configuration{} + .setDeviceSpecifier("hello this definitely doesn't exist"))); + CORRADE_VERIFY(!Context::hasCurrent()); + } + + CORRADE_VERIFY(!Context::hasCurrent()); +} + void ContextALTest::constructMove() { Context context; CORRADE_COMPARE(&Context::current(), &context);