mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
example: rename apps module
The new name emphasize the nature of the programs and won't be confused with package `app`. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"image"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gioui.org/io/event"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/unit"
|
||||
)
|
||||
|
||||
type queue struct{}
|
||||
|
||||
type config struct{}
|
||||
|
||||
func BenchmarkUI(b *testing.B) {
|
||||
fetch := func(_ string) {}
|
||||
u := newUI(fetch)
|
||||
cfg := new(config)
|
||||
gtx := &layout.Context{
|
||||
Queue: new(queue),
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
gtx.Reset(cfg, image.Point{800, 600})
|
||||
u.Layout(gtx)
|
||||
}
|
||||
}
|
||||
|
||||
func (queue) Events(k event.Key) []event.Event {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (config) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
func (config) Px(v unit.Value) int {
|
||||
return int(v.V + .5)
|
||||
}
|
||||
Reference in New Issue
Block a user