forked from scijava/scijava-ui-swing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make file filter show the extension, instead of cryptic stuff
* Override FileFilter toString() method in SwingFileWidget so that it shows the extension(s) that are filtered by the file choose dialog instead of the standard toString() of the * Related to * bigdataviewer/bigdataviewer-playground#110 * https://forum.image.sc/t/scijava-command-file-extensions/29869/2
- Loading branch information
1 parent
2770bbf
commit 205cdc4
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/test/java/org/scijava/ui/swing/widget/SwingFileWidgetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.scijava.ui.swing.widget; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class SwingFileWidgetTest | ||
{ | ||
|
||
@Test | ||
public void testFormatFileFilterExtensions() { | ||
final List< String > multipleExtensions = Arrays.asList( "jpg", "jpeg", "png", "gif", "bmp" ); | ||
final List< String > singleExtension = Collections.singletonList( "xml" ); | ||
assertEquals( "*.jpg;*.jpeg;*.png;*.gif;*.bmp", SwingFileWidget.formatFileFilterExtensions( multipleExtensions ) ); | ||
assertEquals( "*.xml", SwingFileWidget.formatFileFilterExtensions( singleExtension ) ); | ||
} | ||
} |