diff --git a/src/Magnum/GL/Test/MeshGLTest.cpp b/src/Magnum/GL/Test/MeshGLTest.cpp index 71161a151..c7fd6e910 100644 --- a/src/Magnum/GL/Test/MeshGLTest.cpp +++ b/src/Magnum/GL/Test/MeshGLTest.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -66,6 +67,8 @@ struct MeshGLTest: OpenGLTester { void constructMove(); void wrap(); + void destructMovedOutInstance(); + template void primitive(); #ifndef MAGNUM_TARGET_WEBGL @@ -552,6 +555,8 @@ MeshGLTest::MeshGLTest() { &MeshGLTest::constructMove, &MeshGLTest::wrap, + &MeshGLTest::destructMovedOutInstance, + &MeshGLTest::primitive, &MeshGLTest::primitive, @@ -913,6 +918,23 @@ void MeshGLTest::wrap() { #endif } +void MeshGLTest::destructMovedOutInstance() { + { + Containers::ScopeGuard restoreCurrentContext{&GL::Context::current(), GL::Context::makeCurrent}; + + Mesh a = Mesh::wrap(0xabcd); + CORRADE_COMPARE(a.id(), 0xabcd); + + a = Mesh{NoCreate}; + CORRADE_COMPARE(a.id(), 0); + + GL::Context::makeCurrent(nullptr); + } + + /* It shouldn't try to access the current context to decide anything */ + CORRADE_VERIFY(true); +} + template void MeshGLTest::primitive() { setTestCaseTemplateName(std::is_same::value ? "GL::MeshPrimitive" : "Magnum::MeshPrimitive");