Skip to content

Commit

Permalink
tests for two additional QgsStyle functions: tag() & symbolHasTag()
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 18, 2016
1 parent 5f3ba72 commit 8fcf834
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/src/core/testqgsstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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" ) );
Expand Down

0 comments on commit 8fcf834

Please sign in to comment.