Skip to content

Commit c0c8b33

Browse files
committed
test, gui: Add tests for GUIUtil::extractFirstSuffixFromFilter
1 parent d79abb9 commit c0c8b33

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/qt/test/optiontests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <init.h>
66
#include <qt/bitcoin.h>
7+
#include <qt/guiutil.h>
78
#include <qt/test/optiontests.h>
89
#include <test/util/setup_common.h>
910
#include <util/system.h>
@@ -122,3 +123,19 @@ void OptionTests::parametersInteraction()
122123
QVERIFY(!settings.contains("fListen"));
123124
gArgs.ClearPathCache();
124125
}
126+
127+
void OptionTests::extractFilter()
128+
{
129+
QString filter = QString("Partially Signed Transaction (Binary) (*.psbt)");
130+
QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "psbt");
131+
132+
filter = QString("Comma separated file (*.csv)");
133+
QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "csv");
134+
135+
filter = QString("PNG Image (*.png)");
136+
QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "png");
137+
138+
filter = QString("Wallet Data (*.dat)");
139+
QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "dat");
140+
141+
}

src/qt/test/optiontests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ private Q_SLOTS:
2222
void migrateSettings();
2323
void integerGetArgBug();
2424
void parametersInteraction();
25+
void extractFilter();
2526

2627
private:
2728
interfaces::Node& m_node;

0 commit comments

Comments
 (0)