forked from joejulian/gio
widget: remove test dependency on package app
Without the dependency, tests builds much faster. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gioui.org/app"
|
|
||||||
"gioui.org/io/input"
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/key"
|
"gioui.org/io/key"
|
||||||
"gioui.org/layout"
|
"gioui.org/layout"
|
||||||
@@ -16,12 +15,14 @@ import (
|
|||||||
|
|
||||||
func TestClickable(t *testing.T) {
|
func TestClickable(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
ops op.Ops
|
r input.Router
|
||||||
r input.Router
|
b1 widget.Clickable
|
||||||
b1 widget.Clickable
|
b2 widget.Clickable
|
||||||
b2 widget.Clickable
|
|
||||||
)
|
)
|
||||||
gtx := app.NewContext(&ops, app.FrameEvent{Source: r.Source()})
|
gtx := layout.Context{
|
||||||
|
Ops: new(op.Ops),
|
||||||
|
Source: r.Source(),
|
||||||
|
}
|
||||||
layout := func() {
|
layout := func() {
|
||||||
b1.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
b1.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
return layout.Dimensions{Size: image.Pt(100, 100)}
|
return layout.Dimensions{Size: image.Pt(100, 100)}
|
||||||
@@ -32,7 +33,7 @@ func TestClickable(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
frame := func() {
|
frame := func() {
|
||||||
ops.Reset()
|
gtx.Reset()
|
||||||
layout()
|
layout()
|
||||||
r.Frame(gtx.Ops)
|
r.Frame(gtx.Ops)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"image"
|
"image"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"gioui.org/app"
|
|
||||||
"gioui.org/f32"
|
"gioui.org/f32"
|
||||||
"gioui.org/io/input"
|
"gioui.org/io/input"
|
||||||
"gioui.org/io/pointer"
|
"gioui.org/io/pointer"
|
||||||
@@ -18,11 +17,13 @@ import (
|
|||||||
|
|
||||||
func TestBool(t *testing.T) {
|
func TestBool(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
ops op.Ops
|
r input.Router
|
||||||
r input.Router
|
b widget.Bool
|
||||||
b widget.Bool
|
|
||||||
)
|
)
|
||||||
gtx := app.NewContext(&ops, app.FrameEvent{Source: r.Source()})
|
gtx := layout.Context{
|
||||||
|
Ops: new(op.Ops),
|
||||||
|
Source: r.Source(),
|
||||||
|
}
|
||||||
layout := func() {
|
layout := func() {
|
||||||
b.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
b.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||||
semantic.CheckBox.Add(gtx.Ops)
|
semantic.CheckBox.Add(gtx.Ops)
|
||||||
@@ -44,7 +45,7 @@ func TestBool(t *testing.T) {
|
|||||||
Position: f32.Pt(50, 50),
|
Position: f32.Pt(50, 50),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
ops.Reset()
|
gtx.Reset()
|
||||||
layout()
|
layout()
|
||||||
r.Frame(gtx.Ops)
|
r.Frame(gtx.Ops)
|
||||||
tree := r.AppendSemantics(nil)
|
tree := r.AppendSemantics(nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user