Browse Source

GL: make the Context::makeCurrent() test more robust.

So if it fails somewhere, the current context is reset back.
euler-xxx
Vladimír Vondruš 5 years ago
parent
commit
4de9f75e1c
  1. 9
      src/Magnum/GL/Test/ContextGLTest.cpp

9
src/Magnum/GL/Test/ContextGLTest.cpp

@ -242,9 +242,11 @@ void ContextGLTest::constructConfiguration() {
void ContextGLTest::makeCurrent() { void ContextGLTest::makeCurrent() {
CORRADE_VERIFY(Context::hasCurrent()); CORRADE_VERIFY(Context::hasCurrent());
Context* current = &Context::current();
Context& current = Context::current(); {
Context::makeCurrent(nullptr); Context::makeCurrent(nullptr);
Containers::ScopeGuard resetCurrent{current, Context::makeCurrent};
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
@ -257,11 +259,10 @@ void ContextGLTest::makeCurrent() {
} }
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
}
Context::makeCurrent(&current);
CORRADE_VERIFY(Context::hasCurrent()); CORRADE_VERIFY(Context::hasCurrent());
CORRADE_COMPARE(&Context::current(), &current); CORRADE_COMPARE(&Context::current(), current);
} }
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN

Loading…
Cancel
Save