-
Notifications
You must be signed in to change notification settings - Fork 38
/
mouse_test.go
27 lines (23 loc) · 918 Bytes
/
mouse_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package terminal
import (
"testing"
"fyne.io/fyne/v2"
"github.com/stretchr/testify/assert"
)
func TestEncodeMouse(t *testing.T) {
term := New()
assert.Equal(t, "\x1b[M !!", string(term.encodeMouse(1, 0, fyne.NewPos(4, 4))))
assert.Equal(t, "\x1b[M!$#", string(term.encodeMouse(2, 0, fyne.NewPos(30, 36))))
assert.Equal(t, "\x1b[M#!!", string(term.encodeMouse(0, 0, fyne.NewPos(4, 4))))
}
func TestEncodeMouse_Mods(t *testing.T) {
term := New()
assert.Equal(t, "\x1b[M$!!", string(term.encodeMouse(1,
fyne.KeyModifierShift, fyne.NewPos(4, 4))))
assert.Equal(t, "\x1b[M4!!", string(term.encodeMouse(1,
fyne.KeyModifierShift|fyne.KeyModifierControl, fyne.NewPos(4, 4))))
assert.Equal(t, "\x1b[M%!!", string(term.encodeMouse(2,
fyne.KeyModifierShift, fyne.NewPos(4, 4))))
assert.Equal(t, "\x1b[M5!!", string(term.encodeMouse(2,
fyne.KeyModifierShift|fyne.KeyModifierControl, fyne.NewPos(4, 4))))
}