mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
56 lines
1.0 KiB
Go
56 lines
1.0 KiB
Go
|
package screenshot
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestScreenshotOptions(t *testing.T) {
|
||
|
o := ScreenshotOptions{}
|
||
|
assert.Equal(t, ScreenshotOptions{}, o)
|
||
|
|
||
|
o = o.SetDefaults()
|
||
|
assert.Equal(t, ScreenshotOptions{
|
||
|
Width: DefaultWidth,
|
||
|
Height: DefaultHeight,
|
||
|
Theme: DefaultTheme,
|
||
|
Timeout: DefaultTimeout,
|
||
|
}, o)
|
||
|
|
||
|
o.Width = 100
|
||
|
o = o.SetDefaults()
|
||
|
assert.Equal(t, ScreenshotOptions{
|
||
|
Width: 100,
|
||
|
Height: DefaultHeight,
|
||
|
Theme: DefaultTheme,
|
||
|
Timeout: DefaultTimeout,
|
||
|
}, o)
|
||
|
|
||
|
o.Height = 100
|
||
|
o = o.SetDefaults()
|
||
|
assert.Equal(t, ScreenshotOptions{
|
||
|
Width: 100,
|
||
|
Height: 100,
|
||
|
Theme: DefaultTheme,
|
||
|
Timeout: DefaultTimeout,
|
||
|
}, o)
|
||
|
|
||
|
o.Theme = "Not a theme"
|
||
|
o = o.SetDefaults()
|
||
|
assert.Equal(t, ScreenshotOptions{
|
||
|
Width: 100,
|
||
|
Height: 100,
|
||
|
Theme: DefaultTheme,
|
||
|
Timeout: DefaultTimeout,
|
||
|
}, o)
|
||
|
|
||
|
o.Timeout = DefaultTimeout + 1
|
||
|
assert.Equal(t, ScreenshotOptions{
|
||
|
Width: 100,
|
||
|
Height: 100,
|
||
|
Theme: DefaultTheme,
|
||
|
Timeout: DefaultTimeout + 1,
|
||
|
}, o)
|
||
|
}
|