From e6965e713186501de057bbf5425f1d5f6e0c35d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 20 Jun 2015 16:15:57 +0200 Subject: [PATCH] Test that Context is only move-constructible. --- src/Magnum/Test/ContextGLTest.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Test/ContextGLTest.cpp b/src/Magnum/Test/ContextGLTest.cpp index 5a05b6bee..d51c12b22 100644 --- a/src/Magnum/Test/ContextGLTest.cpp +++ b/src/Magnum/Test/ContextGLTest.cpp @@ -32,6 +32,8 @@ namespace Magnum { namespace Test { struct ContextGLTest: AbstractOpenGLTester { explicit ContextGLTest(); + void constructCopyMove(); + void isVersionSupported(); void supportedVersion(); void isExtensionSupported(); @@ -39,12 +41,22 @@ struct ContextGLTest: AbstractOpenGLTester { }; ContextGLTest::ContextGLTest() { - addTests({&ContextGLTest::isVersionSupported, + addTests({&ContextGLTest::constructCopyMove, + + &ContextGLTest::isVersionSupported, &ContextGLTest::supportedVersion, &ContextGLTest::isExtensionSupported, &ContextGLTest::isExtensionDisabled}); } +void ContextGLTest::constructCopyMove() { + /* Only move-construction allowed */ + CORRADE_VERIFY(!(std::is_constructible{})); + CORRADE_VERIFY((std::is_constructible{})); + CORRADE_VERIFY(!(std::is_assignable{})); + CORRADE_VERIFY(!(std::is_assignable{})); +} + void ContextGLTest::isVersionSupported() { const Version v = Context::current()->version(); CORRADE_VERIFY(Context::current()->isVersionSupported(v));