Skip to content
Permalink
Browse files

tests for two additional QgsStyle functions: tag() & symbolHasTag()

  • Loading branch information
nirvn committed Nov 18, 2016
1 parent 5f3ba72 commit 8fcf8345bd22ff6070fce8dbebbc4a8fdd279b49
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/src/core/testqgsstyle.cpp
@@ -301,7 +301,10 @@ void TestStyle::testTags()
id = mStyle->addTag( QStringLiteral( "blue" ) );
QCOMPARE( id, mStyle->tagId( "blue" ) );
id = mStyle->addTag( QStringLiteral( "purple" ) );

//check tagid and tag return values
QCOMPARE( id, mStyle->tagId( "purple" ) );
QCOMPARE( QStringLiteral( "purple" ), mStyle->tag( id ) );

QStringList tags = mStyle->tags();
QCOMPARE( tags.count(), 5 );
@@ -348,6 +351,12 @@ void TestStyle::testTags()
QVERIFY( tags.contains( "red" ) );
QVERIFY( tags.contains( "starry" ) );

//check that a given tag is attached to a symbol
QVERIFY( mStyle->symbolHasTag( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ), QStringLiteral( "blue" ) ) );

//check that a given tag is not attached to a symbol
QCOMPARE( false, mStyle->symbolHasTag( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ), QStringLiteral( "notblue" ) ) );

//remove a tag, including a non-present tag
QVERIFY( mStyle->detagSymbol( QgsStyle::SymbolEntity, "blue starry", QStringList() << "bad" << "blue" ) );
tags = mStyle->tagsOfSymbol( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ) );

0 comments on commit 8fcf834

Please sign in to comment.
You can’t perform that action at this time.