2019-12-11 05:29:31 -05:00
|
|
|
package dialog
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestOpenFile(t *testing.T) {
|
2019-12-13 21:16:06 -05:00
|
|
|
res, err := OpenFile("", "", []FileFilter{
|
2019-12-11 05:29:31 -05:00
|
|
|
{"Go files", []string{".go"}},
|
|
|
|
{"Web files", []string{".html", ".js", ".css"}},
|
2019-12-13 21:16:06 -05:00
|
|
|
{"Image files", []string{".png", ".gif", ".ico", ".jpg", ".webp"}},
|
2019-12-11 05:29:31 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
} else {
|
2019-12-13 21:16:06 -05:00
|
|
|
t.Logf("%#v", res)
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestOpenFiles(t *testing.T) {
|
2019-12-13 21:16:06 -05:00
|
|
|
res, err := OpenFiles("", "", []FileFilter{
|
2019-12-11 05:29:31 -05:00
|
|
|
{"Go files", []string{".go"}},
|
|
|
|
{"Web files", []string{".html", ".js", ".css"}},
|
2019-12-13 21:16:06 -05:00
|
|
|
{"Image files", []string{".png", ".gif", ".ico", ".jpg", ".webp"}},
|
2019-12-11 05:29:31 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
} else {
|
2019-12-13 21:16:06 -05:00
|
|
|
t.Logf("%#v", res)
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSaveFile(t *testing.T) {
|
2019-12-13 21:16:06 -05:00
|
|
|
res, err := SaveFile("", "", true, []FileFilter{
|
2019-12-11 05:29:31 -05:00
|
|
|
{"Go files", []string{".go"}},
|
|
|
|
{"Web files", []string{".html", ".js", ".css"}},
|
2019-12-13 21:16:06 -05:00
|
|
|
{"Image files", []string{".png", ".gif", ".ico", ".jpg", ".webp"}},
|
2019-12-11 05:29:31 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
} else {
|
2019-12-13 21:16:06 -05:00
|
|
|
t.Logf("%#v", res)
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPickFolder(t *testing.T) {
|
2019-12-13 21:16:06 -05:00
|
|
|
res, err := PickFolder("", "")
|
2019-12-11 05:29:31 -05:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
} else {
|
2019-12-13 21:16:06 -05:00
|
|
|
t.Logf("%#v", res)
|
2019-12-11 05:29:31 -05:00
|
|
|
}
|
|
|
|
}
|