package ui import ( "context" "encoding/base64" "encoding/json" "image" "strings" "testing" "time" "gioui.org/f32" "gioui.org/io/pointer" "gioui.org/unit" "100gex/internal/rex/rextest" "100gex/internal/rexsession" "100gex/internal/scene" "100gex/internal/theme" "100gex/internal/workspace" ) // TestSessionSummaries checks what the sidebar says about sessions: what // runs in them, who else has them open, and a bell and a failure in a // session not shown, until it's shown. func TestSessionSummaries(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) // B rings the bell when typed into, and fails when typed into again. sidB, bidB := rextest.NewSession(t, laptop, "/bin/sh", "-c", "stty raw -echo; dd bs=1 count=1 >/dev/null 2>&1; printf '\\a'; dd bs=1 count=1 >/dev/null 2>&1; exit 3") h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) sum := func(id string) workspace.Summary { return h.u.ws.Summary(id) } typeInto := func(text string) { t.Helper() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() if err := laptop.BlockMethod(ctx, sidB, bidB, "com.superlogical.terminal.write", map[string]string{"data": text}, nil); err != nil { t.Fatal(err) } } h.until("what runs in each session", func(f rexsession.Frame) bool { // B's shell has no job control, so dd stays in the shell's // process group, and the shell is in the foreground, as at a // prompt. return f.Ready() && strings.Join(sum(sidA).Programs, ",") == "cat" && len(sum(sidB).Programs) == 1 }) if got := strings.Join(sum(sidA).Elsewhere, ","); got != "laptop" { t.Errorf("A is open elsewhere on %q, want laptop", got) } typeInto("x") h.until("B's bell", func(rexsession.Frame) bool { return sum(sidB).Has(workspace.NeedBell) }) if b := sum(sidB); pressing(b) != 1 || needWords(b.Attention[0]) != "Bell" { t.Errorf("B wants %+v, want a bell", b.Attention) } typeInto("y") h.until("B to fail", func(rexsession.Frame) bool { return sum(sidB).Has(workspace.NeedFailed) }) // The pane says only its most pressing news. if b := sum(sidB); pressing(b) != 1 || needWords(b.Attention[0]) != "Failed" || b.Attention[0].Message != "Exited with status 3" { t.Errorf("B wants %+v, want a failure", b.Attention) } if a := sum(sidA); len(a.Attention) > 0 { t.Errorf("A, shown, has %+v", a) } // Showing B clears what happened in it. h.u.ws.Switch(sidB) h.until("B shown and seen", func(f rexsession.Frame) bool { b := sum(sidB) return f.View.SessionID == sidB && len(b.Attention) == 0 }) // When the laptop leaves A, nobody else has it open. rextest.Call(t, laptop, "session.detach", map[string]string{"session_id": sidA}, nil) h.until("A to be open nowhere else", func(rexsession.Frame) bool { return len(sum(sidA).Elsewhere) == 0 }) } // TestSessionKeys goes to sessions across hosts by position, in turn, and // back to the last one, and renames and closes one from its menu. func TestSessionKeys(t *testing.T) { alpha := rextest.Start(t) bravo := rextest.Start(t) ac := alpha.Dial(t, "setup") sidA1, _ := rextest.NewSession(t, ac, rextest.RawCat...) sidA2, _ := rextest.NewSession(t, ac, rextest.RawCat...) sidB, _ := rextest.NewSession(t, bravo.Dial(t, "setup"), rextest.RawCat...) h := startUI(t, alpha, alpha.Dial(t, "100gex-test"), sidA1) h.until("A1", func(f rexsession.Frame) bool { return f.Ready() && f.View.SessionID == sidA1 }) h.u.Connect(bravo.Endpoint.String()) h.until("B", func(f rexsession.Frame) bool { return f.Ready() && f.View.SessionID == sidB }) perform := func(action string, args map[string]any) { t.Helper() raw, _ := json.Marshal(args) if args == nil { raw = nil } if err := h.u.perform(action, raw, nil, nil); err != nil { t.Fatal(err) } } shows := func(what, sid string) { t.Helper() h.until(what, func(f rexsession.Frame) bool { return f.Ready() && f.View.SessionID == sid }) } perform("session.goto", map[string]any{"index": 2}) shows("the second session, A2", sidA2) perform("session.next", nil) shows("the next session, on the other host, B", sidB) perform("session.last", nil) shows("the last session, A2", sidA2) perform("session.previous", nil) shows("the previous session, A1", sidA1) // Renaming in place. k := sessionKey{h.u.srv, sidA1} perform("session.rename", nil) if h.u.side.renaming != k { t.Fatalf("renaming %v, want %v", h.u.side.renaming, k) } h.frame() h.u.side.renameEditor.SetText("renamed") h.u.finishRename(true) h.until("the new label", func(rexsession.Frame) bool { label, _ := sessionLabel(k) return label == "renamed" }) // Closing from the menu takes two clicks. h.u.openSessionMenu(sessionKey{h.u.srv, sidA2}) h.frame() h.u.smenu.close.Click() h.frame() if !h.u.smenu.confirmClose || !h.u.smenu.open { t.Fatal("one click on Close didn't ask to confirm") } h.u.smenu.close.Click() h.frame() h.until("A2 to close", func(rexsession.Frame) bool { _, ok := sessionLabel(sessionKey{h.u.srv, sidA2}) return !ok }) } // TestSidebarToggle checks that a click on the corner's toggle collapses // and reopens the sidebar in the frame that handles it. (It once took // effect a frame late, and the window, which draws only when something // changes, could show the old width for seconds.) func TestSidebarToggle(t *testing.T) { srv := rextest.Start(t) sid, _ := rextest.NewSession(t, srv.Dial(t, "setup"), rextest.RawCat...) h := startUI(t, srv, srv.Dial(t, "100gex-test"), sid) f := h.until("the session", func(f rexsession.Frame) bool { return f.Ready() && f.Window != nil }) tab := func() int { return h.u.tabRects[f.Window.WindowID].Min.X } click := func(p image.Point) { for _, kind := range []pointer.Kind{pointer.Press, pointer.Release} { h.router.Queue(pointer.Event{Kind: kind, Source: pointer.Mouse, Position: f32.Pt(float32(p.X), float32(p.Y)), Buttons: pointer.ButtonPrimary}) } h.frame() } mid := int(theme.TitlebarHigh) / 2 expanded := tab() click(image.Pt(23, mid)) // the toggle, beside the switcher if !h.u.side.collapsed { t.Fatal("the toggle didn't collapse the sidebar") } if got := tab(); got >= expanded { t.Errorf("in the frame that collapsed the sidebar, the first tab is at %d, as before; want it further left", got) } click(image.Pt(int(railWide)/2, mid)) // the toggle, alone in the corner if h.u.side.collapsed { t.Fatal("the toggle didn't reopen the sidebar") } if got := tab(); got != expanded { t.Errorf("in the frame that reopened the sidebar, the first tab is at %d; want %d", got, expanded) } } // TestWarmSessions checks that sessions shown before stay attached, so // that showing one again needs no attach, with what arrived meanwhile, and // that only the most recent few stay attached. func TestWarmSessions(t *testing.T) { srv := rextest.Start(t) other := srv.Dial(t, "setup") var ids, blocks []string for i := 0; i < 7; i++ { sid, bid := rextest.NewSession(t, other, rextest.RawCat...) ids, blocks = append(ids, sid), append(blocks, bid) } c := srv.Dial(t, "100gex-test") h := startUI(t, srv, c, ids[0]) shows := func(id string) { t.Helper() h.until("the session", func(f rexsession.Frame) bool { return f.Ready() && f.View.SessionID == id }) } shows(ids[0]) h.u.ws.Switch(ids[1]) shows(ids[1]) // Typed into while away, the first session shows it when shown again, // in the next frame: it's still attached. ctx := context.Background() if err := other.BlockMethod(ctx, ids[0], blocks[0], "com.superlogical.terminal.write", map[string]string{"data": "while away"}, nil); err != nil { t.Fatal(err) } time.Sleep(200 * time.Millisecond) // for the output to arrive h.u.ws.Switch(ids[0]) h.frame() if f := h.frame(); f.View.SessionID != ids[0] { t.Fatalf("two frames after switching back, showing %s", f.View.SessionID) } h.held(func(f rexsession.Frame) { if text := screenText(h.term(blocks[0])); !strings.Contains(text, "while away") { t.Errorf("the session shown again says %q", text) } }) // Showing every session leaves this client attached to only the one // shown and the most recent before it. for _, id := range ids[1:] { h.u.ws.Switch(id) shows(id) } self := c.Welcome().Client.ID attached := func() int { n := 0 for _, id := range ids { var list struct { Clients []struct { ClientID string `json:"client_id"` } `json:"clients"` } rextest.Call(t, other, "session.list_clients", map[string]string{"session_id": id}, &list) for _, cl := range list.Clients { if cl.ClientID == self { n++ } } } return n } h.until("old sessions to be left", func(rexsession.Frame) bool { return attached() == 1+workspace.KeepWarm }) } // TestProgramStatus checks what programs report with OSC 7501 reaches a // session's summary, from a pane that isn't focused too: a question, its // kind and message; work going on; finished work, until the pane is seen; // and a failure, which stays while it's in sight. func TestProgramStatus(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) sidB, bidB := rextest.NewSession(t, laptop, "/bin/sh") var split struct { BlockIDs []string `json:"block_ids"` } rextest.Call(t, laptop, "session.new_split", map[string]any{ "session_id": sidB, "anchor_id": bidB, "direction": "horizontal", "side": "after", "layout": rextest.Block("/bin/sh"), }, &split) bidC := split.BlockIDs[0] // beside B's focused pane h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) sum := func() workspace.Summary { return h.u.ws.Summary(sidB) } report := func(block, pairs, msg string) { t.Helper() if msg != "" { pairs += ":msg=" + base64.StdEncoding.EncodeToString([]byte(msg)) } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() cmd := "printf '\\033]7501;" + pairs + "\\033\\\\'\n" if err := laptop.BlockMethod(ctx, sidB, block, "com.superlogical.terminal.write", map[string]string{"data": cmd}, nil); err != nil { t.Fatal(err) } } report(bidC, "state=blocked:kind=question:app=codex", "Which branch?") report(bidB, "state=working:app=claude", "") h.until("C's question and B's work", func(rexsession.Frame) bool { s := sum() return len(s.Attention) == 1 && s.Working == 1 }) s := sum() if got, want := s.Attention[0], (workspace.Item{WindowID: s.Attention[0].WindowID, BlockID: bidC, Need: workspace.NeedBlocked, Wait: "question", App: "codex", Message: "Which branch?", Since: s.Attention[0].Since}); got != want { t.Errorf("attention = %+v, want %+v", got, want) } if s.WorkingApp != "claude" { t.Errorf("working app = %q, want claude", s.WorkingApp) } if !s.NeedsYou() { t.Error("a question doesn't need the person") } report(bidC, "state=done:app=codex", "Rebased on main") h.until("C's finished work", func(rexsession.Frame) bool { s := sum() return len(s.Attention) == 1 && s.Attention[0].Need == workspace.NeedDone && s.Attention[0].Message == "Rebased on main" }) if sum().NeedsYou() { t.Error("finished work presses the person") } // A pane that appears later, as a worker an agent starts would, and // nobody types into, says when it waits for the person, but not when // it finishes: that's for whoever started it. var worker struct { BlockIDs []string `json:"block_ids"` } rextest.Call(t, laptop, "session.new_split", map[string]any{ "session_id": sidB, "anchor_id": bidC, "direction": "vertical", "side": "after", "layout": rextest.Block("/bin/sh"), }, &worker) bidD := worker.BlockIDs[0] report(bidD, "state=blocked:kind=permission:app=claude", "Delete build/?") h.until("D's request", func(rexsession.Frame) bool { return len(sum().Attention) == 2 }) report(bidD, "state=done:app=claude", "Deleted build/") h.until("D's request to go", func(rexsession.Frame) bool { return len(sum().Attention) == 1 }) if a := sum().Attention[0]; a.BlockID != bidC { t.Errorf("attention = %+v, want only C's", a) } // Showing B shows both its panes: the finished work is seen, and the // work goes on. h.u.ws.Switch(sidB) h.until("B shown, and its finished work seen", func(f rexsession.Frame) bool { s := sum() return f.View.SessionID == sidB && len(s.Attention) == 0 && s.Working == 1 }) // A failure in sight stays until the program says otherwise. report(bidC, "state=error:app=codex", "Merge conflict") h.until("C's failure", func(rexsession.Frame) bool { s := sum() return len(s.Attention) == 1 && s.Attention[0].Need == workspace.NeedError && s.Attention[0].Message == "Merge conflict" }) } // TestTrayReveals clicks a tray line about a pane in a tab out of sight, // in a session not shown, and checks the session is shown with that tab // active and that pane focused. func TestTrayReveals(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) sidB, _ := rextest.NewSession(t, laptop, rextest.RawCat...) var win struct { WindowID string `json:"window_id"` BlockIDs []string `json:"block_ids"` } q := base64.StdEncoding.EncodeToString([]byte("Which branch?")) rextest.Call(t, laptop, "session.new_window", map[string]any{ "session_id": sidB, "layout": rextest.Block("/bin/sh", "-c", "printf '\\033]7501;state=blocked:kind=question:app=codex:msg="+q+"\\033\\\\'; exec cat"), }, &win) bidC := win.BlockIDs[0] h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) h.until("B's question", func(rexsession.Frame) bool { return h.u.ws.Summary(sidB).Has(workspace.NeedBlocked) }) // B's second window isn't its active one: make the first active again, // as new_window may have made the new one active. view, _, err := laptop.SessionView(context.Background(), sidB) if err != nil { t.Fatal(err) } if view.ActiveWindowID == win.WindowID { rextest.Call(t, laptop, "session.focus_window", map[string]any{"session_id": sidB, "window_id": view.Windows[0].WindowID}, nil) } line := h.u.sessionWidgets(sessionKey{h.u.srv, sidB}).line(bidC) clickLine := func() { t.Helper() var at f32.Point for y := int(theme.TitlebarHigh); y < testHeight && at == (f32.Point{}); y += 4 { p := f32.Pt(100, float32(y)) h.router.Queue(pointer.Event{Kind: pointer.Move, Source: pointer.Mouse, Position: p}) h.frame() if line.Hovered() { at = p } } if at == (f32.Point{}) { t.Fatal("no tray line for C's question") } for _, kind := range []pointer.Kind{pointer.Press, pointer.Release} { h.router.Queue(pointer.Event{Kind: kind, Source: pointer.Mouse, Position: at, Buttons: pointer.ButtonPrimary, Time: time.Duration(time.Now().UnixNano())}) h.frame() } } cFocused := func(f rexsession.Frame) bool { w := f.View.ActiveWindow() return f.View.SessionID == sidB && w != nil && w.WindowID == win.WindowID && w.FocusedBlockID == bidC } clickLine() h.until("B shown with C focused", cFocused) // Shown, with its first tab active, B still lists the question, and a // click goes back to it. rextest.Call(t, laptop, "session.focus_window", map[string]any{"session_id": sidB, "window_id": view.Windows[0].WindowID}, nil) h.until("B's first tab", func(f rexsession.Frame) bool { return f.View.ActiveWindowID == view.Windows[0].WindowID }) clickLine() h.until("C focused again", cFocused) } // TestSidebarSteady checks that a tray doesn't come while the pointer // moves over the sidebar's rows, and comes once it has been still a while. func TestSidebarSteady(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) sidB, bidB := rextest.NewSession(t, laptop, "/bin/sh") h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) kB := sessionKey{h.u.srv, sidB} h.until("B's row", func(rexsession.Frame) bool { _, ok := h.u.side.shown[kB]; return ok }) // Over A's row, the first session's. at := f32.Pt(100, float32(theme.TitlebarHigh)+60) move := func() { h.router.Queue(pointer.Event{Kind: pointer.Move, Source: pointer.Mouse, Position: at}) h.frame() } move() if !h.u.side.steadyUntil.After(time.Now()) { t.Fatal("moving over a row didn't steady the sidebar") } q := base64.StdEncoding.EncodeToString([]byte("Which branch?")) rextest.Call(t, laptop, "com.superlogical.terminal.write", map[string]any{"session_id": sidB, "block_id": bidB, "args": map[string]string{"data": "printf '\\033]7501;state=blocked:kind=question:msg=" + q + "\\033\\\\'\n"}}, nil) h.until("B's question in its summary", func(rexsession.Frame) bool { move(); return h.u.ws.Summary(sidB).NeedsYou() }) move() if len(h.u.side.shown[kB].Attention) != 0 { t.Error("B's tray came while the pointer moved over the sidebar") } h.until("B's tray, once the pointer is still", func(rexsession.Frame) bool { return len(h.u.side.shown[kB].Attention) == 1 }) } // TestWorkingMarksAlone checks that the working marks' stripes moving, on // a session's row and in a tray, draw only the marks again, each where the // sidebar lays it out. func TestWorkingMarksAlone(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) working := "printf '\\033]7501;state=working:app=claude\\033\\\\'; exec cat" question := "printf '\\033]7501;state=blocked:kind=question\\033\\\\'; exec cat" // B is at work: a mark on its row. C is at work and has a question: // a mark in its tray. sidB, _ := rextest.NewSession(t, laptop, "/bin/sh", "-c", working) sidC, bidC := rextest.NewSession(t, laptop, "/bin/sh", "-c", question) rextest.Call(t, laptop, "session.new_split", map[string]any{ "session_id": sidC, "anchor_id": bidC, "direction": "horizontal", "side": "after", "layout": rextest.Block("/bin/sh", "-c", working), }, nil) h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) marks := func() map[workingMark]*scene.Layer { m := make(map[workingMark]*scene.Layer) for _, l := range h.u.Scene().Layers() { if k, ok := l.Key.(workingMark); ok { m[k] = l } } return m } rowB := workingMark{sessionKey{h.u.srv, sidB}, false} trayC := workingMark{sessionKey{h.u.srv, sidC}, true} h.until("B's mark and C's tray's", func(rexsession.Frame) bool { m := marks() return len(m) == 2 && m[rowB] != nil && m[trayC] != nil }) h.clock = time.Now().Truncate(stripeStep) h.frame() var sidebar image.Rectangle for _, l := range h.u.Scene().Layers() { if l.Key == (layerKey{layerSidebar, ""}) { sidebar = l.Bounds } } for k, l := range marks() { if l.Bounds.Empty() || !l.Bounds.In(sidebar) { t.Errorf("mark %v is at %v, not in the sidebar, at %v", k, l.Bounds, sidebar) } } for step := range 3 { before := make(map[any]uint64) for _, l := range h.u.Scene().Layers() { before[l.Key] = l.Gen } h.clock = h.clock.Add(stripeStep) h.frame() for _, l := range h.u.Scene().Layers() { _, mark := l.Key.(workingMark) if changed := l.Gen != before[l.Key]; changed != mark { t.Errorf("step %d: layer %v changed: %v, want %v", step, l.Key, changed, mark) } } } } // TestSessionRowClick clicks a session's row in the sidebar and checks // that the session is shown, and that a right click opens its menu. (The // menu's pointer area once lay over the row's clickable, so that rows // neither lit up under the pointer nor heard clicks.) func TestSessionRowClick(t *testing.T) { srv := rextest.Start(t) laptop := srv.Dial(t, "laptop") sidA, _ := rextest.NewSession(t, laptop, rextest.RawCat...) sidB, _ := rextest.NewSession(t, laptop, rextest.RawCat...) h := startUI(t, srv, srv.Dial(t, "100gex-test"), sidA) kB := sessionKey{h.u.srv, sidB} h.until("B's row", func(rexsession.Frame) bool { _, ok := h.u.side.shown[kB]; return ok }) click := &h.u.sessionWidgets(kB).click var at f32.Point for y := int(theme.TitlebarHigh); y < testHeight && at == (f32.Point{}); y += 4 { p := f32.Pt(100, float32(y)) h.router.Queue(pointer.Event{Kind: pointer.Move, Source: pointer.Mouse, Position: p}) h.frame() if click.Hovered() { at = p } } if at == (f32.Point{}) { t.Fatal("the pointer is over B's row nowhere") } for _, kind := range []pointer.Kind{pointer.Press, pointer.Release} { h.router.Queue(pointer.Event{Kind: kind, Source: pointer.Mouse, Position: at, Buttons: pointer.ButtonPrimary, Time: time.Duration(time.Now().UnixNano())}) h.frame() } h.until("B shown", func(f rexsession.Frame) bool { return f.View.SessionID == sidB }) // A right click there still opens B's menu. for _, kind := range []pointer.Kind{pointer.Press, pointer.Release} { h.router.Queue(pointer.Event{Kind: kind, Source: pointer.Mouse, Position: at, Buttons: pointer.ButtonSecondary}) h.frame() } if !h.u.smenu.open || h.u.smenu.key != kB { t.Error("a right click on B's row didn't open its menu") } } // TestSidebarResize drags the sidebar's edge, and checks that the window // is laid out at the new width in the frame the drag reaches it, that the // width stays within its limits, that the end of a drag reports it, and // that a double click puts it back. func TestSidebarResize(t *testing.T) { srv := rextest.Start(t) sid, _ := rextest.NewSession(t, srv.Dial(t, "setup"), rextest.RawCat...) h := startUI(t, srv, srv.Dial(t, "100gex-test"), sid) var reported []unit.Dp h.u.SidebarResized = func(w unit.Dp) { reported = append(reported, w) } f := h.until("the session", func(f rexsession.Frame) bool { return f.Ready() && f.Window != nil }) tab := func() int { return h.u.tabRects[f.Window.WindowID].Min.X } send := func(kind pointer.Kind, x int) { h.router.Queue(pointer.Event{Kind: kind, Source: pointer.Mouse, Position: f32.Pt(float32(x), 300), Buttons: pointer.ButtonPrimary}) h.frame() } edge := int(theme.SidebarWide) - int(theme.Border)/2 expanded := tab() drag := func(from, to int) { send(pointer.Press, from) for i := 1; i <= 4; i++ { send(pointer.Move, from+(to-from)*i/4) } send(pointer.Release, to) } drag(edge, edge+100) if got, want := h.u.SidebarWidth, theme.SidebarWide+100; got != want { t.Fatalf("dragged 100px right, the sidebar is %v wide; want %v", got, want) } if got, want := tab(), expanded+100; got != want { t.Errorf("the first tab is at %d; want %d", got, want) } if len(reported) != 1 || reported[0] != theme.SidebarWide+100 { t.Errorf("reported %v; want one report of %v", reported, theme.SidebarWide+100) } // Far left stops at the narrowest; far right leaves the panes room. drag(edge+100, 0) if got := h.u.SidebarWidth; got != sidebarMin { t.Errorf("dragged to the window's left, the sidebar is %v wide; want %v", got, sidebarMin) } drag(int(sidebarMin), testWidth) if got := h.u.SidebarWidth; got != sidebarMax { t.Errorf("dragged to the window's right, the sidebar is %v wide; want %v", got, sidebarMax) } // A press away from the edge doesn't resize. before := h.u.SidebarWidth drag(int(before)-40, int(before)+40) if got := h.u.SidebarWidth; got != before { t.Errorf("a drag inside the sidebar resized it to %v", got) } // A double click on the edge puts the width back, in that frame. reported = nil x := int(sidebarMax) - 1 send(pointer.Press, x) send(pointer.Release, x) send(pointer.Press, x) send(pointer.Release, x) if h.u.SidebarWidth != 0 || tab() != expanded { t.Errorf("after a double click, the width is %v and the first tab at %d; want 0 and %d", h.u.SidebarWidth, tab(), expanded) } if len(reported) != 1 || reported[0] != 0 { t.Errorf("the double click reported %v; want [0]", reported) } }