Skip to content

Commit

Permalink
Add TestFileFavorites
Browse files Browse the repository at this point in the history
  • Loading branch information
PucklaJ committed Oct 1, 2020
1 parent 8751553 commit 61bec5a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dialog/file_test.go
@@ -1,6 +1,7 @@
package dialog

import (
"fmt"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -282,3 +283,29 @@ func TestFileFilters(t *testing.T) {
}
assert.Equal(t, 4, count)
}

func TestFileFavorites(t *testing.T) {
win := test.NewWindow(widget.NewLabel("Content"))

dlg := NewFileOpen(func(reader fyne.URIReadCloser, err error) {
assert.Nil(t, err)
assert.Nil(t, reader)
}, win)

dlg.Show()

favorites := dlg.dialog.loadFavorites()
places := dlg.dialog.loadPlaces()
assert.Equal(t, 3+len(places), len(favorites))

curDir := ""
for _, f := range favorites {
btn := f.(*widget.Button)
t.Log(fmt.Sprint("Changing from ", curDir, " to ", btn.Text))
test.Tap(btn)
assert.NotEqual(t, curDir, dlg.dialog.dir)
curDir = dlg.dialog.dir
}

test.Tap(dlg.dialog.dismiss)
}

0 comments on commit 61bec5a

Please sign in to comment.