Speech bubbles, a chat log that follows its end, a composer that sends on Enter, typing dots, chat and channel lists, read receipts, reactions, emoji and sticker pickers, mentions, date and unread rules, system lines, member lists, user cards, a mailbox, mail reader and letter, a notification bell, call controls, a voice meter, attachment chips, link previews and polls. pixel's editor takes EnterSends; display's Bubble takes a Fill and exports EmojiSprite. data.List names its rows, which also lets typing choose one. layout.ScrollArea and input.TextArea hold still under Inert, and an inert scroll view leaves the Tab order until it wakes.
34 lines
828 B
Go
34 lines
828 B
Go
package input_test
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/input"
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
func TestTextAreaHoldsStillWhenInert(t *testing.T) {
|
|
v, inert := "1\n2\n3\n4\n5\n6\n7\n8", false
|
|
tt := ui.NewTester(func(c *ui.Context) {
|
|
pixel.Use(c, pixel.Settings{Palette: pixel.SpringDay, Inert: inert})
|
|
input.TextArea(c, "Notes", &v, input.TextAreaOptions{Lines: 2})
|
|
}, 400, 200)
|
|
r, ok := tt.Find("Notes")
|
|
if !ok {
|
|
t.Fatal("no Notes")
|
|
}
|
|
inert = true
|
|
tt.Frame()
|
|
before := tt.Image()
|
|
// The caret keeps the view at the end; wheel upward.
|
|
tt.Move(r.X+10, r.Y+10)
|
|
tt.Scroll(r.X+10, r.Y+10, 0, -80)
|
|
tt.Frame()
|
|
if !bytes.Equal(before.Pix, tt.Image().Pix) {
|
|
t.Fatal("the wheel scrolled an inert text area")
|
|
}
|
|
}
|