Browse Source

Audio: test the quiet logging.

pull/364/head
Vladimír Vondruš 7 years ago
parent
commit
922ff64869
  1. 21
      src/Magnum/Audio/Test/ContextALTest.cpp

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

@ -24,6 +24,8 @@
DEALINGS IN THE SOFTWARE.
*/
#include <sstream>
#include <Corrade/Containers/ArrayView.h>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Extensions.h"
@ -37,15 +39,19 @@ struct ContextALTest: TestSuite::Tester {
void construct();
void constructMove();
void quietLog();
void extensionsString();
void isExtensionEnabled();
};
ContextALTest::ContextALTest() {
addTests({&ContextALTest::construct,
&ContextALTest::constructMove,
&ContextALTest::constructMove});
addInstancedTests({&ContextALTest::quietLog}, 2);
&ContextALTest::extensionsString,
addTests({&ContextALTest::extensionsString,
&ContextALTest::isExtensionEnabled});
}
@ -73,6 +79,17 @@ void ContextALTest::constructMove() {
CORRADE_VERIFY(!Context::hasCurrent());
}
void ContextALTest::quietLog() {
setTestCaseDescription(testCaseInstanceId() ? "true" : "false");
const char* argv[] = { "", "--magnum-log", testCaseInstanceId() ? "quiet" : "default" };
std::ostringstream out;
Debug redirectOutput{&out};
Context context{Containers::arraySize(argv), argv};
CORRADE_COMPARE(out.str().empty(), bool(testCaseInstanceId()));
}
void ContextALTest::extensionsString() {
Context context;

Loading…
Cancel
Save