MCPcopy Create free account
hub / github.com/cogentcore/core / TestButtonMenuClick

Function TestButtonMenuClick

core/button_test.go:58–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestButtonMenuClick(t *testing.T) {
59 b := NewBody()
60 b.Styler(func(s *styles.Style) {
61 s.Min.Set(units.Em(20), units.Em(10))
62 })
63 bt := NewButton(b).SetText("Share").SetIcon(icons.Share).SetMenu(func(m *Scene) {
64 NewButton(m).SetText("Copy link")
65 NewButton(m).SetText("Send message")
66 })
67 b.AssertRenderScreen(t, "button/menu-click", func() {
68 bt.Send(events.Click)
69 })
70}
71
72func TestButtonShortcut(t *testing.T) {
73 b := NewBody()

Callers

nothing calls this directly

Calls 10

AssertRenderScreenMethod · 0.95
EmFunction · 0.92
NewBodyFunction · 0.85
NewButtonFunction · 0.85
StylerMethod · 0.80
SetMenuMethod · 0.80
SetMethod · 0.65
SetIconMethod · 0.65
SetTextMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected