Skip to content

Commit

Permalink
test for original createFileFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jan 27, 2015
1 parent d7bef1c commit d6c969c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgisgui.cpp
Expand Up @@ -182,8 +182,8 @@ namespace QgisGui

QString createFileFilter_( QString const &format )
{
QString longName = format + " format";
QString glob = "*" + format;
QString longName = format.toUpper() + " format";
QString glob = "*." + format;
return createFileFilter_( longName, glob );
}

Expand Down
13 changes: 11 additions & 2 deletions tests/src/gui/testqgsgui.cpp
Expand Up @@ -20,14 +20,23 @@ class TestQgsGui : public QObject
{
Q_OBJECT
private slots:
void createFileFilterForFormat();
void createFileFilter();

};

void TestQgsGui::createFileFilter()
void TestQgsGui::createFileFilterForFormat()
{
QString expected = "FOO format (*.foo *.FOO)";
QString actual = QgisGui::createFileFilter_("foo");;
QString actual = QgisGui::createFileFilter_("foo");

QCOMPARE( actual, expected );
}

void TestQgsGui::createFileFilter()
{
QString expected = "My Description (my_regex MY_REGEX)";
QString actual = QgisGui::createFileFilter_("My Description", "my_regex");

QCOMPARE( actual, expected );
}
Expand Down

0 comments on commit d6c969c

Please sign in to comment.