Skip to content
Permalink
Browse files

add test for flag valuetokeys methods

  • Loading branch information
3nids committed Jul 13, 2020
1 parent ccb3b8e commit 005a4a121775d3cbc06e15745f09e4e46216fb19
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/src/core/testqgis.cpp
@@ -22,6 +22,7 @@
//qgis includes...
#include "qgis.h"
#include "qgsmaplayermodel.h"
#include "qgsattributeeditorelement.h"

/**
* \ingroup UnitTests
@@ -49,6 +50,8 @@ class TestQgis : public QObject
void testQgsVariantEqual();
void testQgsEnumValueToKey();
void testQgsEnumKeyToValue();
void testQgsFlagValueToKeys();
void testQgsFlagKeysToValue();
void testQMapQVariantList();

private:
@@ -411,6 +414,17 @@ void TestQgis::testQgsEnumKeyToValue()
QCOMPARE( qgsEnumKeyToValue<QgsMapLayerModel::ItemDataRole>( QStringLiteral( "UnknownKey" ), QgsMapLayerModel::LayerIdRole ), QgsMapLayerModel::LayerIdRole );
}

void TestQgis::testQgsFlagValueToKeys()
{
QgsAttributeEditorRelation::Buttons buttons = QgsAttributeEditorRelation::Button::Link | QgsAttributeEditorRelation::Button::AddChildFeature;
QCOMPARE( qgsFlagValueToKeys( buttons ), QStringLiteral( "Link|AddChildFeature" ) );
}
void TestQgis::testQgsFlagKeysToValue()
{
QCOMPARE( qgsFlagKeysToValue( QStringLiteral( "Link|AddChildFeature" ), QgsAttributeEditorRelation::Buttons( QgsAttributeEditorRelation::Button::AllButtons ) ), QgsAttributeEditorRelation::Button::Link | QgsAttributeEditorRelation::Button::AddChildFeature );
QCOMPARE( qgsFlagKeysToValue( QStringLiteral( "UnknownKey" ), QgsAttributeEditorRelation::Buttons( QgsAttributeEditorRelation::Button::AllButtons ) ), QgsAttributeEditorRelation::Buttons( QgsAttributeEditorRelation::Button::AllButtons ) );
}

void TestQgis::testQMapQVariantList()
{
QMap<QVariantList, long> ids;

0 comments on commit 005a4a1

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