diff --git a/src/Magnum/Text/GlyphCache.cpp b/src/Magnum/Text/GlyphCache.cpp index 0e0c03dea..22ad1ee51 100644 --- a/src/Magnum/Text/GlyphCache.cpp +++ b/src/Magnum/Text/GlyphCache.cpp @@ -63,8 +63,6 @@ GlyphCache::GlyphCache(const Vector2i& originalSize, const Vector2i& size, const #endif } -GlyphCache::~GlyphCache() = default; - GlyphCacheFeatures GlyphCache::doFeatures() const { return {}; } void GlyphCache::doSetImage(const Vector2i& offset, const ImageView2D& image) { diff --git a/src/Magnum/Text/GlyphCache.h b/src/Magnum/Text/GlyphCache.h index 291762b9b..7171f4084 100644 --- a/src/Magnum/Text/GlyphCache.h +++ b/src/Magnum/Text/GlyphCache.h @@ -109,8 +109,6 @@ class MAGNUM_TEXT_EXPORT GlyphCache: public AbstractGlyphCache { */ explicit GlyphCache(const Vector2i& size, const Vector2i& padding = {}); - ~GlyphCache(); - /** @brief Cache texture */ GL::Texture2D& texture() { return _texture; } diff --git a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp index d9adc437b..2b56dd78a 100644 --- a/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/DistanceFieldGlyphCacheGLTest.cpp @@ -54,7 +54,10 @@ namespace Magnum { namespace Text { namespace Test { namespace { struct DistanceFieldGlyphCacheGLTest: GL::OpenGLTester { explicit DistanceFieldGlyphCacheGLTest(); - void initialize(); + void construct(); + + void constructCopy(); + void constructMove(); void setImage(); @@ -78,7 +81,10 @@ const struct { }; DistanceFieldGlyphCacheGLTest::DistanceFieldGlyphCacheGLTest() { - addTests({&DistanceFieldGlyphCacheGLTest::initialize}); + addTests({&DistanceFieldGlyphCacheGLTest::construct, + + &DistanceFieldGlyphCacheGLTest::constructCopy, + &DistanceFieldGlyphCacheGLTest::constructMove}); addInstancedTests({&DistanceFieldGlyphCacheGLTest::setImage}, Containers::arraySize(SetImageData)); @@ -96,7 +102,7 @@ DistanceFieldGlyphCacheGLTest::DistanceFieldGlyphCacheGLTest() { #endif } -void DistanceFieldGlyphCacheGLTest::initialize() { +void DistanceFieldGlyphCacheGLTest::construct() { DistanceFieldGlyphCache cache{{1024, 2048}, {128, 256}, 16}; MAGNUM_VERIFY_NO_GL_ERROR(); @@ -107,6 +113,25 @@ void DistanceFieldGlyphCacheGLTest::initialize() { #endif } +void DistanceFieldGlyphCacheGLTest::constructCopy() { + CORRADE_VERIFY(!std::is_copy_constructible{}); + CORRADE_VERIFY(!std::is_copy_assignable{}); +} + +void DistanceFieldGlyphCacheGLTest::constructMove() { + DistanceFieldGlyphCache a{{1024, 512}, {128, 64}, 3}; + + DistanceFieldGlyphCache b = Utility::move(a); + CORRADE_COMPARE(b.size(), (Vector3i{1024, 512, 1})); + + DistanceFieldGlyphCache c{{2, 3}, {1, 1}, 1}; + c = Utility::move(b); + CORRADE_COMPARE(c.size(), (Vector3i{1024, 512, 1})); + + CORRADE_VERIFY(std::is_nothrow_move_constructible::value); + CORRADE_VERIFY(std::is_nothrow_move_assignable::value); +} + void DistanceFieldGlyphCacheGLTest::setImage() { auto&& data = SetImageData[testCaseInstanceId()]; setTestCaseDescription(data.name); diff --git a/src/Magnum/Text/Test/GlyphCacheGLTest.cpp b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp index d5b5fbe0e..8bdcef939 100644 --- a/src/Magnum/Text/Test/GlyphCacheGLTest.cpp +++ b/src/Magnum/Text/Test/GlyphCacheGLTest.cpp @@ -45,22 +45,28 @@ namespace Magnum { namespace Text { namespace Test { namespace { struct GlyphCacheGLTest: GL::OpenGLTester { explicit GlyphCacheGLTest(); - void initialize(); - void initializeCustomFormat(); + void construct(); + void constructCustomFormat(); + + void constructCopy(); + void constructMove(); void setImage(); void setImageCustomFormat(); }; GlyphCacheGLTest::GlyphCacheGLTest() { - addTests({&GlyphCacheGLTest::initialize, - &GlyphCacheGLTest::initializeCustomFormat, + addTests({&GlyphCacheGLTest::construct, + &GlyphCacheGLTest::constructCustomFormat, + + &GlyphCacheGLTest::constructCopy, + &GlyphCacheGLTest::constructMove, &GlyphCacheGLTest::setImage, &GlyphCacheGLTest::setImageCustomFormat}); } -void GlyphCacheGLTest::initialize() { +void GlyphCacheGLTest::construct() { GlyphCache cache{{1024, 2048}}; MAGNUM_VERIFY_NO_GL_ERROR(); @@ -70,7 +76,7 @@ void GlyphCacheGLTest::initialize() { #endif } -void GlyphCacheGLTest::initializeCustomFormat() { +void GlyphCacheGLTest::constructCustomFormat() { GlyphCache cache{ #ifndef MAGNUM_TARGET_GLES2 GL::TextureFormat::RGBA8, @@ -86,6 +92,25 @@ void GlyphCacheGLTest::initializeCustomFormat() { #endif } +void GlyphCacheGLTest::constructCopy() { + CORRADE_VERIFY(!std::is_copy_constructible{}); + CORRADE_VERIFY(!std::is_copy_assignable{}); +} + +void GlyphCacheGLTest::constructMove() { + GlyphCache a{{1024, 512}}; + + GlyphCache b = Utility::move(a); + CORRADE_COMPARE(b.size(), (Vector3i{1024, 512, 1})); + + GlyphCache c{{2, 3}}; + c = Utility::move(b); + CORRADE_COMPARE(c.size(), (Vector3i{1024, 512, 1})); + + CORRADE_VERIFY(std::is_nothrow_move_constructible::value); + CORRADE_VERIFY(std::is_nothrow_move_assignable::value); +} + const UnsignedByte InputData[]{ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,