forked from joejulian/gio
88f5ac9cb9
Processing one event at a time allows a widget to execute commands after the event that triggered it, instead of after all matching events. Signed-off-by: Elias Naur <mail@eliasnaur.com>
25 lines
437 B
Go
25 lines
437 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package input
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gioui.org/io/pointer"
|
|
)
|
|
|
|
func TestNoFilterAllocs(t *testing.T) {
|
|
b := testing.Benchmark(func(b *testing.B) {
|
|
var r Router
|
|
s := r.Source()
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
s.Event(nil, pointer.Filter{})
|
|
}
|
|
})
|
|
if allocs := b.AllocsPerOp(); allocs != 0 {
|
|
t.Fatalf("expected 0 AllocsPerOp, got %d", allocs)
|
|
}
|
|
}
|