Browse Source

Test that Context is only move-constructible.

pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
e6965e7131
  1. 14
      src/Magnum/Test/ContextGLTest.cpp

14
src/Magnum/Test/ContextGLTest.cpp

@ -32,6 +32,8 @@ namespace Magnum { namespace Test {
struct ContextGLTest: AbstractOpenGLTester { struct ContextGLTest: AbstractOpenGLTester {
explicit ContextGLTest(); explicit ContextGLTest();
void constructCopyMove();
void isVersionSupported(); void isVersionSupported();
void supportedVersion(); void supportedVersion();
void isExtensionSupported(); void isExtensionSupported();
@ -39,12 +41,22 @@ struct ContextGLTest: AbstractOpenGLTester {
}; };
ContextGLTest::ContextGLTest() { ContextGLTest::ContextGLTest() {
addTests({&ContextGLTest::isVersionSupported, addTests({&ContextGLTest::constructCopyMove,
&ContextGLTest::isVersionSupported,
&ContextGLTest::supportedVersion, &ContextGLTest::supportedVersion,
&ContextGLTest::isExtensionSupported, &ContextGLTest::isExtensionSupported,
&ContextGLTest::isExtensionDisabled}); &ContextGLTest::isExtensionDisabled});
} }
void ContextGLTest::constructCopyMove() {
/* Only move-construction allowed */
CORRADE_VERIFY(!(std::is_constructible<Context, const Context&>{}));
CORRADE_VERIFY((std::is_constructible<Context, Context&&>{}));
CORRADE_VERIFY(!(std::is_assignable<Context, const Context&>{}));
CORRADE_VERIFY(!(std::is_assignable<Context, Context&&>{}));
}
void ContextGLTest::isVersionSupported() { void ContextGLTest::isVersionSupported() {
const Version v = Context::current()->version(); const Version v = Context::current()->version();
CORRADE_VERIFY(Context::current()->isVersionSupported(v)); CORRADE_VERIFY(Context::current()->isVersionSupported(v));

Loading…
Cancel
Save