void WavImporterTest::stereo8() { WavImporter importer; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "stereo8.wav"))); CORRADE_COMPARE(importer.format(), Buffer::Format::Stereo8); CORRADE_COMPARE(importer.frequency(), 96000); Containers::Array<unsigned char> data = importer.data(); CORRADE_COMPARE(data.size(), 4); CORRADE_COMPARE(data[0], 0xde); CORRADE_COMPARE(data[1], 0xfe); CORRADE_COMPARE(data[2], 0xca); CORRADE_COMPARE(data[3], 0x7e); }
void StaticArrayTest::convertStaticViewDerived() { struct A { int i; }; struct B: A {}; /* Valid use case: constructing Containers::ArrayView<Math::Vector<3, Float>> from Containers::ArrayView<Color3> because the data have the same size and data layout */ CORRADE_VERIFY((std::is_convertible<Containers::StaticArray<5, B>, Containers::StaticArrayView<5, A>>::value)); { CORRADE_EXPECT_FAIL("Intentionally not forbidding construction of base array from larger derived type to stay compatible with raw arrays"); struct C: A { int b; }; /* Array of 5 Cs has larger size than array of 5 As so it does not make sense to create the view from it, but we are keeping compatibility with raw arrays and thus allow the users to shoot themselves in a foot. */ CORRADE_VERIFY(!(std::is_convertible<Containers::StaticArray<5, C>, Containers::StaticArrayView<5, A>>::value)); } }
void BufferGLTest::mapRangeExplicitFlush() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported<Extensions::GL::ARB::map_buffer_range>()) CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported")); #elif defined(MAGNUM_TARGET_GLES2) if(!Context::current().isExtensionSupported<Extensions::GL::EXT::map_buffer_range>()) CORRADE_SKIP(Extensions::GL::EXT::map_buffer_range::string() + std::string(" is not supported")); #endif constexpr char data[] = {2, 7, 5, 13, 25}; Buffer buffer; buffer.setData(data, BufferUsage::StaticDraw); /* Map, set byte, don't flush and unmap */ char* contents = buffer.map<char>(1, 4, Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit); CORRADE_VERIFY(contents); contents[2] = 99; CORRADE_VERIFY(buffer.unmap()); MAGNUM_VERIFY_NO_ERROR(); /* Unflushed range _might_ not be changed, thus nothing to test */ /* Map, set byte, flush and unmap */ contents = buffer.map<char>(1, 4, Buffer::MapFlag::Write|Buffer::MapFlag::FlushExplicit); CORRADE_VERIFY(contents); contents[3] = 107; buffer.flushMappedRange(3, 1); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(buffer.unmap()); MAGNUM_VERIFY_NO_ERROR(); /* Flushed range should be changed */ /** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES Containers::Array<char> changedContents = buffer.data<char>(); CORRADE_COMPARE(changedContents.size(), 5); CORRADE_COMPARE(changedContents[4], 107); #endif }
void ArrayTest::customDeleterType() { int data[25]{}; int deletedCount = 0; { Containers::Array<int, CustomDeleter> a{data, 25, CustomDeleter{deletedCount}}; CORRADE_VERIFY(a == data); CORRADE_COMPARE(a.size(), 25); CORRADE_COMPARE(deletedCount, 0); } CORRADE_COMPARE(deletedCount, 25); }
void TextureGLTest::construct() { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>()) CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); { RectangleTexture texture; MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(texture.id() > 0); } MAGNUM_VERIFY_NO_ERROR(); }
void AbstractShaderProgramTest::attributeVectorBGRA() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Vector4> Attribute; CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{})); CORRADE_COMPARE(Attribute::VectorCount, 1); /* BGRA */ Attribute a(Attribute::Components::BGRA); CORRADE_COMPARE(a.vectorSize(), 4*4); #else CORRADE_SKIP("BGRA attribute component ordering is not available in OpenGL ES."); #endif }
void StateMachineTest::signalData() { #ifndef CORRADE_MSVC2015_COMPATIBILITY Implementation::SignalData data1{&StateMachine::entered<State::Start>}; Implementation::SignalData data2{&StateMachine::entered<State::End>}; Implementation::SignalData data3{&StateMachine::exited<State::Start>}; Implementation::SignalData data4{&StateMachine::stepped<State::Start, State::End>}; Implementation::SignalData data5{&StateMachine::stepped<State::End, State::Start>}; #else auto data1 = Implementation::SignalData::create<StateMachine>(&StateMachine::entered<State::Start>); auto data2 = Implementation::SignalData::create<StateMachine>(&StateMachine::entered<State::End>); auto data3 = Implementation::SignalData::create<StateMachine>(&StateMachine::exited<State::Start>); auto data4 = Implementation::SignalData::create<StateMachine>(&StateMachine::stepped<State::Start, State::End>); auto data5 = Implementation::SignalData::create<StateMachine>(&StateMachine::stepped<State::End, State::Start>); #endif CORRADE_VERIFY(data1 != data2); CORRADE_VERIFY(data1 != data3); CORRADE_VERIFY(data4 != data5); }
void AbstractShaderProgramTest::attributeScalarDouble() { #ifndef MAGNUM_TARGET_GLES typedef AbstractShaderProgram::Attribute<3, Double> Attribute; CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{})); CORRADE_COMPARE(Attribute::VectorCount, 1); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.vectorSize(), 8); #else CORRADE_SKIP("Double attributes are not available in OpenGL ES."); #endif }
void ArrayReferenceTest::constReference() { const int a[] = {3, 4, 7, 12, 0, -15}; ConstArrayReference b = a; CORRADE_COMPARE(b.size(), 6); CORRADE_COMPARE(b[2], 7); int c[3]; ArrayReference d = c; ConstArrayReference e = d; CORRADE_VERIFY(e == c); CORRADE_COMPARE(e.size(), 3); }
void WavImporterTest::mono16() { WavImporter importer; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(WAVAUDIOIMPORTER_TEST_DIR, "mono16.wav"))); CORRADE_COMPARE(importer.format(), Buffer::Format::Mono16); CORRADE_COMPARE(importer.frequency(), 44000); Containers::Array<unsigned char> data = importer.data(); CORRADE_COMPARE(data.size(), 4); CORRADE_COMPARE(data[0], 0x1d); CORRADE_COMPARE(data[1], 0x10); CORRADE_COMPARE(data[2], 0x71); CORRADE_COMPARE(data[3], 0xC5); }
void ShapeTest::collides() { Scene3D scene; ShapeGroup3D shapes; Object3D a(&scene); Shape<Shapes::Sphere3D> aShape(a, {{1.0f, -2.0f, 3.0f}, 1.5f}, &shapes); { /* Collision with point inside the sphere */ Shape<Shapes::Point3D> aShape2(a, {{1.0f, -2.0f, 3.0f}}, &shapes); shapes.setClean(); CORRADE_VERIFY(aShape.collides(aShape2)); } { /* No collision with point inside the sphere, but not in the same group */ ShapeGroup3D shapes2; Shape<Shapes::Point3D> aShape3(a, {{1.0f, -2.0f, 3.0f}}, &shapes2); shapes2.setClean(); CORRADE_VERIFY(!aShape.collides(aShape3)); } { CORRADE_EXPECT_FAIL("Should cross-scene collision work or not?"); /* No collision with point inside the sphere, but not in the same scene */ Scene3D scene2; Object3D c(&scene2); Shape<Shapes::Point3D> cShape(c, {{1.0f, -2.0f, 3.0f}}, &shapes); shapes.setClean(); CORRADE_VERIFY(!aShape.collides(cShape)); } { /* No collision with point outside of the sphere */ Object3D b(&scene); Shape<Shapes::Point3D> bShape(b, {{3.0f, -2.0f, 3.0f}}, &shapes); shapes.setClean(); CORRADE_VERIFY(!aShape.collides(bShape)); /* Move point inside the sphere -- collision */ b.translate(Vector3::xAxis(-1.0f)); shapes.setClean(); CORRADE_VERIFY(aShape.collides(bShape)); } }
void RigidMatrixTransformation2DTest::setTransformation() { Object2D o; /* Can't transform with non-rigid transformation */ std::ostringstream out; Error::setOutput(&out); o.setTransformation(Matrix3::scaling(Vector2(3.0f))); CORRADE_COMPARE(out.str(), "SceneGraph::RigidMatrixTransformation2D::setTransformation(): the matrix doesn't represent rigid transformation\n"); /* Dirty after setting transformation */ o.setClean(); CORRADE_VERIFY(!o.isDirty()); o.setTransformation(Matrix3::rotation(Deg(17.0f))); CORRADE_VERIFY(o.isDirty()); CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f))); /* Scene cannot be transformed */ Scene2D s; s.setClean(); s.setTransformation(Matrix3::rotation(Deg(17.0f))); CORRADE_VERIFY(!s.isDirty()); CORRADE_COMPARE(s.transformationMatrix(), Matrix3()); }
void ArgumentsTest::prefixedParse() { Arguments arg1; arg1.addArgument("file") .addBooleanOption('b', "binary") .addOption("speed") .addSkippedPrefix("read"); Arguments arg2{"read"}; arg2.addOption("behavior") .addOption("buffer-size"); const char* argv[] = { "", "-b", "--read-behavior", "buffered", "--speed", "fast", "--binary", "--read-buffer-size", "4K", "file.dat" }; const int argc = std::extent<decltype(argv)>(); CORRADE_VERIFY(arg1.tryParse(argc, argv)); CORRADE_VERIFY(arg1.isSet("binary")); CORRADE_COMPARE(arg1.value("speed"), "fast"); CORRADE_COMPARE(arg1.value("file"), "file.dat"); CORRADE_VERIFY(arg2.tryParse(argc, argv)); CORRADE_COMPARE(arg2.value("behavior"), "buffered"); CORRADE_COMPARE(arg2.value("buffer-size"), "4K"); }
void ArgumentsTest::parseArguments() { Arguments args; args.addArgument("name") .addArgument("input") .addArgument("output"); const char* argv[] = { "", "hello", "in.txt", "out.bin" }; const int argc = std::extent<decltype(argv)>(); CORRADE_VERIFY(args.tryParse(argc, argv)); CORRADE_COMPARE(args.value("name"), "hello"); CORRADE_COMPARE(args.value("input"), "in.txt"); CORRADE_COMPARE(args.value("output"), "out.bin"); }
void QuaternionTest::convert() { constexpr Quat a{1.5f, -3.5f, 7.0f, -0.5f}; constexpr Quaternion b{{1.5f, -3.5f, 7.0f}, -0.5f}; /* GCC 5.1 fills the result with zeros instead of properly calling delegated copy constructor if using constexpr. Reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */ #if !defined(__GNUC__) || defined(__clang__) constexpr #endif Quaternion c {a}; CORRADE_COMPARE(c, b); constexpr Quat d(b); CORRADE_COMPARE(d.x, a.x); CORRADE_COMPARE(d.y, a.y); CORRADE_COMPARE(d.z, a.z); CORRADE_COMPARE(d.w, a.w); /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible<Quat, Quaternion>::value)); CORRADE_VERIFY(!(std::is_convertible<Quaternion, Quat>::value)); }
void ContextGLTest::isExtensionSupported() { #ifndef MAGNUM_TARGET_GLES if(Context::current()->isExtensionSupported<Extensions::GL::GREMEDY::string_marker>()) CORRADE_SKIP(Extensions::GL::GREMEDY::string_marker::string() + std::string(" extension should not be supported, can't test")); if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_filter_anisotropic>()) CORRADE_SKIP(Extensions::GL::EXT::texture_filter_anisotropic::string() + std::string(" extension should be supported, can't test")); if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>()) CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test")); /* Test that we have proper extension list parser */ std::string extensions(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); CORRADE_VERIFY(extensions.find(Extensions::GL::EXT::texture_filter_anisotropic::string()) != std::string::npos); CORRADE_VERIFY(extensions.find(Extensions::GL::GREMEDY::string_marker::string()) == std::string::npos); /* This is disabled in GL < 3.2 to work around GLSL compiler bugs */ CORRADE_VERIFY(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL310)); CORRADE_VERIFY(Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL320)); #else CORRADE_SKIP("No useful extensions to test on OpenGL ES"); #endif }
void AbstractShaderProgramTest::attributeVector4() { typedef Attribute<3, Vector4> Attribute; CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Float>{})); CORRADE_COMPARE(Attribute::VectorCount, 1); /* Custom type */ #ifndef MAGNUM_TARGET_GLES Attribute a(Attribute::DataType::UnsignedInt2101010Rev); CORRADE_COMPARE(a.vectorSize(), 4); #else Attribute a(Attribute::DataType::HalfFloat); CORRADE_COMPARE(a.vectorSize(), 8); #endif }
void DualComplexTransformationTest::setTransformation() { Object2D o; /* Can't transform with non-rigid transformation */ std::ostringstream out; Error::setOutput(&out); o.setTransformation(DualComplex({1.0f, 2.0f}, {})); CORRADE_COMPARE(out.str(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized\n"); /* Dirty after setting transformation */ o.setClean(); CORRADE_VERIFY(!o.isDirty()); o.setTransformation(DualComplex::rotation(Deg(17.0f))); CORRADE_VERIFY(o.isDirty()); CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f))); /* Scene cannot be transformed */ Scene2D s; s.setClean(); s.setTransformation(DualComplex::rotation(Deg(17.0f))); CORRADE_VERIFY(!s.isDirty()); CORRADE_COMPARE(s.transformationMatrix(), Matrix3()); }
void StaticArrayViewTest::access() { int a[7]; StaticArrayView<7> b = a; for(std::size_t i = 0; i != 7; ++i) b[i] = i; CORRADE_VERIFY(b.data() == a); CORRADE_COMPARE(*(b.begin()+2), 2); CORRADE_COMPARE(b[4], 4); CORRADE_COMPARE(b.end()-b.begin(), 7); ConstStaticArrayView<7> c = a; CORRADE_COMPARE(c.data(), a); }
void TgaImporterTest::colorBits32() { TgaImporter importer; const char data[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 32, 0, 1, 2, 3, 1, 2, 3, 4, 1, 3, 4, 5, 1, 4, 5, 6, 1, 5, 6, 7, 1, 6, 7, 8, 1 }; const char pixels[] = { 3, 2, 1, 1, 4, 3, 2, 1, 5, 4, 3, 1, 6, 5, 4, 1, 7, 6, 5, 1, 8, 7, 6, 1 }; CORRADE_VERIFY(importer.openData(data)); std::optional<Trade::ImageData2D> image = importer.image2D(0); CORRADE_VERIFY(image); CORRADE_COMPARE(image->format(), ColorFormat::RGBA); CORRADE_COMPARE(image->size(), Vector2i(2, 3)); CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); CORRADE_COMPARE((std::string{image->data(), 2*3*3}), (std::string{pixels, 2*3*3})); }
void DdsImporterTest::rgbVolume() { DdsImporter importer; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(DDSIMPORTER_TEST_DIR, "rgb_uncompressed_volume.dds"))); const char pixels[] = { /* slice 0 */ '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', /* slice 1 */ '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', /* slice 2 */ '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77', '\xde', '\xad', '\xb5', '\xca', '\xfe', '\x77'}; std::optional<Trade::ImageData3D> image = importer.image3D(0); CORRADE_VERIFY(image); CORRADE_VERIFY(!image->isCompressed()); CORRADE_COMPARE(image->storage().alignment(), 1); CORRADE_COMPARE(image->size(), Vector3i(3, 2, 3)); CORRADE_COMPARE(image->format(), PixelFormat::RGB); CORRADE_COMPARE(image->type(), PixelType::UnsignedByte); CORRADE_COMPARE_AS(image->data(), Containers::ArrayView<const char>(pixels), TestSuite::Compare::Container); }
void BufferImageGLTest::constructMove() { const char data[4] = { 'a', 'b', 'c', 'd' }; BufferImage2D a{PixelFormat::Red, PixelType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw}; const Int id = a.buffer().id(); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(id > 0); BufferImage2D b(std::move(a)); CORRADE_COMPARE(a.buffer().id(), 0); CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_COMPARE(b.storage().alignment(), 4); CORRADE_COMPARE(b.format(), PixelFormat::Red); CORRADE_COMPARE(b.type(), PixelType::UnsignedByte); CORRADE_COMPARE(b.size(), Vector2i(4, 1)); CORRADE_COMPARE(b.buffer().id(), id); const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; BufferImage2D c{PixelStorage{}.setAlignment(1), PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw}; const Int cId = c.buffer().id(); c = std::move(b); MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(cId > 0); CORRADE_COMPARE(b.buffer().id(), cId); CORRADE_COMPARE(b.size(), Vector2i(1, 2)); CORRADE_COMPARE(c.storage().alignment(), 4); CORRADE_COMPARE(c.format(), PixelFormat::Red); CORRADE_COMPARE(c.type(), PixelType::UnsignedByte); CORRADE_COMPARE(c.size(), Vector2i(4, 1)); CORRADE_COMPARE(c.buffer().id(), id); }
void DualQuaternionTransformationTest::setTransformation() { Object3D o; /* Can't transform with non-rigid transformation */ std::ostringstream out; Error redirectError{&out}; o.setTransformation(DualQuaternion({{1.0f, 2.0f, 3.0f}, 4.0f}, {})); CORRADE_COMPARE(out.str(), "SceneGraph::DualQuaternionTransformation::setTransformation(): the dual quaternion is not normalized\n"); /* Dirty after setting transformation */ o.setClean(); CORRADE_VERIFY(!o.isDirty()); o.setTransformation(DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis())); CORRADE_VERIFY(o.isDirty()); CORRADE_COMPARE(o.transformationMatrix(), Matrix4::rotationX(Deg(17.0f))); /* Scene cannot be transformed */ Scene3D s; s.setClean(); CORRADE_VERIFY(!s.isDirty()); s.setTransformation(DualQuaternion::rotation(Deg(17.0f), Vector3::xAxis())); CORRADE_VERIFY(!s.isDirty()); CORRADE_COMPARE(s.transformationMatrix(), Matrix4()); }
void ContainerTest::outputExpectedSmaller() { std::stringstream out; std::vector<int> a{1, 2, 3, 4}; std::vector<int> b{1, 2, 3}; { Error e(&out); Comparator<Compare::Container<std::vector<int>>> compare; CORRADE_VERIFY(!compare(a, b)); compare.printErrorMessage(e, "a", "b"); } CORRADE_COMPARE(out.str(), "Containers a and b have different size, actual 4 but 3 expected. Actual has 4 on position 3.\n"); }
void ContainerTest::output() { std::stringstream out; std::vector<int> a{1, 9, 3, 4}; std::vector<int> b{1, 2, 3, 4}; { Error e(&out); Comparator<Compare::Container<std::vector<int>>> compare; CORRADE_VERIFY(!compare(a, b)); compare.printErrorMessage(e, "a", "b"); } CORRADE_COMPARE(out.str(), "Containers a and b have different contents. Actual 9 but 2 expected on position 1.\n"); }
void DualComplexTest::invertedNormalized() { DualComplex a({-0.316228f, 0.9486831f}, { 3.0f, -2.5f}); DualComplex b({-0.316228f, -0.9486831f}, {3.320391f, 2.05548f}); std::ostringstream o; Error::setOutput(&o); DualComplex notInverted = DualComplex({-1.0f, -2.5f}, {}).invertedNormalized(); CORRADE_VERIFY(notInverted != notInverted); CORRADE_COMPARE(o.str(), "Math::Complex::invertedNormalized(): complex number must be normalized\n"); DualComplex inverted = a.invertedNormalized(); CORRADE_COMPARE(a*inverted, DualComplex()); CORRADE_COMPARE(inverted*a, DualComplex()); CORRADE_COMPARE(inverted, b); }
void Test::crossManagerDependencies() { PluginManager::Manager<AbstractAnimal> manager(PLUGINS_DIR); PluginManager::Manager<AbstractFood> foodManager(Directory::join(PLUGINS_DIR, "food")); #if defined(CORRADE_TARGET_NACL_NEWLIB) || defined(CORRADE_TARGET_EMSCRIPTEN) CORRADE_SKIP("Cross-manager dependencies are meaningful only for dynamic plugins"); #else /* Load HotDog */ CORRADE_COMPARE(foodManager.load("HotDog"), LoadState::Loaded); CORRADE_COMPARE(manager.loadState("Dog"), LoadState::Loaded); CORRADE_COMPARE(foodManager.metadata("HotDog")->depends().size(), 1); CORRADE_COMPARE(foodManager.metadata("HotDog")->depends()[0], "Dog"); CORRADE_COMPARE(manager.metadata("Dog")->usedBy().size(), 1); CORRADE_COMPARE(manager.metadata("Dog")->usedBy()[0], "HotDog"); { /* Verify hotdog */ std::unique_ptr<AbstractFood> hotdog = foodManager.instance("HotDog"); CORRADE_VERIFY(hotdog); CORRADE_VERIFY(!hotdog->isTasty()); CORRADE_COMPARE(hotdog->weight(), 6800); /* Try to unload dog while dog is used in hotdog */ CORRADE_COMPARE(manager.unload("Dog"), LoadState::Required); } /* After destroying hotdog try again */ CORRADE_COMPARE(foodManager.unload("HotDog"), LoadState::NotLoaded); CORRADE_COMPARE(manager.unload("Dog"), LoadState::NotLoaded); CORRADE_VERIFY(manager.metadata("Dog")->usedBy().empty()); #endif /* Verify that the plugin can be instanced only through its own manager */ CORRADE_VERIFY(manager.instance("Canary")); CORRADE_VERIFY(!foodManager.instance("Canary")); }
void AbstractQueryGLTest::construct() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>()) CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported.")); #endif { const SampleQuery query; MAGNUM_VERIFY_NO_ERROR(); CORRADE_VERIFY(query.id() > 0); } MAGNUM_VERIFY_NO_ERROR(); }
void ConfigurationTest::copy() { Configuration conf; ConfigurationGroup* original = conf.addGroup("group"); original->addGroup("descendent")->setValue<int>("value", 42); ConfigurationGroup* constructedCopy = new ConfigurationGroup(*original); CORRADE_VERIFY(!constructedCopy->configuration()); CORRADE_VERIFY(!constructedCopy->group("descendent")->configuration()); ConfigurationGroup* assignedCopy = conf.addGroup("another"); CORRADE_VERIFY(assignedCopy->configuration() == &conf); *assignedCopy = *original; CORRADE_VERIFY(assignedCopy->configuration() == &conf); CORRADE_VERIFY(assignedCopy->group("descendent")->configuration() == &conf); original->group("descendent")->setValue<int>("value", 666); CORRADE_COMPARE(original->group("descendent")->value<int>("value"), 666); CORRADE_COMPARE(constructedCopy->group("descendent")->value<int>("value"), 42); CORRADE_COMPARE(assignedCopy->group("descendent")->value<int>("value"), 42); delete constructedCopy; }
void AbstractShaderProgramTest::attributeMatrixMxNd() { #ifndef MAGNUM_TARGET_GLES typedef Attribute<3, Matrix4x2d> Attribute; CORRADE_VERIFY((std::is_same<Attribute::ScalarType, Double>{})); CORRADE_COMPARE(Attribute::VectorCount, 4); /* Default constructor */ Attribute a; CORRADE_COMPARE(a.components(), Attribute::Components::Two); CORRADE_COMPARE(a.vectorSize(), 2*8); CORRADE_COMPARE(a.dataType(), Attribute::DataType::Double); #else CORRADE_SKIP("Double attributes are not available in OpenGL ES."); #endif }