mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
io/input,widget: [API] replace per-widget Focused with Source.Focused
Widgets have themselves as tags, by convention, and so it's possible to replace the per-widget Focused methods with a general-purpose Source. Focused query. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -39,10 +39,10 @@ func TestClickable(t *testing.T) {
|
||||
}
|
||||
gtx.Execute(key.FocusCmd{Tag: &b1})
|
||||
frame()
|
||||
if !b1.Focused() {
|
||||
if !gtx.Focused(&b1) {
|
||||
t.Error("button 1 did not gain focus")
|
||||
}
|
||||
if b2.Focused() {
|
||||
if gtx.Focused(&b2) {
|
||||
t.Error("button 2 should not have focus")
|
||||
}
|
||||
r.Queue(
|
||||
@@ -73,10 +73,10 @@ func TestClickable(t *testing.T) {
|
||||
frame()
|
||||
gtx.Execute(key.FocusCmd{Tag: &b2})
|
||||
frame()
|
||||
if b1.Focused() {
|
||||
if gtx.Focused(&b1) {
|
||||
t.Error("button 1 should not have focus")
|
||||
}
|
||||
if !b2.Focused() {
|
||||
if !gtx.Focused(&b2) {
|
||||
t.Error("button 2 did not gain focus")
|
||||
}
|
||||
r.Queue(
|
||||
|
||||
Reference in New Issue
Block a user