This repository has been archived by the owner on Jul 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
errapp.go
40 lines (32 loc) · 1.57 KB
/
errapp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package errapp provides a stub App implementation.
package errapp
import (
"image"
"github.com/rcoreilly/goki/gi/oswin"
)
// Stub returns an App whose methods all return the given error.
func Stub(err error) oswin.App {
return stub{err}
}
type stub struct {
err error
}
func (s stub) NewImage(size image.Point) (oswin.Image, error) { return nil, s.err }
func (s stub) NewTexture(win oswin.Window, size image.Point) (oswin.Texture, error) { return nil, s.err }
func (s stub) NewWindow(opts *oswin.NewWindowOptions) (oswin.Window, error) { return nil, s.err }
func (s stub) NScreens() int { return 0 }
func (s stub) Screen(scrN int) *oswin.Screen { return nil }
func (s stub) NWindows() int { return 0 }
func (s stub) Window(win int) oswin.Window { return nil }
func (s stub) WindowByName(name string) oswin.Window { return nil }
func (s stub) Name() string { return "" }
func (s stub) SetName(name string) {}
func (s stub) PrefsDir() string { return "" }
func (s stub) GoGiPrefsDir() string { return "" }
func (s stub) AppPrefsDir() string { return "" }
func (s stub) FontPaths() []string { return nil }
// check for interface implementation
var _ oswin.App = &stub{}