Skip to content

Commit d6c969c

Browse files
committedJan 27, 2015
test for original createFileFilter
1 parent d7bef1c commit d6c969c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
 

‎src/gui/qgisgui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ namespace QgisGui
182182

183183
QString createFileFilter_( QString const &format )
184184
{
185-
QString longName = format + " format";
186-
QString glob = "*" + format;
185+
QString longName = format.toUpper() + " format";
186+
QString glob = "*." + format;
187187
return createFileFilter_( longName, glob );
188188
}
189189

‎tests/src/gui/testqgsgui.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@ class TestQgsGui : public QObject
2020
{
2121
Q_OBJECT
2222
private slots:
23+
void createFileFilterForFormat();
2324
void createFileFilter();
2425

2526
};
2627

27-
void TestQgsGui::createFileFilter()
28+
void TestQgsGui::createFileFilterForFormat()
2829
{
2930
QString expected = "FOO format (*.foo *.FOO)";
30-
QString actual = QgisGui::createFileFilter_("foo");;
31+
QString actual = QgisGui::createFileFilter_("foo");
32+
33+
QCOMPARE( actual, expected );
34+
}
35+
36+
void TestQgsGui::createFileFilter()
37+
{
38+
QString expected = "My Description (my_regex MY_REGEX)";
39+
QString actual = QgisGui::createFileFilter_("My Description", "my_regex");
3140

3241
QCOMPARE( actual, expected );
3342
}

0 commit comments

Comments
 (0)
Please sign in to comment.