zenity/notify_test.go

27 lines
484 B
Go
Raw Normal View History

2020-01-26 11:04:49 -05:00
package zenity_test
2020-01-29 06:09:06 -05:00
import (
"context"
"errors"
"testing"
"github.com/ncruces/zenity"
)
2020-01-26 11:04:49 -05:00
func ExampleNotify() {
2020-01-26 11:31:23 -05:00
zenity.Notify("There are system updates necessary!",
zenity.Title("Warning"),
zenity.Icon(zenity.InfoIcon))
2020-01-26 11:04:49 -05:00
// Output:
}
2020-01-29 06:09:06 -05:00
func TestNotifyCancel(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel()
err := zenity.Notify("text", zenity.Context(ctx))
if !errors.Is(err, context.Canceled) {
2020-01-29 09:15:21 -05:00
t.Error("was not canceled:", err)
2020-01-29 06:09:06 -05:00
}
}