Exemplo n.º 1
0
void TestQgsPaintEffectRegistry::addEffect()
{
  //create an empty registry
  QgsPaintEffectRegistry* registry = QgsApplication::paintEffectRegistry();
  int previousCount = registry->effects().length();

  registry->addEffectType( new QgsPaintEffectMetadata( QStringLiteral( "Dummy" ), QStringLiteral( "Dummy effect" ), DummyPaintEffect::create ) );
  QCOMPARE( registry->effects().length(), previousCount + 1 );
  //try adding again, should have no effect
  registry->addEffectType( new QgsPaintEffectMetadata( QStringLiteral( "Dummy" ), QStringLiteral( "Dummy effect" ), DummyPaintEffect::create ) );
  QCOMPARE( registry->effects().length(), previousCount + 1 );

  //try adding empty metadata
  registry->addEffectType( nullptr );
  QCOMPARE( registry->effects().length(), previousCount + 1 );
}
Exemplo n.º 2
0
void TestQgsPaintEffectRegistry::addEffect()
{
  //create an empty registry
  QgsPaintEffectRegistry* registry = QgsPaintEffectRegistry::instance();
  int previousCount = registry->effects().length();

  registry->addEffectType( new QgsPaintEffectMetadata( "Dummy", "Dummy effect", DummyPaintEffect::create ) );
  QCOMPARE( registry->effects().length(), previousCount + 1 );
  //try adding again, should have no effect
  registry->addEffectType( new QgsPaintEffectMetadata( "Dummy", "Dummy effect", DummyPaintEffect::create ) );
  QCOMPARE( registry->effects().length(), previousCount + 1 );

  //try adding empty metadata
  registry->addEffectType( nullptr );
  QCOMPARE( registry->effects().length(), previousCount + 1 );
}